[Nut-upsuser] NOTIFYCMD and SHUTDOWNCMD do not work until Nut is restarted

Julien Métairie ruliane at ruliane.net
Mon Apr 22 20:02:14 UTC 2013


Hi,

-------- Message original --------
Sujet: Re: [Nut-upsuser] NOTIFYCMD and SHUTDOWNCMD do not work until Nut 
is restarted
De : Arnaud Quette <aquette.dev at gmail.com>
Pour : Julien Métairie <ruliane at ruliane.net>
Copie à : NUT Users <nut-upsuser at lists.alioth.debian.org>
Date : 18/04/2013 21:34

>
> 2013/4/16 Julien Métairie <ruliane at ruliane.net <mailto:ruliane at ruliane.net>>
>
>     Hello,
>
>
>     -------- Message original --------
>     Sujet: Re: [Nut-upsuser] NOTIFYCMD and SHUTDOWNCMD do not work until
>     Nut is restarted
>     De : Julien Métairie <ruliane at ruliane.net <mailto:ruliane at ruliane.net>>
>     Pour : NUT Users <nut-upsuser at lists.alioth.__debian.org
>     <mailto:nut-upsuser at lists.alioth.debian.org>>
>     Date : 12/04/2013 18:28
>
>
>         Hi,
>
>         -------- Message original --------
>         Sujet: Re: [Nut-upsuser] NOTIFYCMD and SHUTDOWNCMD do not work
>         until Nut
>         is restarted
>         De : Arnaud Quette <aquette.dev at gmail.com
>         <mailto:aquette.dev at gmail.com>>
>         Pour : Julien Métairie <ruliane at ruliane.net
>         <mailto:ruliane at ruliane.net>>
>         Copie à : NUT Users <nut-upsuser at lists.alioth.__debian.org
>         <mailto:nut-upsuser at lists.alioth.debian.org>>
>         Date : 11/04/2013 22:33
>
>             bonjour Julien
>
>             2013/4/11 Julien Métairie <ruliane at ruliane.net
>             <mailto:ruliane at ruliane.net>
>             <mailto:ruliane at ruliane.net <mailto:ruliane at ruliane.net>>>
>
>                  Hi everybody,
>
>                  I installed and configured Nut 2.4.3 on Debian Squeeze,
>             using
>                  package. It monitors an MGE Pulsar 1500 UPS in
>             standalone mode.
>
>                  Here are parts of upsmon.conf :
>                  SHUTDOWNCMD "/bin/bash /root/extinction.sh >>
>             /var/log/ups/ups.log
>                  2>>&1"
>                  NOTIFYCMD "/bin/bash /usr/sbin/alerte.sh"
>                  [...]
>                  NOTIFYFLAG ONBATT       SYSLOG+EXEC
>
>                  At startup, driver, upsd and upsmon start but when I
>             pull off the
>                  line, a message is appended to syslog but no script is
>             executed, nor
>                  SHUTDOWNCMD is called. To make things better, I must
>             restart Nut :
>                  invoke-rc.d nut restart
>
>                  Trying to understand this behavior, i noticed the
>             following lines in
>                  syslog at computer startup, pasted there[1] for
>             convenience :
>
>                  usb 3-1: New USB device found, idVendor=0463,
>             idProduct=ffff
>                  usb 3-1: New USB device strings: Mfr=1, Product=2,
>             SerialNumber=4
>                  usb 3-1: Product: Pulsar
>                  usb 3-1: Manufacturer: MGE UPS SYSTEMS
>                  usb 3-1: SerialNumber: 1Y3H34201
>                  usb 3-1: configuration #1 chosen from 1 choice
>                  [...]
>
>             /build/buildd-linux-2.6_2.6.____32-48squeeze1-i386-F95osd/____linux-2.6-2.6.32/debian/build/____source_i386_none/drivers/__hid/__usbhid/hid-core.c:
>
>                  usb_submit_urb(ctrl) failed
>                  generic-usb 0003:0463:FFFF.0001: timeout initializing
>             reports
>                  generic-usb 0003:0463:FFFF.0001: hiddev0,hidraw0: USB
>             HID v1.10
>                  Device [MGE UPS SYSTEMS Pulsar] on
>             usb-0000:00:0a.1-1/input0
>                  usbcore: registered new interface driver usbhid
>                  usbhid: v2.6:USB HID core driver
>
>                  May the failure be linked to my issue ? What can I do
>             to make Nut
>                  work as soon as my computer boots up ?
>
>
>             maybe.
>             can you reproduce this easily?
>             if so, what the result of "upsc <devname>":
>             1) just after the boot?
>             2) then, when you've pulled the line?
>
>             Arnaud
>             cheers,
>             --
>             NUT (Network UPS Tools) Project Leader -
>             http://www.networkupstools.org
>             Debian Developer - http://www.debian.org
>             Free Software Developer - http://arnaud.quette.fr
>
>
>         I can reproduce it ; here [1] is the output :
>         At startup :
>
>         ruliane at physrv01:~$ upsc onduleur
>         battery.capacity: 9.00
>         battery.charge: 100
>         battery.charge.low: 50
>         battery.charge.restart: 0
>         battery.energysave: yes
>         battery.protection: yes
>         battery.runtime: 1962
>         battery.type: PbAc
>         device.mfr: MGE UPS SYSTEMS
>         device.model: Pulsar 1500
>         device.serial: 1Y3H34201
>         device.type: ups
>         driver.name <http://driver.name>: usbhid-ups
>         driver.parameter.pollfreq: 30
>         driver.parameter.pollinterval: 2
>         driver.parameter.port: /dev/usb/hiddev0
>         driver.version: 2.4.3
>         driver.version.data: MGE HID 1.18
>         driver.version.internal: 0.34
>         input.bypass.current: 0.00
>         input.bypass.voltage: 232.0
>         input.frequency: 49.0
>         input.frequency.nominal: 50
>         input.voltage: 232.0
>         input.voltage.nominal: 230
>         outlet.1.autoswitch.charge.__low: 0
>         outlet.1.delay.shutdown: 2592000
>         outlet.1.delay.start: 3
>         outlet.1.desc: PowerShare Outlet 1
>         outlet.1.id <http://outlet.1.id>: 1
>         outlet.1.status: on
>         outlet.1.switchable: yes
>         outlet.2.autoswitch.charge.__low: 0
>         outlet.2.delay.shutdown: 2592000
>         outlet.2.delay.start: 6
>         outlet.2.desc: PowerShare Outlet 2
>         outlet.2.id <http://outlet.2.id>: 2
>         outlet.2.status: on
>         outlet.2.switchable: yes
>         outlet.desc: Main Outlet
>         outlet.id <http://outlet.id>: 0
>         outlet.switchable: yes
>         output.current: 1.30
>         output.frequency: 49.0
>         output.frequency.nominal: 50
>         output.powerfactor: 0.76
>         output.voltage: 41216.0
>         output.voltage.nominal: 230
>         ups.beeper.status: enabled
>         ups.delay.shutdown: 20
>         ups.delay.start: 30
>         ups.firmware: 01
>         ups.load: 19
>         ups.load.high: 102
>         ups.mfr: MGE UPS SYSTEMS
>         ups.model: Pulsar 1500
>         ups.power: 294
>         ups.power.nominal: 1500
>         ups.productid: ffff
>         ups.realpower: 223
>         ups.realpower.nominal: 1350
>         ups.serial: 1Y3H34201
>         ups.start.auto: yes
>         ups.start.battery: no
>         ups.start.reboot: yes
>         ups.status: OL CHRG
>         ups.test.interval: 604800
>         ups.test.result: Done and passed
>         ups.timer.shutdown: -1
>         ups.timer.start: -1
>         ups.type: online
>         ups.vendorid: 0463
>
>         [Unplugged]
>
>         ruliane at physrv01:~$ upsc onduleur
>         battery.capacity: 9.00
>         battery.charge: 99
>         battery.charge.low: 50
>         battery.charge.restart: 0
>         battery.energysave: yes
>         battery.protection: yes
>         battery.runtime: 2033
>         battery.type: PbAc
>         device.mfr: MGE UPS SYSTEMS
>         device.model: Pulsar 1500
>         device.serial: 1Y3H34201
>         device.type: ups
>         driver.name <http://driver.name>: usbhid-ups
>         driver.parameter.pollfreq: 30
>         driver.parameter.pollinterval: 2
>         driver.parameter.port: /dev/usb/hiddev0
>         driver.version: 2.4.3
>         driver.version.data: MGE HID 1.18
>         driver.version.internal: 0.34
>         input.bypass.current: 0.00
>         input.bypass.voltage: 234.0
>         input.frequency: 49.0
>         input.frequency.nominal: 50
>         input.transfer.reason: input voltage out of range
>         input.voltage: 234.0
>         input.voltage.nominal: 230
>         outlet.1.autoswitch.charge.__low: 0
>         outlet.1.delay.shutdown: 2592000
>         outlet.1.delay.start: 3
>         outlet.1.desc: PowerShare Outlet 1
>         outlet.1.id <http://outlet.1.id>: 1
>         outlet.1.status: on
>         outlet.1.switchable: yes
>         outlet.2.autoswitch.charge.__low: 0
>         outlet.2.delay.shutdown: 2592000
>         outlet.2.delay.start: 6
>         outlet.2.desc: PowerShare Outlet 2
>         outlet.2.id <http://outlet.2.id>: 2
>         outlet.2.status: on
>         outlet.2.switchable: yes
>         outlet.desc: Main Outlet
>         outlet.id <http://outlet.id>: 0
>         outlet.switchable: yes
>         output.current: 1.20
>         output.frequency: 49.0
>         output.frequency.nominal: 50
>         output.powerfactor: 0.74
>         output.voltage: 41216.0
>         output.voltage.nominal: 230
>         ups.beeper.status: enabled
>         ups.delay.shutdown: 20
>         ups.delay.start: 30
>         ups.firmware: 01
>         ups.load: 18
>         ups.load.high: 102
>         ups.mfr: MGE UPS SYSTEMS
>         ups.model: Pulsar 1500
>         ups.power: 285
>         ups.power.nominal: 1500
>         ups.productid: ffff
>         ups.realpower: 212
>         ups.realpower.nominal: 1350
>         ups.serial: 1Y3H34201
>         ups.start.auto: yes
>         ups.start.battery: no
>         ups.start.reboot: yes
>         ups.status: OB DISCHRG
>         ups.test.interval: 604800
>         ups.test.result: Done and passed
>         ups.timer.shutdown: -1
>         ups.timer.start: -1
>         ups.type: online
>         ups.vendorid: 0463
>
>         Do you see something bad ?
>
>
> nothing wrong here.
> what gives an "ps -efl | grep ups"?
> and a "ls -la /var/run/nut/"
> more specifically, I'd like to know if the 2 upsmon processes are here.
>
>         Regarding the non-execution of SHUTDOWNCMD, I think I should
>         recalibrate
>         the battery. But the non-execution of NOTIFYCMD persists...
>
>         Thanks,
>         Julien
>
>         [1]
>         http://paste.leslamas.net/?__2391a19dac79d316#__LIDvrGEJOGDnh1wgeKzBeL7tTawfP+__zC7XLpbXn8gO8=
>         <http://paste.leslamas.net/?2391a19dac79d316#LIDvrGEJOGDnh1wgeKzBeL7tTawfP+zC7XLpbXn8gO8=>
>
>
>     Can someone explain me what the following lines mean ? I don't
>     really know if they are linked to my problem.
>
>
>     /build/buildd-linux-2.6_2.6.____32-48squeeze1-i386-F95osd/____linux-2.6-2.6.32/debian/build/____source_i386_none/drivers/__hid/__usbhid/hid-core.c:
>     usb_submit_urb(ctrl) failed
>     generic-usb 0003:0463:FFFF.0001: timeout initializing reports
>     generic-usb 0003:0463:FFFF.0001: hiddev0,hidraw0: USB HID v1.10
>
>
> nut driver use libusb, and the usbfs kernel module, to do almost the
> same as the above hiddev driver.
> but hiddev fails to init communication with the device, above. no harm
> for nut.
>
>     I don't see any strange thing in upsc.
>
>
> btw, do you scripts behave correctly otherwise, when run as root?
>
> cheers,
> Arnaud
> --
> NUT (Network UPS Tools) Project Leader - http://www.networkupstools.org
> Debian Developer - http://www.debian.org
> Free Software Developer - http://arnaud.quette.fr
>

