[Nut-upsdev] Quiet upsmon /var/log/messages chatter
Larry Baker
baker at usgs.gov
Wed Oct 21 19:23:24 UTC 2015
I use the NUT RPM package for CentOS 6.7, which is version 2.6.5-2.
I am testing implementation of NUT features with APC and Tripp-Lite USB UPS interfaces. Things are going reasonably well. However, I'm seeing many more messages than I would like in /var/log/messages when I boot the system without the UPS connected (testing a failure scenario). I have configured NOCOMMWARNTIME 3600, which takes care to only broadcast to logged in terminals and send me emails once an hour. However, /var/log/messages is being filled with "upsmon[2391]: Poll UPS [tripplite at localhost] failed - Driver not connected" messages every five seconds. I cannot seem to find a way to reduce that chatter.
I found the "Driver not connected" condition can refer to either the TCP connection down between the client and the server (fd < 0), or between the server and the device driver or the device driver and the UPS (commstate <> 1). The attached patch to pullups() in clients/upsmon.c suppresses the messages sent to /var/log/messages every five seconds when commstate <> 1, since DRVNOTCONN is actually expected in that case.
There is another place in try_connect() in clients/upsmon.c that causes messages to be written to /var/log/message every five seconds when a TCP connection cannot be made from the client to the server. (I test this failure scenario by killing the server upsd.) I changed that to a debugging message (matching the debugging message earlier in try_connect() logging the attempt), since the normal message stream and email notifications will still occur.
The chatter from upsmon writing to /var/log/messages every five seconds clutters the system log file so much it is hard to deal with. Especially, as in our case, remotely over very slow Internet connections. With these two changes, /var/log/messages contains a message, and an email is sent, when the error condition first occurs and thereafter every NOCOMMWARNTIME seconds. This is as I expect, and desire.
Please consider these changes.
Larry Baker
US Geological Survey
650-329-5608
baker at usgs.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nut-2.6.5-upsmon.patch
Type: application/octet-stream
Size: 631 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20151021/b6317195/attachment.obj>
More information about the Nut-upsdev
mailing list