Ralfs

NUT config

Network UPS Tools Home
Labs helps: How to use UPS with nut Kopija: copy there
Tested on Fedora Core 2 / Fedora 10
Install:
yum -y install nut nut-client nut-cgi
Tas pats izveido useri nut(57) un grupu nut(57)
Configs in /etc/ups/

/etc/sysconfig/ups
noraadiit modeli
MODEL=apcsmart
Fix permissions (Fedora Core 2):
cd /etc/ups
chown root:nut ups*
chmod 640 ups*
Configure /etc/ups/ups.conf
[myups]
        driver = apcsmart
        port = /dev/ttyS0
Configure /etc/ups/upsd.users
[monuser]
	password  = mypass
	allowfrom = localhost 192.168.123.99
	upsmon master

[admin]
        password = admpass
        allowfrom = localhost 192.168.123.99
        actions = SET
        instcmds = ALL
Configure /etc/ups/upsmon.conf
MONITOR myups@localhost 1 monuser mypass master

# reboot, not halt and after 1 minute
SHUTDOWNCMD "/sbin/shutdown -r +1"

# If you wish:
NOTIFYCMD /usr/local/bin/upsnotify

# Notify messages:
NOTIFYMSG ONBATT "I'm on battery only :( %s"
NOTIFYMSG LOWBATT "My battery is too low :( %s"
NOTIFYMSG SHUTDOWN "Going down... %s"

# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur
NOTIFYFLAG ONLINE SYSLOG
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
### NOTIFYFLAG LOWBATT IGNORE
For access from other box:
# /etc/ups/upsd.conf
ACL trustedip 10.10.0.0/16
ACCEPT trustedip
For CGI - web access
On UPS box:
Files /etc/ups/hosts.conf and /etc/ups/upsset.conf
/etc/ups/upsset.conf
# uncomment:
I_HAVE_SECURED_MY_CGI_DIRECTORY
/etc/ups/hosts.conf
MONITOR myups@upshost 1 monuser mypass master
On http box configure apache:
/etc/httpd/conf.d/nut.conf
ScriptAlias /nut    /var/www/nut-cgi-bin
<Location /nut>
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
        Allow from 192.168.123.21

        AuthType Basic
        AuthName "Password Required"
        Require valid-user
        AuthUserFile /etc/httpd/passwd
        Satisfy Any
</Location>
Usage
$ service ups start
# or
$ /etc/init.d/ups start
$ grep ups /var/log/messages
$ ps ax|grep ups
komandas:
dig UPS status with upsc
$ upsc myups@localhost
$ upscmd -l myups@localhost

UPS LOG

Nav automātiski, tad Vismaz šādi:
upslog -u nut -s myups@localhost -l /var/log/ups.log

Back to Home: Ralfs Home Page
Last modified: 07.08.2009
© 2004-2009 Ralfs