Just after a reboot :

root at physrv01:~# ps -efl | grep ups
1 S nut       1042     1  0  80   0 -   530 -      21:41 ? 
00:00:00 /lib/nut/usbhid-ups -a onduleur
1 S nut       1044     1  0  80   0 -   489 -      21:41 ? 
00:00:00 /sbin/upsd
1 S root      1046     1  0  80   0 -   483 -      21:41 ? 
00:00:00 /sbin/upsmon
5 S nut       1048  1046  0  80   0 -   483 -      21:41 ? 
00:00:00 /sbin/upsmon
0 S root      1523  1505  0  80   0 -   830 -      21:43 pts/0 
00:00:00 grep ups

root at physrv01:~# ls -la /var/run/nut/
total 20
drwxrwx--- 2 root nut  4096 22 avril 21:41 .
drwxr-xr-x 8 root root 4096 22 avril 21:41 ..
-rw-r--r-- 1 nut  nut     5 22 avril 21:41 upsd.pid
-rw-r--r-- 1 root root    5 22 avril 21:41 upsmon.pid
srw-rw---- 1 nut  nut     0 22 avril 21:41 usbhid-ups-onduleur
-rw-r--r-- 1 nut  nut     5 22 avril 21:41 usbhid-ups-onduleur.pid

The two upsmon processes are there, running as "root" and "nut".
/var/run/nut/upsmon.pid contains pid of the one running as user nut (1048).

But no news by email from my UPS when I unplug the power line. NOTIFYCMD 
works when run manually (as root or nut) :

root at physrv01:~# echo test | /bin/bash /usr/sbin/alerte.sh
[...]
Apr 22 21:53:58 physrv01 sendemail[1579]: Message input complete.
Apr 22 21:53:59 physrv01 sendemail[1579]: Email was sent successfully!
root at physrv01:~#

Is there any way to check that $NOTIFYCMD is correctly defined in the 
running upsmon configuration ?

Thanks,
Julien



More information about the Nut-upsuser mailing list