[Nut-upsuser] Unable run command on notify events

GATINEAU, ANTOINE (ANTOINE) antoine.gatineau at alcatel-lucent.com
Thu Apr 7 15:34:20 UTC 2011


Hello,

I'm trying to integrate upsmon with my alarm management application.
For that I wan't to use NOTIFYCMD from upsmon. I am having troubles making everything work together.

I'm using nut version 2.4.3

I created a nutmon user and my script defined in NOTIFYCMD works perfectly when executed in a nutmon shell.
I have configured RUN_AS_USER nutmon

Here is upsmon.conf :
MONITOR ups_on_usb at localhost 1 nut nut master
RUN_AS_USER nutmon
SHUTDOWNCMD "/sbin/shutdown -h +0"
MINSUPPLIES 1
POLLFREQ 30
POLLFREQALERT 30
HOSTSYNC 15
DEADTIME 60
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
NOTIFYCMD "upsAlarmManager"
NOTIFYMSG ONLINE "UPS %s state is on line"
NOTIFYMSG ONBATT "UPS %s state is on battery"
NOTIFYMSG LOWBATT "UPS %s battery level is low"
NOTIFYMSG SHUTDOWN "UPS %s triggered a server shutdown"
NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+EXEC

upsAlarmManager's path is defined i environment variable $PATH and i have the same behavior using the complete path.
In order to check if it is called, the script writes in /tmp/alarm.txt

Here are my results :
Upsmon runing as daemon by "service ups start" => /tmp/alarm.txt empty, alarms are not sent
Upsmon runing using command line as root "/usr/sbin/upsmon" => /tmp/alarm.txt empty, alarms are not sent
Upsmon runing in debug using command line as root "/usr/sbin/upsmon -D" => /tmp/alarm.txt is written, alarms are sent to my alarm management framework.

I want it to work as daemon. Did i miss something, what is the difference between debug and the other modes?

Thanks,
Antoine Gatineau



More information about the Nut-upsuser mailing list