Network UPS Tools User Manual
Network UPS Tools User Manual
Network UPS Tools User Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Network</strong> <strong>UPS</strong> <strong>Tools</strong> <strong>User</strong> <strong>Manual</strong> 26 / 84<br />
Power Off flag file<br />
Set the POWERDOWNFLAG location for upsmon.<br />
In upsmon.conf, add a POWERDOWNFLAG directive with a filename. upsmon will create this file when the <strong>UPS</strong> needs to be<br />
powered off during a power failure when low battery is reached.<br />
We will test for the presence of this file in a later step.<br />
POWERDOWNFLAG /etc/killpower<br />
References: man pages: upsmon(8), upsmon.conf(5)<br />
Securing upsmon.conf<br />
The recommended setting is to have it owned by root:nut, then make it readable by the group and not world. This file contains<br />
passwords that could be used by an attacker to start a shutdown, so keep it secure.<br />
chown root:nut upsmon.conf<br />
chmod 0640 upsmon.conf<br />
This step has been placed early in the process so you secure this file before adding sensitive data in the next step.<br />
Create a MONITOR directive for upsmon<br />
Edit upsmon.conf and create a MONITOR line with the <strong>UPS</strong> definition (@), username and password<br />
from the NUT user creation step, and the master or slave setting.<br />
If it’s the master (i.e., it’s connected to this <strong>UPS</strong> directly):<br />
MONITOR myupsname@mybox 1 monuser mypass master<br />
If it’s just monitoring this <strong>UPS</strong> over the network, and some other system is the master:<br />
MONITOR myupsname@mybox 1 monuser mypass slave<br />
The number "1" here is the power value. This should always be set to 1 unless you have a very special (read: expensive) system<br />
with redundant power supplies. In such cases, refer to the <strong>User</strong> <strong>Manual</strong>:<br />
• typical setups for big servers,<br />
• typical setups for data rooms.<br />
References: upsmon(8), upsmon.conf(5)<br />
Define a SHUTDOWNCMD for upsmon<br />
Still in upsmon.conf, add a directive that tells upsmon how to shut down your system. This example seems to work on most<br />
systems:<br />
SHUTDOWNCMD "/sbin/shutdown -h +0"<br />
Notice the presence of "quotes" here to keep it together.<br />
If your system has special needs, you may want to set this to a script which does local shutdown tasks before calling init.<br />
Start upsmon<br />
/usr/local/ups/sbin/upsmon<br />
If it complains about something, then check your configuration.