On Sun, Nov 30, 2014 at 10:54 AM, Marcus MERIGHI <mcmer-open...@tor.at> wrote:
> for the impatient, here are my questions:
>
> - Although I use the same (undocumented, undeadly.org) trick of
>   "low=1:high=2" for indicators everywhere, this can result in
>   "On is below On", and "Off is below On"
> - Although I use "low=1:high=2", I get "On" for %3 (low limit) as well
>   as for %4 (high limit)
> - Reading sensorsd.conf(5):
>   "If the limits are crossed or if the status provided by the driver
>   changes, sensorsd(8)'s alert functionality is triggered and a command,
>   if specified, is executed"
>   If limits are crossed, yes; if status changes, no, unless you use the
>   "low=1:high=2" trick.
> - Reading sensorsd.conf(5):
>   "Values for all other types of sensors can be specified in the same
>   units as they appear under the sysctl(8) hw.sensors tree."
>   No: "low=Off:high=On" results in (sensorsd -c 1 -d):
>   "sensorsd: incorrect value: Off: file or directory not found"
>

Now that I have a reporting upd(4) device, I've had a chance to poke
at this.  There is currently no code in upd(4) that sets WARN or
CRITICAL.

Yes, it appears that SENSOR_INDICATOR items require numeric high/low
values.  This is not documented in sensorsd.conf(5).  It is either an
oversight in documentation or parsing.

I've found that it helps to think of the high/low values in
sensorsd.conf(5) as the closed interval for "normal" operation. The
example "hw.sensors.lm0.volt3:low=4.8V:high=5.2V" will trigger when
the voltage goes below (but not at) 4.8V and above (but not at) 5.2V.

sysctl(8) will display Off if the value is zero, and On for nonzero.
So, using the "closed interval" rule above, you should use "high=0"
for indicators that you consider in "good" state when Off (i.e.
ShutdownImminent), and "low=1" for indicators that you consider in
"good" state when On (i.e. ACPresent).

# sensorsd.conf(5)
hw.sensors.upd0.indicator0:high=0:command=/etc/sensorsd_log.sh %x Charging %2 %s
hw.sensors.upd0.indicator1:high=0:command=/etc/sensorsd_log.sh %x
Discharging %2 %s
hw.sensors.upd0.indicator2:low=1:command=/etc/sensorsd_log.sh %x ACPresent %2 %s
hw.sensors.upd0.indicator3:high=0:command=/etc/sensorsd_log.sh %x
ShutdownImminent %2 %s
hw.sensors.upd0.indicator4:low=1:command=/etc/sensorsd_log.sh %x
BatteryPresent %2 %s
hw.sensors.upd0.percent0:low=25:command=/etc/sensorsd_log.sh %x
RemainingCapacity %2 %s
hw.sensors.upd0.percent1:low=25:command=/etc/sensorsd_log.sh %x
FullChargeCapacity %2 %s

--david

Reply via email to