node-exporter-textfile-collector-scripts icon indicating copy to clipboard operation
node-exporter-textfile-collector-scripts copied to clipboard

Issue with smartmon data

Open skibbipl opened this issue 3 years ago • 4 comments

After installing node_exporter I see following error in the logs:

May 16 23:49:35 odroidn2 prometheus-node-exporter[96276]: level=error ts=2021-05-16T21:49:35.076Z caller=textfile.go:209 collector=textfile msg="failed to collect textfile data" file=smartmon.prom err="failed to parse textfile data from \"/var/lib/prometheus/node-exporter/smartmon.prom\": text format parsing error in line 6: expected float as value, got \"0,000000e+00\""

Line 6 in the file contains following:

smartmon_current_pending_sector_raw_value{disk="/dev/sda",type="sat",smart_id="197"} 0,000000e+00

I have following locale set:

LC_MESSAGES=en_US.UTF-8
LANG=pl_PL.UTF-8

This is an armbian (debian based) installation.

skibbipl avatar May 31 '21 22:05 skibbipl

Set LC_NUMERIC=C in the environment (e.g. cronjob) that you are launching the smartmon.py script from, and you should then get floating point numbers in the format that node_exporter expects them.

dswarbrick avatar May 31 '21 23:05 dswarbrick

Yeah, that makes sense. I will file a bug report for debian package maintainers - the fix is pretty simple, adding one line to systemd unit file prometheus-node-exporter-smartmon.service:

Environment=LC_NUMERIC=C

skibbipl avatar Jun 01 '21 08:06 skibbipl

Since this will affect other distros as well, maybe it makes more sense to implement the fix in the script itself, rather than the systemd unit / cronjob.

dswarbrick avatar Jun 01 '21 11:06 dswarbrick

For the reference, this is the corresponding Debian bug report.

varac avatar May 19 '22 06:05 varac