@olivierlambert
I wrote down the to-dos. You can use it for the official docs if you like! When you have questions, just answer on this Post.
Network UPS Tools
Installation on XCP-ng Host
At first: Connect your UPS.
Then run this commands to install NUT:
yum update
yum –enablerepo=* install epel-release
yum install nut
yum install nut-client
cd /etc/ups
wget https://github.com/serrc-techops/NUT-Configuration/blob/master/slave/xen/xen-shutdown.sh
chmod +x xen-shutdown.sh
Important Commands
-
upsc apcups (check UPS connection)
-
systemctl restart nut-server
(NUT-server reboot) | (Use this to apply configuration changes and to connect the UPS after System startup) -
systemctl restart nut-monitor (NUT-monitor restart)
-
nut-scacnner -U (shows connected devices)
Configure the files stored in /etc/ups like this:
upsmon.conf
RUN_AS_USER root
MONITOR apcups@localhost 1 admin [PASSWORD] master
SHUTDOWNCMD „/etc/ups/xen-shutdown.sh“
nut.conf
MODE=netserver
ups.conf
pollinterval = 1
maxretry = 3
[apcups]
driver = usbhid-ups
#->when you use USB devices
port = auto
desc = „[NAME]“
vendorid = [VENDORID]
productid = [PRODUCTID]
serial = „[SERIALNO]“
upsd.conf
LISTEN 0.0.0.0 3493
upsd.users
[admin]
password = [PASSWORD]
actions = set
actions= fsd
instcmds = ALL
Finish config Changes
systemctl restart nut-server
systemctl restart nut-monitor
Finished
Good to know: You can now also connect to your NUT server via the pfSense plugin by using the credentials in uspd.users to have a gui for your UPS. To do this you have to open up Port 3493 on your host.
Run this command to open the Port:
iptables -I INPUT -p tcp -m tcp --dport 3493 -j ACCEPT
Then save your changes to a config file and adjust Year, Month and Day in the config name. In my case it's the 22th of december in 2022:
iptables-save > /etc/sysconfig/iptables
mkdir /etc/iptables/
iptables-save > /etc/iptables/rules_2022-12-22_INPUT_ACCEPT_3493_NUT.v4 --> Optional, extra saving for Backups.
I recommend using this convention of naming your rule files. Its a lot easier to track your changes and to restore files.