NUT
- Compile NUT from source
groupadd nut;adduser -g nut ups
yum install gd-devel libusb-devel
./configure --with-user=ups --with-group=nut --with-usb --with-cgi --prefix=/ups --localstatedir=/ups/var --with-pidpath=/ups/var/state/ups --with-statepath=/ups/var/state/ups --enable-static
make
make install
cd /ups;mkdir -p /ups/var/state/ups;chmod 0770 /ups/var/state/ups;chown root:nut /ups/var/state/ups
copy libz.so to /ups/lib
copy libz.a to /ups/lib
chmod 0660 /dev/ttyS0;chown root:nut /dev/ttyS0
cat >/etc/udev/rules.d/99-my.rules <<EOL
SUBSYSTEM=="tty", KERNEL=="ttyS0", OWNER="root", GROUP="nut"
EOL
For APC UPS BR550I or BR550GI use the ff.
vi /etc/udev/rules.d/52-nut-usbups.rules
# This file is generated and installed by the Network UPS Tools package.
ACTION!="add", GOTO="nut-usbups_rules_end"
SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
BUS!="usb", GOTO="nut-usbups_rules_end"
LABEL="nut-usbups_rules_real"
# APC
# various models - usbhid-ups
ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="nut"
LABEL="nut-usbups_rules_end"
Prepare upsd.conf upsmon.conf ups.conf upssched.conf upsd.users
chown root:nut *.conf upsd.users
chmod 0640 *.conf upsd.users
add the following to /etc/init.d/halt
LD_LIBRARY_PATH=/ups/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if(test -f /etc/killpower)
then
echo "***************SHUTTING DOWN UPS*************"
sleep 1
echo "5"
sleep 1
echo "4"
sleep 1
echo "3"
sleep 1
echo "2"
sleep 1
echo "1"
sleep 1
echo "bye!"
sleep 1
/ups/bin/upsdrvctl -u root shutdown
echo "UPS should be off by now"
sleep 20
fi
Add upsd upsmon startup scripts to /etc/rc.local
cat >/ups/etc/alerthandler <<EOL
#! /bin/sh
case $1 in
onbattwarn)
echo "The UPS has been on battery for awhile"
/ups/sbin/upsmon -c fsd
;;
ups-back-on-power)
/bin/rm -f /ups/var/state/ups-on-battery
;;
*)
logger -t alerthandler "Unrecognized command: $1"
;;
esac
EOL
chmod 0760 /ups/etc/alerthandler;chown root:nut /ups/etc/alerthandler
TEST
$ fuser /dev/ttyS0 # should produce no output
$ upsdrvctl start
# Output:
Network UPS Tools - UPS driver controller 2.4.3
Network UPS Tools - Megatec protocol driver 1.6 (2.4.3)
Megatec protocol UPS detected.
$ upsd
# Output:
Network UPS Tools upsd 2.4.3
listening on 127.0.0.1 port 3493
listening on 192.168.1.145 port 3493
Connected to UPS [myups]: megatec-myups
$ upsc myups@localhost
# Output:
battery.charge: 100.0
...
ups.type: standby
No comment
Say something
Thank you
Your post has been submitted and will be published once it has been approved.
OK
OOPS!
Your post has not been submitted. Please return to the page and try again. Thank You!
If this error persists, please open an issue by clicking here.
OK