nut.chart.sh
Hi,
My NUT installation uses SSL to establish connections. When using the upsc command you'll get a warning printed to stderr
# upsc -l
Init SSL without certificate database
Connecting in SSL to 'localhost' (no certificate name specified)
Do not intend to authenticate server localhost
SSL handshake done successfully with server localhost
Connected to localhost in SSL
Certificate verification is disabled
[... list of declared UPSes ...]
This is harmless for the charts collection but these messages to stderr flood the error.log which is an inconvenience. The fix is pretty simple, just add a 2>/dev/null to nut_get_all() and nut_get() and the error.log gets clean again.
hm... if I do this, then there will be no way to check why it is not running, to trace an issue.
We have 2 solutions here:
-
write it like this:
nut_get_all() { timeout $nut_timeout upsc -l 2>${TMP_DIR}/nut.log local ret=$? [ $ret -ne 0 ] && cat >&2 "${TMP_DIR}/nut.log" return $ret }The above will allow the log to be shown if
upscfails.${TMP_DIR}is in/var/runso for many systems this is tmpfs.or
-
You can overwrite this function in
/etc/netdata/charts.d/nut.confto eliminate these logs.
Probably I can add a wrapper function in charts.d.plugin to do this for all charts.d modules...
It is not in /var/run unfortunately: https://github.com/firehol/netdata/blob/cb2d5267a2176f952f19537ad7379f4f1a9469d0/plugins.d/charts.d.plugin#L480-L485
Well, the written data is very low in size so this isn't an issue. If I'm not wrong, the filename /tmp/.netdata-${PROGRAM_NAME}-XXXXXXXXXX only changes upon NetData restart right?
All in all, the solution you suggest above seems perfectly acceptable.
I implemented it https://github.com/ktsaou/netdata Can you check it?
merged it. If you find any issues, let me know.