[Nut-upsdev] snmp-ups hacking

Niklas Edmundsson nikke at acc.umu.se
Wed Feb 1 22:26:48 UTC 2006


On Wed, 1 Feb 2006, Mike Patterson wrote:

> I've never seen those.  Currently (UPS on mains):
> ups.status: FLOATING
>
> Pull the plug, and it stays on FLOATING.  But I've also seen it say
> RESTING.  Never OL/OB/LB.  I guess that might have something to do with
> it, eh?  :-)  So it would appear that at least it's probably not a
> config issue.
>
> A minute or so after plugging it back in (I unplugged to see what it
> would say, just to be sure) I see CHARGING.

Seems to me that pwmib.h is broken....

----------8<-------------
/* Defines for PW_OID_BATTERY_STATUS */
info_lkp_t pw_batt_info[] = {
         { 1, "CHARGING" },
         { 2, "DISCHARGING" },
         { 3, "FLOATING" },
         { 4, "RESTING" },
         { 5, "UNKNOWN" },
         { 0, "NULL" }
} ;
----------8<-------------

If you would get DISCHARGING when on battery, it would have been easy 
to just fix the mapping so it's correct.

However, since it obviously doesn't I would:

* Get the mibs for the unit (probably those referenced at top of
   pwmib.h).
* Use snmpwalk to get the whole tree from the UPS, see what changes
   when you go between mains/battery/etc.
* Look closer at the definition on the stuff that changes, either by
   looking in the MIB files directly or by using snmptranslate
   (recommended).
* Patch where needed.
* Rinse, repeat.

Oh, and the syntax for snmp* sucks. I figured out "good options", but 
I didn't document them before I rebooted or whatever happened.

In any case, I guess that Niels will fix all this during the weekend 
when he gets his hand on that PowerWare 9390 ;)

/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke at acc.umu.se
---------------------------------------------------------------------------
  Decaffeinated coffee?  Kinda like kissing your sister
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the Nut-upsdev mailing list