[Nut-upsuser] Setting ups.delay.shutdown in powerware 9135

Arnaud Quette aquette.dev at gmail.com
Mon Jan 23 09:01:10 UTC 2012


Hi Jorge,

2012/1/20 Jorge Infante <joluinfante at gmail.com>:
> Ok, Arnaud. Thanks for your response.
>
> My powerware is 9120 (I did a mistake with the model of ups).
> I'm using openfiler ESA 2.99.1 (64 bits version)
> I'did compile the nut from sources. I'm using nut 2.4.1.

if you can, you should try the latest 2.6.3. There is a few
improvements and fixes that have happen since 2.4.1 on this driver...

> My configuration files:
>
> [root at myhost etc]# more upsd.conf
> ACL all 0.0.0.0/0
> ACL localhost 127.0.0.1/32
> ACCEPT localhost
> REJECT all
>
> [root at myhost etc]# more upsd.users
> [admin]
>         password = xxxxxxxxxxx
>         actions = SET
>         instcmds = ALL
>
> [root at myhost etc]# more ups.conf
> [server]
> #driver = megatec
> #driver = liebert-hid
> #driver = liebert
> #driver = usbhid-ups
> #port = auto
> driver = bcmxcp_usb   ------------> I can't use usb with another driver

bcmxcp_usb is indeed the right driver for your unit.

> port = /dev/usb8

setting port to "auto" should be sufficient.

> shutdown_delay = 120 -----------> This parameter is ignored
>
> [root at myhost etc]# more upssched.conf
> CMDSCRIPT /scripts/upssched.sh
> PIPEFN /scripts/upssched.pipe
> LOCKFN /scripts/upssched.lock
> AT ONBATT * START-TIMER onbattwarn 180
> AT ONBATT * EXECUTE upsonbatt
> AT ONLINE * CANCEL-TIMER onbattwarn
> AT ONLINE * EXECUTE backonpower
>
> [root at myhost etc]# more upsmon.conf
> MONITOR server 1 admin xxxxxxxxxx master
> MINSUPPLIES 1
> SHUTDOWNCMD "/scripts/upsshutdown.sh"
> #NOTIFYCMD "/scripts/upsnotify.sh"
> NOTIFYCMD "/sbin/upssched"
> POLLFREQ 5
> POLLFREQALERT 5
> HOSTSYNC 15
> DEADTIME 15
> RBWARNTIME 43200
> NOCOMMWARNTIME 300
> FINALDELAY 5
> NOTIFYMSG ONLINE   "UPS is back online"
> NOTIFYMSG ONBATT   "UPS is on battery"
> NOTIFYMSG LOWBATT  "UPS has a low battery (if also on battery, it's
> 'critical')"
> NOTIFYMSG FSD      "UPS is being shutdown by the master (FSD = 'Forced
> Shutdown')"
> NOTIFYMSG COMMOK   "Communications established with the UPS"
> NOTIFYMSG COMMBAD  "Communications lost to the UPS"
> NOTIFYMSG SHUTDOWN "The system is being shutdown"
> NOTIFYMSG REPLBATT "The UPS battery is bad and needs to be replaced"
> NOTIFYMSG NOCOMM   "A UPS is unavailable (can't be contacted for
> monitoring)"
> NOTIFYMSG NOPARENT "The process that shuts down the system has died
> (shutdown impossible)"
> NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
> NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
> NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC
> NOTIFYFLAG FSD      SYSLOG+WALL+EXEC
> NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC
> NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC
> NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
> NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
> NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
> NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
>
> on upsshutdown.sh, I'm suspending my virtual machines (in another hosts),
> and, at end, I'm executing shutdown of "myhost".
>
> [root at myhost scripts]# more upssched.sh
> #!/bin/sh
> export MAILTO="myuser at www.com"
> case $1 in
>   upsonbatt)
>     echo "En 3 minutos se iniciara el apagado de equipos." | mailx -s "MUNI:
> Corte de luz" ${MAILTO}
>     ;;
>   backonpower)
>     echo "Se cancelo el apagado." | mailx -s "MUNI: Volvio la luz" ${MAILTO}
>     ;;
>   onbattwarn)
>     echo "Hace 3 minutos que no hay luz." | mailx -s "MUNI: Se inicia el
> apagado
> " ${MAILTO}
>     /sbin/upsmon -c fsd <---- This command run the script upsshutdown.sh,
> but don't stop the ups
>     ;;
> esac
>
> [root at myhost scripts]# upsc server
> ambient.temperature: 40
> ambient.temperature.high: 40
> battery.charge: 100
> battery.runtime: 2610
> battery.voltage:  54.9
> driver.name: bcmxcp_usb
> driver.parameter.pollinterval: 2
> driver.parameter.port: /dev/usb8
> driver.parameter.shutdown_delay: 120
> driver.version: 2.4.1
> driver.version.internal: 0.21
> input.frequency: 50.0
> input.frequency.high: 52
> input.frequency.low: 48
> input.frequency.nominal: 50
> input.transfer.boost.high: 176
> input.transfer.high: 276
> input.transfer.low: 160
> ambient.temperature: 40
> ambient.temperature.high: 40
> battery.charge: 100
> battery.runtime: 2610
> battery.voltage:  54.8
> driver.name: bcmxcp_usb
> driver.parameter.pollinterval: 2
> driver.parameter.port: /dev/usb8
> driver.parameter.shutdown_delay: 120
> driver.version: 2.4.1
> driver.version.internal: 0.21
> input.frequency: 50.0
> input.frequency.high: 52
> input.frequency.low: 48
> input.frequency.nominal: 50
> input.transfer.boost.high: 176
> input.transfer.high: 276
> input.transfer.low: 160
> input.transfer.trim.low: 254
> input.voltage: 228
> input.voltage.nominal: 220
> outlet.1.delay.shutdown: -1
> outlet.1.delay.start: 60
> outlet.1.id: 1
> outlet.1.status: On
> outlet.2.delay.shutdown: -1
> outlet.2.delay.start: 60
> outlet.2.id: 2
> outlet.2.status: On
> output.current:  1.6
> output.current.nominal:  6.8
> output.frequency: 50.0
> output.phases: 1
> output.voltage: 221
> output.voltage.nominal: 220
> ups.beeper.status: enabled
> ups.firmware: Cont:02.05 Inve:02.05
> ups.load:  22.9
> ups.model: PW9120 1500VA
> ups.power: 344
> ups.power.nominal: 1500
> ups.serial: RY095A0163
> ups.status: OL
>
> [root at myhost scripts]# upscmd -l server
> Instant commands supported on UPS [server]:
> outlet.1.shutdown.return - Description unavailable
> outlet.2.shutdown.return - Description unavailable
> shutdown.return - Turn off the load and return when power is back
> shutdown.stayoff - Turn off the load and remain off
> test.battery.start - Start a battery test
>
> [root at myhost scripts]# upsrw -s ups.delay.shutdown=120 -u admin -p
> xxxxxxxxxx server
> Unexpected response from upsd: ERR VAR-NOT-SUPPORTED

