[Nut-upsdev] UPS gracefull restart

Tomáš Macek macek at fortech.cz
Tue May 20 13:14:00 UTC 2008


Hi,
I'm just looking at the code of snmp-ups driver in the source tree. 
I'm trying to find out, what can I change in the code to force the 
snmp-ups driver to send shutdown command to the upsd to shutdown the 
computer when I set up on the UPS via telnet that it should restart 
gracefully.
The communication otherwise works perfectly but the gracefull restarts 
and turn off. Using apcsmart driver everything goes well. I'm unable 
to find the bug in the code - if there is one certainly... ;-)

Can you point me out what to do to make the PC to shutdown when I set 
up that the UPS should gracefully restart? (for example).

I found this:
#define APCC_OID_POWER_STATUS   ".1.3.6.1.4.1.318.1.1.1.4.1.1.0" 
 

/* Defines for APCC_OID_POWER_STATUS */ 
 

info_lkp_t apcc_pwr_info[] = { 
 

     { 1, "" },          /* unknown  */ 
 

     { 2, "OL" },        /* onLine */ 
 

     { 3, "OB" },        /* onBattery */ 
 

     { 4, "BOOST" },     /* onSmartBoost */ 
 

     { 5, "OFF" },       /* timedSleeping */ 
 

     { 6, "OFF" },       /* softwareBypass  */ 
 

     { 7, "OFF" },       /* off */ 
 

     { 8, "" },          /* rebooting */ 
 

     { 9, "BYPASS" },    /* switchedBypass */ 
 

     { 10, "BYPASS" },   /* hardwareFailureBypass */ 
 

     { 11, "OFF" },      /* sleepingUntilPowerReturn */ 
 

     { 12, "TRIM" },     /* onSmartTrim */ 
 

     { 0, "NULL" } 
 

} ;

and the {8, ""} state is properly read by the snmp-ups driver (i run 
snmp-ups -a apc -DD on the command line and I can see it's fine read 
as state => 8).

But I can't find where is the code where upsd receives the state 8 and 
decides what to do with the received state code.
I tried to find this out from the serial driver, but it's too 
different to point me out.

Best regards, Tomas





More information about the Nut-upsdev mailing list