inetd.info

Everything in one place: databases, projects, photography, links & references

inetd.info RSS Feed
 
 
 
 

Initial UPS Config Under Debian

In the past a few nasty power outages have caused doom2s array to have a heart attack. I finally got round to getting a UPS (Belkin F6C120*-UNV) and ended up using NUT to talk to it over the belkin software. Good notes by Peter Selinger and a great step by step guide by Avery Fay at shadypixel got me through the inital setup as I’ve condensed in my notes below. I still need to finish the job off and protect the array a little more on shutdown.

Install NUT
$ sudo apt-get install nut

Set the config files.
/etc/nut/ups.conf
[belkin]
driver = newhidups
port = auto
desc = “Belkin UPS”

/etc/nut/upsd.conf
ACL all 0.0.0.0/0
ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all

/etc/local/upsd.users
[local_mon]
password = *******
allowfrom = localhost
actions = SET
instcmds = ALL
upsmon master

/etc/nut/upsmon.conf
MONITOR belkin@localhost 1 local_mon ******* master
POWERDOWNFLAG /etc/killpower
SHUTDOWNCMD “/sbin/shutdown -h now”
NOTIFYCMD “/usr/local/bin/ups_notify.sh”
NOTIFYFLAG ONBATT EXEC+WALL+SYSLOG
NOTIFYFLAG ONLINE EXEC+SYSLOG
NOTIFYFLAG LOWBATT EXEC+WALL+SYSLOG
NOTIFYFLAG FSD EXEC+WALL+SYSLOG
NOTIFYFLAG COMMOK EXEC+SYSLOG
NOTIFYFLAG COMMBAD EXEC+SYSLOG
NOTIFYFLAG SHUTDOWN EXEC+WALL+SYSLOG
NOTIFYFLAG REPLBATT EXEC+WALL+SYSLOG
NOTIFYFLAG NOCOMM EXEC+SYSLOG

Protect the config files
$ sudo chown root:nut /etc/nut/*
$ sudo chmod 640 /etc/nut/*

Set to autostart
# /etc/default/nut
START_UPSD=yes
START_UPSMON=yes

Start the daemon
$ sudo /etc/init.d/nut start

Check you can get stats with
$ upsc belkin@localhost

Notify command (/usr/local/bin/ups_notify.sh) just mails me anything that comes from upsmon.
#!/bin/bash
echo $* > /tmp/ups_notify.txt
mail ups@inetd.info -s Doom2:UPS\ Alert < /tmp/ups_notify.txt

Leave a Reply