Hi Charles,
On Monday, 27. June 2016 08:59:02 Charles Lepple wrote:> > is there a way to query from the cmdline if the UPS data is stale?
>
> The "data stale" state applies to the entire set of variables for
an UPS,
> so if the exit code of `upsc` is zero, the data set is not stale.
> > "upsc" outputs a lot of information, but not if the data is
stale.
you are right. The exit code is exactly what I need for nagios monitoring.
When I invoke upsc multiple times, the data is sometimes stale, sometimes not.
Current log output (I specifically didn't fix the issue yet):
Jun 27 14:56:08 server upsd: UPS [apcsmart] data is no longer stale
Jun 27 14:56:08 server upsd[3123]: UPS [apcsmart] data is no longer stale
Jun 27 14:56:24 server upsd[3123]: Data for UPS [apcsmart] is stale - check
driver
Jun 27 14:56:24 server upsd: Data for UPS [apcsmart] is stale - check driver
Jun 27 14:56:36 server upsmon: Poll UPS [apcsmart at localhost] failed - Data
stale
Jun 27 14:56:41 server upsmon: Poll UPS [apcsmart at localhost] failed - Data
stale
Jun 27 14:56:46 server upsmon: Poll UPS [apcsmart at localhost] failed - Data
stale
..
Jun 27 14:58:36 server upsmon: Poll UPS [apcsmart at localhost] failed - Data
stale
Jun 27 14:58:38 server upsd: UPS [apcsmart] data is no longer stale
Jun 27 14:58:38 server upsd[3123]: UPS [apcsmart] data is no longer stale
Jun 27 14:58:54 server upsd[3123]: Data for UPS [apcsmart] is stale - check
driver
Jun 27 14:58:54 server upsd: Data for UPS [apcsmart] is stale - check driver
Jun 27 14:58:56 server upsmon: Poll UPS [apcsmart at localhost] failed - Data
stale
> > driver.name: usbhid-ups
> > driver.parameter.pollfreq: 30
> > driver.parameter.pollinterval: 2
>
> You can tune these parameters to avoid the stale condition, at the expense
> of slightly longer latency for updates. The smaller `pollinterval`
> (seconds between poll cycles) is used for items marked
> "HU_FLAG_QUICK_POLL" in the HID tables:
> https://github.com/networkupstools/nut/blob/master/drivers/apc-hid.c#L301
> and the `pollfreq` value is used for polling the rest.
>
> More information here: http://networkupstools.org/docs/man/usbhid-ups.html
> (I think the interrupt stuff applies to APC models with USB ID 051d:0002)
>
> If needed, we can look at the debug output to see what is going on, but
> for whatever reason, a few "data stale" messages over the course
of a day
> seems normal for many USB UPS interfaces.
it's running fine for months normally. You are right again, I've checked
the logs
back to 2016-05-06 and there are a few "Data stale" messages over the
course of the day.
I think I'll leave the polling frequency on the default value and
just add monitoring to get notified if the data is stale for a longer time
period.
Thanks a lot Charles, that was really helpful.
Thomas