you can obtain the list of supported settings using:

$ upsrw server

> I'm starting the nut with:
>
>         upsdrvctl -u root -D start
>         upsd -D -u root &

FYI: running upsd in debug mode (Ie '-D') prevent it from writing its pid file.

>         pidof_upsd >/var/state/ups/upsd.pid
>         upslog -s server -u root -l /var/log/ups.log
>         pidof_upslog >/var/state/ups/upslog.pid
>         upsmon -u root -p

the need to run nut components as root could be avoided if the pid and
run directories exist and have a mode of 750 at least, and root:nut
(or the 'nut' equivalent username)

> I'm not using the nut provided for openfiler, because is not working with my
> ups.
> I did replace all programs for my version compiled from sources.
> I'm thinking the command "/sbin/upsmon -c fsd" is used for the poweroff
> (waiting to delay in the ups).
>
> Well. If you need more information, please email me.
> I'm specting about ideas.

I'm still interested in understanding where nut 'powerdown' is called.
it's generally the task of /etc/init.d/halt, which calls this final action.
and the nut script should check for 'upsmon -K' return code
(EXIT_SUCCESS or EXIT_FAILURE) to see if calling 'upsdrvctl shutdown'
is needed.

I would also be interested in the following test:
- power down your system, and remove it from the UPS (to be sure not
to crash your computer during the tests)
- replace your computer by a light bulb or equivalent,
- restart everything,
- start on the nut driver (stop nut if necessary) in debug mode. Ie:
$ /path/to/bcmxcp_usb -DDDDD -a upsname
- now call the 'shutdown.return' command,

$ upscmd -u admin -p xxxxxxxxxx server shutdown.return

- when done, stop the driver (Ctrl+C) and send me back the driver debug output.

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



> 2012/1/20 Arnaud Quette <aquette.dev at gmail.com>
>>
>> Hi Jorge,
>>
>> 2012/1/19 Jorge Infante <joluinfante at gmail.com>:
>> > Hi!
>> > I'm using nut to control a ups powerware 9135.
>> > All are working, but, in the shutdown, the ups don't poweroff.
>> > I did check with upsc, and I can't see a ups.delay.shutdown variable to
>> > set
>> > the time of automatic poweroff, when I did complete the shutdown of
>> > machines.
>> > Before, I did use a propietary program to work with this ups, and the
>> > daemon
>> > did poweroff the ups without problems.
>> > But, now, I have only a openfiler based machine, and the propietary
>> > program
>> > don't run (but, I did find nut to replace it).
>> > Can any help me?
>>
>> sure, but I'll need some more information:
>> - which Openfiler version are you using?
>> - which NUT version and driver (or port of your UPS) are you using?
>> - any configuration files, and more specifically, upsmon.conf (trimmed
>> from passwords!),
>> - upsc/upsrw/upscmd outputs.
>>
>> I would also need to see the system halt script (/etc/init.d/halt) or
>> equivalent on Openfiler, to see how the nut script gets called to
>> poweroff the UPS.
>> I've not been able to find the sources, so any pointer to it would be
>> appreciated.
>>
>> cheers,
>> Arnaud
>> --
>> Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
>> Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
>> Debian Developer - http://www.debian.org
>> Free Software Developer - http://arnaud.quette.free.fr/
>
>



More information about the Nut-upsuser mailing list