NUTUPSMonitor: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(Created page with '1. Install network ups tool; <pre># yum install nut nut-client</pre> 2. Change mode from none -> standalone in /etc/ups/nut.conf <pre> #MODE = none MODE = standalone </pre> 3. …')
 
No edit summary
Line 1: Line 1:
1. Install network ups tool;
1. Install network ups tool;
<pre># yum install nut nut-client</pre>
<pre># yum install nut nut-client</pre>


2. Change mode from none -> standalone in /etc/ups/nut.conf
2. Change mode from none -> standalone in /etc/ups/nut.conf
Line 7: Line 8:
MODE = standalone
MODE = standalone
</pre>
</pre>


3. Add a UPS device in /etc/ups/ups.conf;
3. Add a UPS device in /etc/ups/ups.conf;
* Use auto for port if USB
<pre>
<pre>
[drewups]
[drewups]
Line 15: Line 18:
         desc = "Office UPS"
         desc = "Office UPS"
</pre>
</pre>
** Use auto for port if USB
 


4. Create a master to use to communicate with nut in /etc/ups/upsd.users;
4. Create a master to use to communicate with nut in /etc/ups/upsd.users;
Line 21: Line 24:
       password = anawesomepassword
       password = anawesomepassword
       upsmon master</pre>
       upsmon master</pre>


5. Configure /etc/ups/upsmon.conf to monitor drewups as amasteruser, run a script when an action occurs, as well as alert;
5. Configure /etc/ups/upsmon.conf to monitor drewups as amasteruser, run a script when an action occurs, as well as alert;
Line 37: Line 41:
NOTIFYFLAG NOCOMM      SYSLOG+EXEC+WALL
NOTIFYFLAG NOCOMM      SYSLOG+EXEC+WALL
NOTIFYFLAG NOPARENT    SYSLOG+EXEC+WALL</pre>
NOTIFYFLAG NOPARENT    SYSLOG+EXEC+WALL</pre>


6. upspager.sh script;
6. upspager.sh script;

Revision as of 17:37, 28 April 2010

1. Install network ups tool;

# yum install nut nut-client


2. Change mode from none -> standalone in /etc/ups/nut.conf

#MODE = none
MODE = standalone


3. Add a UPS device in /etc/ups/ups.conf;

  • Use auto for port if USB
[drewups]
        driver=usbhid-ups
        port = auto
        desc = "Office UPS"


4. Create a master to use to communicate with nut in /etc/ups/upsd.users;

[amasteruser]
       password = anawesomepassword
       upsmon master


5. Configure /etc/ups/upsmon.conf to monitor drewups as amasteruser, run a script when an action occurs, as well as alert;

MONITOR drewups@localhost 1 amasteruser anawesomepassword master

NOTIFYCMD /home/drew/cron/upspager.sh

NOTIFYFLAG ONLINE       SYSLOG+EXEC+WALL
NOTIFYFLAG ONBATT       SYSLOG+EXEC+WALL
NOTIFYFLAG LOWBATT      SYSLOG+EXEC+WALL
NOTIFYFLAG FSD          SYSLOG+EXEC+WALL
NOTIFYFLAG COMMOK       SYSLOG+EXEC+WALL
NOTIFYFLAG COMMBAD      SYSLOG+EXEC+WALL
NOTIFYFLAG SHUTDOWN     SYSLOG+EXEC+WALL
NOTIFYFLAG REPLBATT     SYSLOG+EXEC+WALL
NOTIFYFLAG NOCOMM       SYSLOG+EXEC+WALL
NOTIFYFLAG NOPARENT     SYSLOG+EXEC+WALL


6. upspager.sh script;

#!/bin/bash
echo "$*" | mail -s "drewups alert" [email protected]

7. Start nut at boot and fire it up;

# chkconfig ups on
# /etc/init.d/ups start