User Tools

Site Tools


software:nut:master

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
software:nut:master [2025/04/14 18:14] rodolicosoftware:nut:master [2025/07/03 02:45] (current) rodolico
Line 9: Line 9:
   * One opnSense firewall/router with the UPS module installed   * One opnSense firewall/router with the UPS module installed
   * One FreeBSD NAS   * One FreeBSD NAS
 +
 +**Note:** a Raspberry Pi works very well as a stand alone NUT server. See https://www.jeffgeerling.com/blog/2025/nut-on-my-pi-so-my-servers-dont-die for full instructions.
  
 ===== Set up UPS ===== ===== Set up UPS =====
Line 37: Line 39:
  
 This is the nasty part. We need to have ups.conf set up with the correct stanza to read the snmp UPS. Normally we would just point nut-scanner at it, but nut-scanner has some issues, at least on 2.7.4, under Debian where it can not find the snmp libraries. So, autodetect does not work. This is the nasty part. We need to have ups.conf set up with the correct stanza to read the snmp UPS. Normally we would just point nut-scanner at it, but nut-scanner has some issues, at least on 2.7.4, under Debian where it can not find the snmp libraries. So, autodetect does not work.
 +<code bash>
 nut-scanner --snmp_scan --mask_cidr 192.168.100.0/24 --disp_nut_conf nut-scanner --snmp_scan --mask_cidr 192.168.100.0/24 --disp_nut_conf
 +</code>
 returns "SNMP library not found. SNMP search disabled." even though the snmp libraries are there. It is supposed to be fixed with later versions. If it is working on your system, it will output a stanza that can be directly pasted into ups.conf. Otherwise, we have to do it the hard way. returns "SNMP library not found. SNMP search disabled." even though the snmp libraries are there. It is supposed to be fixed with later versions. If it is working on your system, it will output a stanza that can be directly pasted into ups.conf. Otherwise, we have to do it the hard way.
  
-So, we'll do it the way that is more susceptible to error. Modify the following to match your setup, then put it in ups.conf+If, you are running a distribution that does have a working nut-scanner, you can use the following command (modified for your system). This was tested on FreeBSD running on a Raspberry Pi. It will look for SNMP and USB attached UPS' 
 +<code bash> 
 +nut-scanner -U -S -m 192.168.100.0/24 -c public 
 +</code> 
 + 
 + 
 +On systems without a working nut-scanner, we'll do it the way that is more susceptible to error. Modify the following to match your setup, then put it in ups.conf
  
 <file autoconf ups.conf> <file autoconf ups.conf>
Line 97: Line 107:
 CMDSCRIPT /bin/upssched-cmd CMDSCRIPT /bin/upssched-cmd
 </file> </file>
 +
 +==== Test ====
 +
 +First, restart the service. On Devuan, it is called nut-server
 +
 +<code bash>
 +service nut-server restart 
 +</code>
 +
 +Test to make sure you have a connection and the server is correctly reading the UPS. You do not have to put in the @localhost; that is the default.
 +
 +<code bash>
 +# get list of all UPS' defined on localhost
 +upsc -L localhost
 +# get list of all values on one particular UPS (ups1)
 +upsc ups1@localhost
 +</code>
 +
 +==== NUT ups commands ====
 +  * upsc - lightweight UPS client. Really, set up to be an example of what you can create, but very useful. <code bash>upsc -c upsname</code> will show the clients which are monitoring a particular ups.
 +  * upscmd - send commands to UPS if it will accept. Try <code bash>upscmd -l <upsname></code>
 +  * upsd - This is the primary daemon that should always run to provide information about one or more UPS'. Generally auto started by the init system
 +  * upsdrvctl - standard interface to the UPS drivers. Not generally needed unless you are writing/debugging a particular driver.
 +  * upslog - A tool designed to read one or more UPS' and log the readings. Very useful for upssched if you want a nice log of how your UPS is working.
 +  * upsmon - A daemon which monitors all UPS' defined in upsmon.conf
 +  * upsrw - allows you to change some variables //on the ups itself// if the ups allows it.
 +  * upssched - scheduler to run commands listed in upssched.conf. This is called by upsmon and should not be used directly.
 +  * upssched-cmd - A sample upssched file. A simple shell script that performs commands in response to upssched.
 +
 +===== Links =====
 +  * https://www.jeffgeerling.com/blog/2025/nut-on-my-pi-so-my-servers-dont-die
 +  * https://technotim.live/posts/NUT-server-guide/
 +  * https://networkupstools.org/docs/man/snmp-ups.html
 +  * 
software/nut/master.1744672462.txt.gz · Last modified: 2025/04/14 18:14 by rodolico