[Nut-upsuser] How to Simulate UPS on battery?
Mike.
the.lists at mgm51.com
Fri Jun 28 02:17:17 UTC 2013
I've recently moved from installing NUT from source to installing NUT
from the FreeBSD package (FreeBSD 9.1).
One would think that I might have learned not to change anything, but I
made the change. And here is my tale of woe.....
My first question is: is it possible to simulate a "UPS is on battery"
state?
Some background:
UPS comm port is connected to and monitored by server S1.
Server S2 runs upmon and upssched. upsmon on S2 looks at S1. That
link seems to work fine. upsc, when run on S2, works and prints out
all manner of info gleened from the UPS that S1 is monitoring.
What I want is for S2 to shutdown after 10 seconds of the UPS running
on batteries. (the eventual goal is for S2 to shutdown after 20 minutes
of the UPS running on batteries, but I am using 10 seconds to reduce
the testing time)
Here's the upssched.conf for S2:
$ cat /usr/local/etc/nut/upssched.conf
CMDSCRIPT /usr/local/sbin/upssched-cmd.sh
PIPEFN /var/run/upssched/upssched.pipe
LOCKFN /var/run/upssched/upssched.lock
AT LOWBATT * START-TIMER lowbattwarn 1
AT ONBATT * START-TIMER onbattwarn 10
AT ONLINE * CANCEL-TIMER onbattwarn
And here is the upsmon.conf on S2:
$ cat /usr/local/etc/nut/upssched.conf
RUN_AS_USER _ups
MONITOR PW5125 at s1.EXAMPLE.COM 1 monuser tHEuNSPOKENpSWD slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -r now"
NOTIFYCMD /usr/local/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE SYSLOG+EXEC+WALL
NOTIFYFLAG ONBATT SYSLOG+EXEC+WALL
NOTIFYFLAG LOWBATT SYSLOG+EXEC+WALL
NOTIFYFLAG SHUTDOWN SYSLOG
NOTIFYFLAG REPLBATT SYSLOG
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
(yes, I know the shutdown command will reboot, that saves me a trip to
the dark reaches of my basement during this testing period....)
When I run:
upsmon -c fsd
It appears to run the SHUTDOWNCMD specified in upsmon.conf. That helps
me zero in this situation.
What I would like to do would be, run a upsmon command that ships off
an ONBATT conditition to upssched, so that I can see if my ONBATT
handling is working correctly. Ditto for ONLINE, and LOWBATT and...
and... and...
Can what I would like to do be done? Or am I forever vanquished to the
punishment of unplugging my UPS in order to test my NUT upssched
handler scripts?
My basement is a scary place, I prefer not to go down there unless
absolutely necessary. The ability to avoid the need to unplug the UPS
would be most helpful....
More information about the Nut-upsuser
mailing list