Setting the NUT (Network UPS Tools) in FreeBSD. Auto power off the server during the discharge UPS

Network UPS Tools – a set of programs that provide an interface for monitoring and management of uninterruptible power supply. NUT may, in case of battery discharge UPS correctly off the server, allows you to monitor the current status of the UPS.

Installing Nut:
# Cd / usr / ports / sysutils / nut
# Make config

Note the options (interface to connect to the server ups).
# Make install clean

After installation you need to find our ups in the list of supported hardware – /usr/local/etc/nut/driver.list
There are ups Ippon Smart Power Pro 1000 and it is connected via com-port.

Nut configs are here – / usr / local / etc / nut /

ups.conf – basic settings NUT (name, port, driver).
upsd.conf – setting demon upsd.
upsd.users – user profiles.
upsmon.conf – setting agent.

ups.conf – connection settings UPS.
# Name
# Driver of /usr/local/etc/nut/driver.list
driver = blazer_ser
# Port connected to the UPS
port = / dev / ttyu0
# Description UPS
desc = “Ippon smart power pro 1000”

# Optional
default.battery.voltage.high = 26
default.battery.voltage.low = 20.80
ondelay = 7
offdelay = 6

LISTEN 3493 # ip address and port for listening connections
MAXAGE 15 # Refresh interval
MAXCONN connections 1024

password = pass
actions = SET
instcmds = ALL
upsmon master

upsmon.conf – basic settings nut
MONITOR ippon1000 @ localhost 1 admin pass master
SHUTDOWNCMD “/ sbin / shutdown -p now”

POLLFREQ # 5 sampling frequency UPS
POWERDOWNFLAG / etc / killpower

RBWARNTIME 43200 # warning battery replacement
FINALDELAY # 5 how many minutes to turn off the UPS after shutting down the server

We start nut:
# /usr/local/etc/rc.d/nut Start

Check the status of the UPS:
# Upsc ippon1000 @ localhost

# Prescribed in /etc/rc.conf lines for startup:
nut_enable = “YES”
nut_upslog_enable = “YES”
nut_upsmon_enable = “YES”
nut_upslog_ups = “ippon1000 @ localhost”

Test our system. Initiate power decrease in the UPS:
# Upsmon -c fsd

If the server is turned off – everything is fine.

1. I note that with the help of nut you can not set the time after which the server will turn off after the fall of electricity. That is bespereboynik first discharged and then give the command to shut down.
2. Rights of access to the port that is connected to the UPS must be for the user uucp and group wheel. Change the owner of the port / device you can:
# Chown uucp: wheel / dev / ttyu0

After rebooting, these rights will fly and it will not work. Therefore, add the following lines to /usr/local/etc/rc.d/nut after the #! / Bin / sh:
chown uucp: wheel / dev / ttyu0