UPSMON(8) | NUT Manual | UPSMON(8) |
NAME¶
upsmon - UPS monitor and shutdown controllerSYNOPSIS¶
upsmon -hDESCRIPTION¶
upsmon is the client process that is responsible for the most important part of UPS monitoring—shutting down the system when the power goes out. It can call out to other helper programs for notification purposes during power events.OPTIONS¶
-hDisplay the help message.
-c command
Send the command command to the
existing upsmon process. Valid commands are:
fsd
-D
shutdown all master UPSes (use with
caution)
stop
stop monitoring and exit
reload
reread upsmon.conf(5) configuration
file. See "reloading nuances" below if this doesn’t
work.
Raise the debugging level. upsmon will run in
the foreground and prints information on stdout about the monitoring process.
Use this multiple times for more details.
-K
Test for the shutdown flag. If it exists and
contains the magic string from upsmon, then upsmon will exit with
EXIT_SUCCESS. Any other condition will make upsmon exit with EXIT_FAILURE.
You can test for a successful exit from upsmon -K in your shutdown scripts to
know when to call upsdrvctl(8) to shut down the UPS.
-p
Run privileged all the time. Normally upsmon
will split into two processes. The majority of the code runs as an
unprivileged user, and only a tiny stub runs as root. This switch will disable
that mode, and run the old "all root all the time" system.
This is not the recommended mode, and you should not use this unless you have a
very good reason.
-u user
Set the user for the unprivileged monitoring
process. This has no effect when using -p.
The default user is set at configure time with configure --with-user=....
Typically this is nobody, but other distributions will probably have a
specific nut user for this task. If your notification scripts need to
run as a specific user, set it here.
You can also set this in the upsmon.conf(5) file with the RUN_AS_USER
directive.
UPS DEFINITIONS¶
In the upsmon.conf(5), you must specify at least one UPS that will be monitored. Use the MONITOR directive.MONITOR 'system' 'powervalue' 'username' 'password' 'type'
•"su700@mybox" means a UPS
called "su700" on a system called "mybox". This is the
normal form.
•"fenton@bigbox:5678" is a UPS
called "fenton" on a system called "bigbox" which runs
upsd(8) on port "5678".
NOTIFY EVENTS¶
upsmon senses several events as it monitors each UPS. They are called notify events as they can be used to tell the users and admins about the change in status. See the additional NOTIFY-related sections below for information on customizing the delivery of these messages. ONLINEThe UPS is back on line.
ONBATT
The UPS is on battery.
LOWBATT
The UPS battery is low (as determined by the
driver).
FSD
The UPS has been commanded into the
"forced shutdown" mode.
COMMOK
Communication with the UPS has been
established.
COMMBAD
Communication with the UPS was just
lost.
SHUTDOWN
The local system is being shut down.
REPLBATT
The UPS needs to have its battery
replaced.
NOCOMM
The UPS can’t be contacted for
monitoring.
NOTIFY COMMAND¶
In upsmon.conf(5), you can configure a program called the NOTIFYCMD that will handle events that occur.NOTIFY FLAGS¶
By default, all notify events (see above) generate a global message (wall) to all users, plus they are logged via the syslog. You can change this with the NOTIFYFLAG directive in the configuration file:•
NOTIFYFLAG ONLINE SYSLOG
•
NOTIFYFLAG ONBATT SYSLOG+WALL
•
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
Write this message to the syslog.
WALL
Send this message to all users on the system
via wall(1).
EXEC
Execute the NOTIFYCMD.
IGNORE
Don’t do anything. If you use this,
don’t use any of the other flags.
NOTIFY MESSAGES¶
upsmon comes with default messages for each of the NOTIFY events. These can be changed with the NOTIFYMSG directive.•
NOTIFYMSG ONLINE "UPS %s is getting line power"
•` NOTIFYMSG ONBATT "Someone pulled
the plug on %s"`
POWER VALUES¶
The "current overall power value" is the sum of all UPSes that are currently able to supply power to the system hosting upsmon. Any UPS that is either on line or just on battery contributes to this number. If a UPS is critical (on battery and low battery) or has been put into "forced shutdown" mode, it no longer contributes.UPS TYPES¶
upsmon and upsd(8) don’t always run on the same system. When they do, any UPSes that are directly attached to the upsmon host should be monitored in "master" mode. This makes upsmon take charge of that equipment, and it will wait for slaves to disconnect before shutting down the local system. This allows the distant systems (monitoring over the network) to shut down cleanly before upsdrvctl shutdown runs and turns them all off.TIMED SHUTDOWNS¶
For those rare situations where the shutdown process can’t be completed between the time that low battery is signalled and the UPS actually powers off the load, use the upssched(8) helper program. You can use it along with upsmon to schedule a shutdown based on the "on battery" event. upssched can then come back to upsmon to initiate the shutdown once it has run on battery too long.REDUNDANT POWER SUPPLIES¶
If you have more than one power supply for redundant power, you may also have more than one UPS feeding your computer. upsmon can handle this. Be sure to set the UPS power values appropriately and the MINSUPPLIES value high enough so that it keeps running until it really does need to shut down.MIXED OPERATIONS¶
Besides being able to monitor multiple UPSes, upsmon can also monitor them as different roles. If you have a system with multiple power supplies serviced by separate UPS batteries, it’s possible to be a master on one and a slave on the other. This usually happens when you run out of serial ports and need to do the monitoring through another system nearby.FORCED SHUTDOWNS¶
When upsmon is forced to bring down the local system, it sets the "FSD" (forced shutdown) flag on any UPSes that it is running in master mode. This is used to synchronize slaves in the event that a master UPS that is otherwise OK needs to be brought down due to some pressing event on the master.DEAD UPSES¶
In the event that upsmon can’t reach upsd(8), it declares that UPS "dead" after some interval controlled by DEADTIME in the upsmon.conf(5). If this happens while that UPS was last known to be on battery, it is assumed to have gone critical and no longer contributes to the overall power value.RELOADING NUANCES¶
upsmon usually gives up root powers for the process that does most of the work, including handling signals like SIGHUP to reload the configuration file. This means your upsmon.conf(8) file must be readable by the non-root account that upsmon switches to.SIMULATING POWER FAILURES¶
To test a synchronized shutdown without pulling the plug on your UPS(es), you need only set the forced shutdown (FSD) flag on them. You can do this by calling upsmon again to set the flag, i.e.:FILES¶
upsmon.conf(5)SEE ALSO¶
Server:¶
upsd(8)Clients:¶
upsc(8), upscmd(8), upsrw(8), upsmon(8)CGI programs:¶
upsset.cgi(8), upsstats.cgi(8), upsimage.cgi(8)Internet resources:¶
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/05/21/2012 | Network UPS Tools |