Hi Antoine,<br><br><div class="gmail_quote">2011/4/7 GATINEAU, ANTOINE (ANTOINE) <span dir="ltr">&lt;<a href="mailto:antoine.gatineau@alcatel-lucent.com">antoine.gatineau@alcatel-lucent.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<br>
<br>
I&#39;m trying to integrate upsmon with my alarm management application.<br>
For that I wan&#39;t to use NOTIFYCMD from upsmon. I am having troubles making everything work together.<br>
<br>
I&#39;m using nut version 2.4.3<br>
<br>
I created a nutmon user and my script defined in NOTIFYCMD works perfectly when executed in a nutmon shell.<br>
I have configured RUN_AS_USER nutmon<br>
<br>
Here is upsmon.conf :<br>
MONITOR ups_on_usb@localhost 1 nut nut master<br>
RUN_AS_USER nutmon<br>
SHUTDOWNCMD &quot;/sbin/shutdown -h +0&quot;<br>
MINSUPPLIES 1<br>
POLLFREQ 30<br>
POLLFREQALERT 30<br>
HOSTSYNC 15<br>
DEADTIME 60<br>
POWERDOWNFLAG /etc/killpower<br>
RBWARNTIME 43200<br>
NOCOMMWARNTIME 300<br>
FINALDELAY 5<br>
NOTIFYCMD &quot;upsAlarmManager&quot;<br>
NOTIFYMSG ONLINE &quot;UPS %s state is on line&quot;<br>
NOTIFYMSG ONBATT &quot;UPS %s state is on battery&quot;<br>
NOTIFYMSG LOWBATT &quot;UPS %s battery level is low&quot;<br>
NOTIFYMSG SHUTDOWN &quot;UPS %s triggered a server shutdown&quot;<br>
NOTIFYMSG REPLBATT &quot;UPS %s battery needs to be replaced&quot;<br>
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC<br>
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC<br>
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC<br>
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC<br>
NOTIFYFLAG REPLBATT SYSLOG+EXEC<br>
<br>
upsAlarmManager&#39;s path is defined i environment variable $PATH and i have the same behavior using the complete path.<br></blockquote><div><br>as a general best practice, prefer to use absolute path.<br>this way, you avoid path related issues due to the launch context (see below)<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
In order to check if it is called, the script writes in /tmp/alarm.txt<br>
<br>
Here are my results :<br>
Upsmon runing as daemon by &quot;service ups start&quot; =&gt; /tmp/alarm.txt empty, alarms are not sent<br>
Upsmon runing using command line as root &quot;/usr/sbin/upsmon&quot; =&gt; /tmp/alarm.txt empty, alarms are not sent<br>
Upsmon runing in debug using command line as root &quot;/usr/sbin/upsmon -D&quot; =&gt; /tmp/alarm.txt is written, alarms are sent to my alarm management framework.<br></blockquote><div><br>are you cleaning the testbed before each tests (ie &quot;rm -f /tmp/alarm.txt&quot;), just to be sure?<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I want it to work as daemon. Did i miss something, what is the difference between debug and the other modes?<br></blockquote></div><br>the user context you launched the command from... but more probably here, the way you retrieve data from upsAlarmManager to write it to the file and send it.<br>
<br>To be able to confirm, or at least troubleshoot this issue, I&#39;d need, if possible, to have a look at your script.<br>If that pose a problem to do it publicly, don&#39;t hesitate to send it to my @<a href="http://eaton.com">eaton.com</a> address.<br>
<br>cheers,<br>Arnaud<br>-- <br>Linux / Unix Expert R&amp;D - Eaton - <a href="http://powerquality.eaton.com" target="_blank">http://powerquality.eaton.com</a><br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org/" target="_blank">http://www.networkupstools.org/</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.free.fr/" target="_blank">http://arnaud.quette.free.fr/</a><br><br>