Difference between revisions of "UPS Handling with NUT"

From Da Nerd Mage Wiki
Jump to navigation Jump to search
(Undo revision 1108 by Tinker (talk))
Tag: Undo
 
(35 intermediate revisions by the same user not shown)
Line 21: Line 21:
[https://networkupstools.org/index.html Network UPS Tools]
[https://networkupstools.org/index.html Network UPS Tools]


= Install NUT =
= Install & Configure NUT =
 
* <code>sudo apt install nut</code>
 
= Configure NUT =


== Select your mode ==
== Select your mode ==
* <code>sudo vi /etc/nut/nut.conf</code>
MODE=netserver
(In my case, I've installed NUT on a VM and it'll be managing the UPS for the whole server...)


{{{!}} class="wikitable" style="border-collapse: collapse; width: 735.333px;"
{{{!}} class="wikitable" style="border-collapse: collapse; width: 735.333px;"
Line 36: Line 29:
{{!}}-  
{{!}}-  
{{!}} style="width: 90.175px;" {{!}} '''none'''
{{!}} style="width: 90.175px;" {{!}} '''none'''
{{!}} style="width: 619.15px;" {{!}}
{{!}} style="width: 400.15px;" {{!}} Disable automatic startup of NUT
Disable automatic startup of NUT
{{!}}
{{!}}-  
{{!}}-  
{{!}} style="width: 90.175px;" {{!}} '''standalone'''
{{!}} style="width: 90.175px;" {{!}} '''standalone'''
{{!}} style="width: 619.15px;" {{!}} This MODE is for local only configuration
{{!}} style="width: 400.15px;" {{!}} This MODE is for local only configuration
{{!}} [[Standalone NUT usage]]
{{!}}-  
{{!}}-  
{{!}} style="width: 90.175px;" {{!}} '''netserver'''
{{!}} style="width: 90.175px;" {{!}} '''netserver'''
{{!}} style="width: 619.15px;" {{!}} This MODE is open to the network. (A NUT server)
{{!}} style="width: 400.15px;" {{!}} This MODE is open to the network. (A NUT server)
{{!}} [[Setting up a NUT Server]]
{{!}}-  
{{!}}-  
{{!}} style="width: 90.175px;" {{!}} '''netclient'''
{{!}} style="width: 90.175px;" {{!}} '''netclient'''
{{!}} style="width: 619.15px;" {{!}} This MODE is for client machines that will access a NUT server
{{!}} style="width: 400.15px;" {{!}} This MODE is for client machines that will access a NUT server
{{!}}}<p class="mwt-heading">See [https://networkupstools.org/docs/man/nut.conf.html the nut.conf documentation] for more details.</p>
{{!}} [[Setting up a NUT Client]]
 
{{!}}}
== Select your hardware ==
<p class="mwt-heading">See [https://networkupstools.org/docs/man/nut.conf.html the nut.conf documentation] for more details.</p>
* <code>sudo vi /etc/nut/ups.conf</code>
[cyberpower]
driver = usbhid-ups
port = auto
(In my case, I'm setting up a [https://www.cyberpowersystems.com/product/ups/intelligent-lcd/cp1000avrlcd/ 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 [https://networkupstools.org/docs/man/ups.conf.html the ups.conf documentation] for more details.
 
== Start & test ==
* <code>sudo upsdrvctl start</code>
 
You should see:


Network UPS Tools - UPS driver controller 2.7.4
* [[Using NUT with pfSense]]
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
* [[Using NUT to gracefully shut down ESXi]]
USB communication driver 0.33


Possibly followed by a bit of information about your UPS
= Managing NUT =
The usual:
* <code>sudo service nut-server ['''start'''{{!}}'''stop'''{{!}}'''restart'''{{!}}'''status''']</code>
Client commands:
* <code>upsc '''cyberpower'''</code>
** [https://networkupstools.org/docs/man/upsc.html man page]
* <code>upscmd -l '''cyberpower'''</code>
** [https://networkupstools.org/docs/man/upscmd.html man page]
* <code>upsrw '''cyberpower'''</code>
** [https://networkupstools.org/docs/man/upsrw.html man page]
* <code>nut-scanner</code>
** [https://networkupstools.org/docs/man/nut-scanner.html man page]


== Set up communications ==
= further Usage Concepts =
<span style="font-size: 24pt;" >(may not be needed...)</span>
* <code>ip a</code>
* <code>sudo vi /etc/nut/upsd.conf</code>
LISTEN 192.168.2.219
LISTEN 127.0.0.1 3493
LISTEN ::1 3493


== Set up access ==
NUT gives lots of options.
* <code>sudo vi /etc/nut/upsd.users</code>
[upsmon]
password = supersecretpassword
upsmon master
* <code>sudo vi /etc/nut/upsmon.conf</code>
MONITOR myups@192.168.2.219 1 monuser supersecretpassword master


= Manage NUT =
Things like:
* Cleanly shutting down all of the VMs on a server & the server itself too.
* Sending notifications about power issues.
* Managing redundant UPSs on your system.
* etc...


* <code>sudo service nut-server restart</code>
[[Category:IT]]
* <code>sudo service nut-server status</code>
[[Category:Hardware Management]]
* <code>upsc cyberpower</code>
[[Category:Linux]]
* <code>upscmd -l cyberpower</code>
[[Category:WIP]]

Latest revision as of 10:38, 15 May 2022

Proven on:
Logo Debian.png
11 (bullseye)


As always...

Start with:

  • sudo apt update
  • sudo apt upgrade

Network UPS Tools

Install & Configure NUT

Select your mode

MODE options:
none Disable automatic startup of NUT
standalone This MODE is for local only configuration Standalone NUT usage
netserver This MODE is open to the network. (A NUT server) Setting up a NUT Server
netclient This MODE is for client machines that will access a NUT server Setting up a NUT Client

See the nut.conf documentation for more details.

Managing NUT

The usual:

  • sudo service nut-server [start|stop|restart|status]

Client commands:

further Usage Concepts

NUT gives lots of options.

Things like:

  • Cleanly shutting down all of the VMs on a server & the server itself too.
  • Sending notifications about power issues.
  • Managing redundant UPSs on your system.
  • etc...