node-exporter-textfile-collector-scripts
node-exporter-textfile-collector-scripts copied to clipboard
Issue with smartmon data
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.
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.
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
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.
For the reference, this is the corresponding Debian bug report.