Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:nut [2020-12-20 Sun wk51 09:58] – [NUT Key commands and scripts] baumkphome_server:home_server_setup:other_services:nut [2023-05-13 Sat wk19 10:20] (current) – [NUT (Network UPS Tools) Setup] baumkp
Line 1: Line 1:
-{{tag>linux ubuntu nut ups server}}+{{tag>linux debian nut ups server}}
 ======NUT (Network UPS Tools) Setup====== ======NUT (Network UPS Tools) Setup======
 +I purchased my current main UPS the Powershield Commander RT PSCRT1100 / Voltronic Power Otima II 1.1K in 2014 and setup NUT about this time, including early conversion to systemd scripts.  I notice the Techno Tim [[https://docs.technotim.live/posts/NUT-server-guide/|Network UPS Tools (NUT) Ultimate Guide]] late 2022 has a perhaps more modern take on this.
  
-NUT is an open source network monitoring and control system. I use a Powershield Commander RT PSCRT1100 a 1100VA/880W, line interactive sinewave UPS. It turns out that this is a slightly modified version of the [[http://voltronicpower.com/en-US/Product/Detail/Otima-II-800VA-5KVA|Voltronic Power Otima II 1.1K]]. Presumably the unit has been slightly modified for Powershield for the Australian market, mainly hardware plugs and presumably some firmware/software setup. In fact Voltronic Power, headquartered in Taiwan, even states they are a leading OEM/ODM manurfacturer of UPSs, AVRs and inverters. The software provided with the UPS is both propriety and bloated. I want a simple efficient command line / daemon based utility that can monitor performance, control as necessary and report on abnormal operation. Unfortunately the [[http://networkupstools.org/documentation.html|NUT project documentation]] is not simple to follow. I set this up quite some time ago, so this will not necessarily be up to date.+By the way a couple years ago the UPS battery fail alarm went off.  It would seem the UPS batteries failed after about 5-6 years of operation.  These battery seems to be common lead-acid gel type 12 VDC at 9 AMP-hr (although they look to be the same as 7.2 AMP batteries....)  I basically set and forgot them.  I understand 5-6 year life is not unreasonably.  In any case I purchased some new batteries and replaced and the UPS has continued to function well.  The batteries failed again after less than 3 years.  The batteries are 12VDC 9AHr SLA with F@ tabs, the power tab width must be 6.3mm not 4.8mm. Two batteries are required, they are wired in series.  
 + 
 +NUT is an open source network monitoring and control system. I use a Powershield Commander RT PSCRT1100 a 1100VA/880W, line interactive sinewave UPS. It turns out that this is a slightly modified version of the [[http://voltronicpower.com/en-US/Product/Detail/Otima-II-800VA-5KVA|Voltronic Power Otima II 1.1K]]. Presumably the unit has been slightly modified for Powershield for the Australian market, mainly hardware plugs and presumably some firmware/software setup. In fact Voltronic Power, headquartered in Taiwan, even states they are a leading OEM/ODM manufacturer of UPSs, AVRs and inverters. The software provided with the UPS is both propriety and bloated. I want a simple efficient command line / daemon based utility that can monitor performance, control as necessary and report on abnormal operation. Unfortunately the [[http://networkupstools.org/documentation.html|NUT project documentation]] is not simple to follow. I set this up quite some time ago, so this will not necessarily be up to date.
  
 It turns out the ''nutdrv_qx'' driver is usually better suited for Voltronic Power UPSs than the ''Blazer_usb'' one. See NUT [[http://networkupstools.org/protocols/voltronic.html|Voltronic Power UPS Protocol]], it is also list under the Voltronic Power section, (various)USB of the NUT [[http://networkupstools.org/stable-hcl.html|Hardware compatibility list]]. It turns out the ''nutdrv_qx'' driver is usually better suited for Voltronic Power UPSs than the ''Blazer_usb'' one. See NUT [[http://networkupstools.org/protocols/voltronic.html|Voltronic Power UPS Protocol]], it is also list under the Voltronic Power section, (various)USB of the NUT [[http://networkupstools.org/stable-hcl.html|Hardware compatibility list]].
Line 146: Line 149:
 Turn off the existing legacy scripts and systemd handlers, as noted above; ''sudo update-rc.d nut-client disable'', ''sudo update-rc.d nut-server disable'' and ''sudo systemctl disable ups-monitor.service'' You may also need to disable the following systemd services: nut-client.service, nut-monitor.service and nut-server.service. Turn off the existing legacy scripts and systemd handlers, as noted above; ''sudo update-rc.d nut-client disable'', ''sudo update-rc.d nut-server disable'' and ''sudo systemctl disable ups-monitor.service'' You may also need to disable the following systemd services: nut-client.service, nut-monitor.service and nut-server.service.
  
-The Kepstin blog gives a good NUT and Systemd discussion [[https://www.kepstin.ca/blog/networkupstoolsnutandsystemd/|Network UPS Tools (nut) and systemd]]. However it is written for Fedora and there are some nuances required to work with Ubuntu. For a general understanding of Systemd see DigitalOcean references: [[https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files|Understanding Systemd Units and Unit Files]], [[https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units|How To Use Systemctl to Manage Systemd Services and Units]], and [[https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal|Systemd Essentials: Working with Services, Units, and the Journal]].+The Kepstin blog gives a good NUT and Systemd discussion [[https://www.kepstin.ca/blog/networkupstoolsnutandsystemd/|Network UPS Tools (nut) and systemd]]. However it is written for Fedora and there are some nuances required to work with Debian/Ubuntu. For a general understanding of Systemd see DigitalOcean references: [[https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files|Understanding Systemd Units and Unit Files]], [[https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units|How To Use Systemctl to Manage Systemd Services and Units]], and [[https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal|Systemd Essentials: Working with Services, Units, and the Journal]].
  
 First we need to get the NUT driver running, "sudo vim /etc/systemd/system/nut-driver.service" First we need to get the NUT driver running, "sudo vim /etc/systemd/system/nut-driver.service"
Line 204: Line 207:
  
   *List all the UPS device profile variable ''/bin/upsc KPBUPS@localhost 2>/dev/null''.   *List all the UPS device profile variable ''/bin/upsc KPBUPS@localhost 2>/dev/null''.
-  *A script file to succinctly log the UPS data, using cron to run script every 10 minutes ''sudo Myscripts/UPSScan.sh 2>/dev/null'',<code>#!/bin/bash+  *A script file to succinctly log the UPS data, using cron to run script every 10 minutes ''sudo Myscripts/UPSScan.sh 2>/dev/null'',<code bash>#!/bin/bash
 # Logging output for NUT UPS Monitor output # Logging output for NUT UPS Monitor output
  
Line 228: Line 231:
         printf("\n") }'                                                 >>"$strf"         printf("\n") }'                                                 >>"$strf"
 </code> </code>
-  *A script file to rotate a log file out to a dated gzip log file, with a new empty log file, the log file with path is the script input ''sudo rotatelog.sh /var/log/UPSLog.Log'', again can be use with cron monthly to rotate a log file. <code>+  *A script file to rotate a log file out to a dated gzip log file, with a new empty log file, the log file with path is the script input ''sudo rotatelog.sh /var/log/UPSLog.Log'', again can be use with cron monthly to rotate a log file. <code bash>
 #!/bin/bash #!/bin/bash
 logfile=$1 logfile=$1
Line 244: Line 247:
   *To list the available UPS commands: "upscmd -l KPBUPS"   *To list the available UPS commands: "upscmd -l KPBUPS"
   *Some other scripts:   *Some other scripts:
-    *To email notifications from nut: nut-notify.sh (not tested)<code>+    *To email notifications from nut: nut-notify.sh (not tested)<code bash>
 #!/bin/sh #!/bin/sh
 #echo "$*" | mailx -s "UPS Notice" baumkp@gmail.com #echo "$*" | mailx -s "UPS Notice" baumkp@gmail.com
Line 271: Line 274:
 </code> </code>
  
-Example to disable the UPS beeper: ''upscmd beeper.disable''+Example to disable the UPS beeper: ''upscmd KPBUPS@localhost beeper.disable'' it will then prompt for NUT user and password. 
 The command will prompt for a user then password.  This is a valid user and password define for the NUT installation as defined in the file ''/etc/nut/upsd.users'' as noted above. The command will prompt for a user then password.  This is a valid user and password define for the NUT installation as defined in the file ''/etc/nut/upsd.users'' as noted above.
-                     T + 
-                     +<code> 
-                     +                              Voltage      Battery                S 
-                     +                          L                V        R t       t 
-                     U+00B0 +                          o                o     h r  u i       a c 
-                     c +                          a                l     a g  n m       t o 
-YYYY-MM-DD HH:MM:SS   +                              in    out    t          e       u d 
-2020-12-01 00:20:01  20.3 11 244.7 243.9 27.30 100 3660 50.0 OL+                                                                  s e 
 +YYYY-MM-DD  HH:MM:SS  C       VAC   VAC    VDC      Sec   Hz     
 +2020-12-01  00:20:01  20.3  11  244.7 243.9  27.30 100  3660  50.0  OL 
 +</code> 
 +Some known Status Code: 
 +  * OL  = On Line  (running from main power supply, no adjustments) 
 +  * OB  = On Battery 
 +  * ALARM OL RB = Alarm, On Line, Replace Battery 
 +  * OL CAL = On Line Calibrating
  
 ====The following is a list of related commonly used commands and scripts:==== ====The following is a list of related commonly used commands and scripts:====
Line 292: Line 304:
 ---- ----
  
-<- home_server:home_server_setup:other_services:Mosh|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:back-up_server|Next ->+<- home_server:home_server_setup:other_services:nnn|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:back-up_server|Next ->