Difference between revisions of "UPS Handling with NUT"
Line 100: | Line 100: | ||
= Managing NUT = | = Managing NUT = | ||
The usual: | The usual: | ||
* <code>sudo service nut-server ['''start''' | * <code>sudo service nut-server ['''start'''{{!}}'''stop'''{{!}}'''restart'''{{!}}'''status''']</code> | ||
Client commands: | Client commands: | ||
* <code>upsc '''cyberpower'''</code> | * <code>upsc '''cyberpower'''</code> | ||
** man page | ** [https://networkupstools.org/docs/man/upsc.html man page] | ||
* <code>upscmd -l '''cyberpower'''</code> | * <code>upscmd -l '''cyberpower'''</code> | ||
** man page | ** [https://networkupstools.org/docs/man/upscmd.html man page] | ||
* <code>upsrw '''cyberpower'''</code> | * <code>upsrw '''cyberpower'''</code> | ||
** man page | ** [https://networkupstools.org/docs/man/upsrw.html man page] | ||
* <code>nut-scanner</code> | * <code>nut-scanner</code> | ||
** man page | ** [https://networkupstools.org/docs/man/upsrw.html man page] | ||
= further Usage Concepts = | = further Usage Concepts = |
Revision as of 22:06, 3 February 2022
11 (bullseye) |
|
As always... | |
---|---|
Start with: |
|
Install NUT
sudo apt install nut
Configure NUT
Select your mode
sudo vi /etc/nut/nut.conf
MODE=netserver
(In my case, I've installed NUT on a VM and it'll be managing the UPS for the whole server...)
none |
Disable automatic startup of NUT |
standalone | This MODE is for local only configuration |
netserver | This MODE is open to the network. (A NUT server) |
netclient | This MODE is for client machines that will access a NUT server |
See the nut.conf documentation for more details.
Select your hardware
sudo vi /etc/nut/ups.conf
[cyberpower] driver = usbhid-ups port = auto desc = "A random surplus UPS"
(In my case, I'm setting up a CyberPower 1000AVR & connecting it by passing USB through to the VM...)
If your UPS isn't handled natively by the usbhid-ups driver, or you need to set options, start with the ups.conf documentation for more details.
Start & test
sudo upsdrvctl start
You should see:
Network UPS Tools - UPS driver controller 2.7.4 Network UPS Tools - Generic HID driver 0.41 (2.7.4) USB communication driver 0.33
Possibly followed by a bit of information about your UPS
Set up communications
(needed if you've set up as MODE = netserver...)
You can determine your servers IP address using:
ip a
sudo vi /etc/nut/upsd.conf
LISTEN 192.168.2.219 LISTEN 127.0.0.1 3493 LISTEN ::1 3493
Where 192.168.2.219 should be replaced with the actual IP of the machine.
See the upsd.conf documentation for more details.
Set up access
sudo vi /etc/nut/upsd.users
[upsmon] password = supersecretpassword upsmon master
See the upsd.users documentation for more details.
sudo vi /etc/nut/upsmon.conf
MONITOR cyberpower@192.168.2.219 1 monuser supersecretpassword master
See the upsmon.conf documentation for more details.
Managing NUT
The usual:
sudo service nut-server [start|stop|restart|status]
Client commands:
upsc cyberpower
upscmd -l cyberpower
upsrw cyberpower
nut-scanner