[Nut-upsdev] UPS gracefull restart

Arjen de Korte nut+devel at de-korte.org
Wed May 21 07:37:53 UTC 2008


>>> 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 'upsd' server sits between (in your case) the snmp-ups driver and
>> (usually) upsmon client. The latter will shutdown the system if it sees
>> that the UPS is both reporting On Battery (OB) and Low Battery (LB) or
>> when the Force ShutDown (FSD) flag is set. Since drivers should *never*
>> set the FSD flag directly, your only option here is to make the snmp-ups
>> driver reports both OB and LB. Any clients attached should respond to
>> this
>> by shutting down.
>>
>> Best regards, Arjen
>
> Many thanks for help.
>
> I have now apccmib.h
>
> #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, "OB LB" },          /* rebooting */
>
>
>      { 9, "BYPASS" },    /* switchedBypass */
>
>
>      { 10, "BYPASS" },   /* hardwareFailureBypass */
>
>
>      { 11, "OFF" },      /* sleepingUntilPowerReturn */
>
>
>      { 12, "TRIM" },     /* onSmartTrim */
>
>
>      { 0, "NULL" }
>
>
> } ;
>
> Is this what you were talking about? I have no other idea what else to
> do looking at the code.

Yes. But I start to get the idea that what you're trying to do, can be
done in a much simpler way. What (not how) are you trying to do?

Best regards, Arjen
-- 
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B  7A FE 7E C1 EE 88 BC 57




More information about the Nut-upsdev mailing list