NUT

From Michael's Information Zone
Revision as of 17:10, 15 February 2017 by Michael.mast (talk | contribs) (Created page with "WORK IN PROGRESS ==Configure NUT== First edit the /etc/ups/ups.conf file by appending the battery info. You can find this information by running nut-scanner<br> Example: <pre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WORK IN PROGRESS

Configure NUT

First edit the /etc/ups/ups.conf file by appending the battery info. You can find this information by running nut-scanner
Example:

[root@dronetest ~]# nut-scanner -U
Cannot load XML library (libneon.so.27) : file not found. XML search disabled.
Scanning USB bus.
[nutdev1]
	driver = "usbhid-ups"
	port = "auto"
	vendorid = "0764"
	productid = "0601"
	product = "OR1500PFCLCD"
	serial = "GXIFS2000130"
	vendor = "CPS"
	bus = "001"


Start NUT service Layers

Have the following shell script in place

#!/bin/bash
sudo usbhid-ups -uroot -a nutdev1
sudo upsd -uroot

Then create the systemd unit file /etc/systemd/system/nutstart.service with the following

[Unit]
Description=Start NUT services
After=network.target

[Service]
Type=Simple
ExecStart=/root/nutstart.sh

[Install]
WantedBy=default.target

Then enable the service

Monitoring Script

[root@dronetest ~]# cat batterycheck.sh

upsstatus=$(upsc cyberpower@localhost ups.status)
upsload=$(upsc cyberpower@localhost ups.load)
if [ "$upsstatus" = "OL" ]; then
echo "Battery Online" > /dev/null
elif [ "$upsstatus" == "OB DISCHRG" ]; then
echo -e "Subject:UPS has lost AC Power" | /usr/sbin/sendmail your@email.com
elif [ "$upsstatus" = "OL CHRG" ]; then
echo "Charging" > /dev/null
else echo "Status Unknown"
fi
#if [ "$upsload" -ge "60" ]
#then echo -e "Subject:UPS Load=$upsload" 
#fi