[Nut-upsuser] Need the date included in nuts -wall msgs.

Charles Lepple clepple at gmail.com
Wed Aug 19 00:06:40 UTC 2015


On Aug 18, 2015, at 1:22 PM, Gene Heskett <gheskett at wdtv.com> wrote:
> 
> On Tuesday 18 August 2015 09:50:32 Charles Lepple wrote:
> 
>> On Aug 18, 2015, at 3:27 AM, Gene Heskett <gheskett at wdtv.com> wrote:
>>> Greetings all;
>>> 
>>> Is it possible to set a logging option in one of the config files so
>>> that when we have a 1 second power bump, the date is included, both
>>> in the log, and in the -wall broadcast?
>> 
>> Hey Gene,
>> 
>> The syslog entry should have one-second resolution in the timestamps,
>> and you could use the "EXEC" option in "NOTIFYFLAG" in upsmon.conf to
>> call your own script on the ONBATT and ONLINE events (which would
>> allow you to pass whatever message you want to "wall").
> 
> The syslog does not date that specific event:

Sorry, I wasn't specific. The logging goes through the (r)syslog daemon (LOG_NOTICE level for upsmon), and I think the default is for daemon messages to go to /var/log/daemon.log (although I am seeing a number of them in /var/log/syslog as well).

If /var/log/daemon.log is listed in /etc/syslog.conf (or rsyslog.conf? depends on the vintage) then you might check to see if that log file is still there, and has similar permissions to the other files in /var/log.

> I cannot put that printer on the 1500 WA UPS, as its drum heaters
> kicking in at the start of a job or at power up, cause the UPS to do an
> instant, protective shutdown.  But these bumps are so short the printer
> does not forget its turned on, but does trigger a re-init cycle.

There was a discussion a while back about using a mouse with its DC power lines routed through a relay with its coil on AC. That would take less power than using a printer as a power-fail sensor ;-)

>> 
>> However, for a one-second glitch, many of the NUT drivers might miss
>> that in their polling cycle. (This usually isn't a problem, since an
>> UPS with a good battery should be able power the load for much longer
>> than one poll interval.)
>> 
>> This is one of the few cases where a "dumb" contact-closure UPS and a
>> dedicated serial port monitor program might be a better fit. Which
>> driver(s) are you using?
> 
> Its a Belkin, ups.conf:driver=usbhid-ups.

This is one of those cases where you might be able to catch one-second events by reducing the driver parameter "pollinterval" from 2 to 1 second in ups.conf, and likewise for both POLLFREQ and POLLFREQALERT in upsmon.conf. However, <hand-waving about Nyquist sampling rates> and you're still talking 1+/-1 second time resolution at the driver, and possibly worse at upsmon.

In usbhid-ups, the on-line/on-battery bits are refreshed at the higher "pollinterval" rate, and other less-important variables are polled every 30 seconds. The Belkin driver appears to properly mark the important variables, but the higher polling rate hasn't been tested to my knowledge.

To get closer to the exact time, you could also add some custom logging right in the driver. It bypasses the upsmon latency, at least. Would require rebuilding the driver, but it's not too bad. This is on Ubuntu, right? Which version?

-- 
- Charles Lepple
https://ghz.cc/charles/





More information about the Nut-upsuser mailing list