Hi all,

one of the remaining "kinks in the cable" that still need working out
after me updating to OpenBSD 5.6 is the fact that I can no longer use
apcupsd to monitor the "APC Back-UPS CS 500" that is connected to the
server via USB. From what I have gathered so far, one has to use
sensorsd instead, so I've been through the man pages (sensorsd(8) and
sensorsd.conf(5)) as well as through the archives of this list. The one
relevant thread I found was this one:

http://marc.info/?t=141670239400001&r=1&w=2

Despite this, I cannot seem to get sensorsd to monitor the state of the
ups. Here's what I have so far:

The ups is detected properly as can be seen from dmesg:

[...]
uhidev0 at uhub4 port 2 configuration 1 interface 0 "American Power Conversion 
Back-UPS CS 500 FW:808.q8.I USB FW:q8" rev 1.10/0.06 addr 2
uhidev0: iclass 3/0, 98 report ids
upd0 at uhidev0
[...]

It is also seen properly by sysctl:
# sysctl | grep upd 
hw.sensors.upd0.indicator0=On (Charging), OK
hw.sensors.upd0.indicator1=Off (Discharging), OK
hw.sensors.upd0.indicator2=On (ACPresent), OK
hw.sensors.upd0.indicator3=On (BatteryPresent), OK
hw.sensors.upd0.indicator4=Off (ShutdownImminent), OK
hw.sensors.upd0.percent0=100.00% (FullChargeCapacity), OK
hw.sensors.upd0.percent1=55.00% (RemainingCapacity), OK

When removing AC power, I can see that the ups reports this as expected:

# sysctl | grep upd 
hw.sensors.upd0.indicator0=Off (Charging), OK
hw.sensors.upd0.indicator1=On (Discharging), OK
hw.sensors.upd0.indicator2=Off (ACPresent), OK
hw.sensors.upd0.indicator3=On (BatteryPresent), OK
hw.sensors.upd0.indicator4=Off (ShutdownImminent), OK
hw.sensors.upd0.percent0=100.00% (FullChargeCapacity), OK
hw.sensors.upd0.percent1=55.00% (RemainingCapacity), OK

(see changes in "Charging", "Discharging" and "ACPresent")

What I cannot seem to get to work is that sensorsd *reacts* to these
changes. Based on the examples in the thread mentioned above, I've
created a small script "/etc/sensorsd/upd.sh" that looks as follows:

# cat /etc/sensorsd/upd.sh 
echo "${@}" | logger -t UPD

I have then created the following sensorsd.conf:
hw.sensors.upd0.indicator0:high=0:command=/etc/sensorsd/upd.sh %x.%t%n Charging 
%2 %s
hw.sensors.upd0.indicator1:high=0:command=/etc/sensorsd/upd.sh %x.%t%n 
Discharging %2 %s
hw.sensors.upd0.indicator2:low=1:command=/etc/sensorsd/upd.sh %x.%t%n ACPresent 
%2 %s
hw.sensors.upd0.indicator3:low=1:command=/etc/sensorsd/upd.sh %x.%t%n 
BatteryPresent %2 %s
hw.sensors.upd0.indicator4:high=0:command=/etc/sensorsd/upd.sh %x.%t%n 
ShutdownImminent %2 %s
hw.sensors.upd0.percent0:low=25:command=/etc/sensorsd/upd.sh %x.%t%n 
FullChargeCapacity %2 %s
hw.sensors.upd0.percent1:low=25:command=/etc/sensorsd/upd.sh %x.%t%n 
RemainingCapacity %2 %s

When I start sensorsd, I get this output:
sensorsd[31995]: upd0.indicator2: exceeds limits: On is below On
sensorsd[31995]: upd0.indicator3: exceeds limits: On is below On
UPD: upd0.indicator2 ACPresent On OK 
UPD: upd0.indicator3 BatteryPresent On OK 
UPD: upd0.percent0 FullChargeCapacity 100.00% OK 
UPD: upd0.indicator4 ShutdownImminent Off OK 
UPD: upd0.indicator1 Discharging Off OK 
UPD: upd0.percent1 RemainingCapacity 61.00% OK 
UPD: upd0.indicator0 Charging On OK 

However, when I subsequently remove AC power, nothing happens - no more
messages from sensorsd are forthcoming. I've also tried running sensorsd
with '-c 1' and left the system for more than a minute after the change,
but no avail. Also, some variations on the limits (e.g. "low=1:high=2"
for indicator3) did not change anything. I get the sneaking feeling that
I might miss something obvious, but so far have no idea. Hence, if
someone out there *does* have an idea, I'd be very interested to hear
and learn.

Thanks in advance,

Thomas


-- 
-----------------------------------------------------------------------------
                 Thomas Ribbrock    http://www.ribbrock.org/ 
   "You have to live on the edge of reality - to make your dreams come true!"

Reply via email to