[Nut-upsdev] UPS gracefull restart
Tomáš Macek
macek at fortech.cz
Wed May 21 08:07:27 UTC 2008
Arjen de Korte wrote:
>>>> 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
I'm trying to force the software to properly shutdown the computer
when someone (admin) over the internet reboots the UPS (don't ask me
why, we simply sometimes must to do it) - for example from the UPS's
web interface or from the telnet's command line. We use many APC UPSs
like 750XL or Matrix.
It happened somehow accidentally, that the admin reboots the UPS and
forget to shutdown the server before shutdowning UPS and the computer
sometimes doesn't start properly again.
When we are using Nut driver apcsmart (monitoring over serial port),
the driver works fine = when gracefully rebooting UPS over internet,
the driver says to the computer it shlould shutdown. When we are using
snmp-ups driver (monitoring over IP address), the snmp-ups driver does
not says to the computer it should shutdown when we are gracefully
rebooting UPS and bad things will happen...
What idea do you have?
Tomas
More information about the Nut-upsdev
mailing list