• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

NUT package (2.8.0 and below)

UPS Tools
128
1.2k
4.0m
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    dennypage @kevindd992002
    last edited by Jul 20, 2021, 4:49 AM

    @kevindd992002 said in NUT package:

    What I meant is when does the ups.delay.shutdown countdown start? When does the UPS start counting down before it cuts off power to its loads?

    It starts when the UPS receives a shutdown command.

    1 Reply Last reply Reply Quote 0
    • K
      kevindd992002
      last edited by Jul 26, 2021, 3:16 PM

      @dennypage

      Do you have any ideas why is it that when I connect to my APU2C4 via a serial port, the NUT package cannot detect my USB UPS?

      login-to-view

      As soon as I remove the serial cable connection and restart NUT, it works just fine.

      G D 2 Replies Last reply Jul 26, 2021, 3:59 PM Reply Quote 0
      • G
        Gertjan @kevindd992002
        last edited by Gertjan Jul 26, 2021, 3:59 PM Jul 26, 2021, 3:59 PM

        @kevindd992002 said in NUT package:

        I connect to my APU2C4 via a serial port, the NUT package cannot detect my USB UPS?

        Serial or USB ?

        As soon as I remove the serial cable connection and restart NUT, it works just fine.

        ? Without the cable, NUT works ?

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        K 1 Reply Last reply Jul 26, 2021, 4:23 PM Reply Quote 0
        • K
          kevindd992002 @Gertjan
          last edited by Jul 26, 2021, 4:23 PM

          @gertjan said in NUT package:

          @kevindd992002 said in NUT package:

          I connect to my APU2C4 via a serial port, the NUT package cannot detect my USB UPS?

          Serial or USB ?

          As soon as I remove the serial cable connection and restart NUT, it works just fine.

          ? Without the cable, NUT works ?

          APC UPS is connected via USB and I'm trying to keep a serial connection alive but when I do that it kills the APC USB connection. It only happens for the APC USB connection, not with other USB devices.

          Yes, it works without the serial connection.

          1 Reply Last reply Reply Quote 0
          • D
            dennypage @kevindd992002
            last edited by Jul 26, 2021, 5:56 PM

            @kevindd992002 This is a basic NUT issue rather than a package issue. You'll need to diagnose this at the NUT level, and probably follow up with the NUT forum. I'd suggest you start by examining the log entries for NUT...

            J 1 Reply Last reply Aug 2, 2021, 9:37 PM Reply Quote 0
            • J
              josepr @dennypage
              last edited by josepr Aug 2, 2021, 9:37 PM Aug 2, 2021, 9:37 PM

              So I am able to monitor and query the values of the two ups that power my firewall, by adding a second one at Advance Settings under ups.conf

              Any tips on what files, and their location the status widget uses to be able to modify and display data for each of the ups. (Hopefully something as simple as adding a loop or hardcoding a link for the second entry).

              D 1 Reply Last reply Aug 2, 2021, 9:45 PM Reply Quote 0
              • D
                dennypage @josepr
                last edited by Aug 2, 2021, 9:45 PM

                @josepr The pfSense NUT package is designed to supervise/monitor a single UPS only.

                I'm curious as to why you have two UPSs on your firewall... does you firewall hardware have dual power supplies connected to separate UPSs?

                J 1 Reply Last reply Aug 2, 2021, 10:03 PM Reply Quote 0
                • J
                  josepr @dennypage
                  last edited by Aug 2, 2021, 10:03 PM

                  @dennypage
                  Two ups each ones feeds a pdu which feeds a dual power supply host and other dual power equipment on a small 12U rack.
                  I am comfortable with programming and some html so wanted to see if could modify my copy of the package locally on my machine and make it work.

                  J D 2 Replies Last reply Aug 2, 2021, 11:42 PM Reply Quote 0
                  • J
                    josepr @josepr
                    last edited by Aug 2, 2021, 11:42 PM

                    @josepr
                    So was able to find the widget php and for now hardcode the second ups, havent had the chance to play with php before but will try to make it so that it can read all ups from the ups.conf and do something like the traffic or gateway widget were i can select which to display, get a chance to learn php.
                    login-to-view

                    J 1 Reply Last reply Aug 3, 2021, 1:27 AM Reply Quote 0
                    • D
                      dennypage @josepr
                      last edited by Aug 2, 2021, 11:52 PM

                      @josepr said in NUT package:

                      Two ups each ones feeds a pdu which feeds a dual power supply host and other dual power equipment on a small 12U rack.

                      I see. Old school cool. Given the lower cost of hardware these days, I don't see that much anymore. These days I usually see dual systems, each with their own UPS, set up as a fault tolerant or load balanced pair. But you probably have that as well. 😀

                      Unfortunately, while NUT itself has support for multiple power sources, the pfSense NUT package does not support that configuration. The pfSense NUT package is single UPS only. It would take quite a bit of work to make it support multiples in the various (extensive) configurations, and there really hasn't been any interest. You are actually the first to ask about it.

                      Probably your best bet is to use one of your other systems to run NUT on, and have that system initiate a remote shutdown of pfSense when the time comes. Sorry.

                      1 Reply Last reply Reply Quote 1
                      • J
                        josepr @josepr
                        last edited by Aug 3, 2021, 1:27 AM

                        @josepr
                        Well I have it working for at least a nice widget displaying all the info for the attached ups, which was my main goal so i can get an idea of their status in one page, dont really have it shutting down anything at the moment maybe will get to that later.

                        login-to-view

                        For anyone that is interested all I did was:

                        Modified '/usr/local/pkg/nut/nut.inc'
                        Added two functions:

                        function nut_conf() {
                        	global $config;
                        	$conf = &$config['installedpackages']['nut']['config'][0];
                        	return $conf;
                        }
                        
                        function list_ups() {
                        	$upss = array();
                        	$config = nut_conf();
                        	if (isset($config['name'])) {
                        		$upss[] = $config['name'];
                        	}
                        	if (isset($config['ups_conf'])) {
                        		$conf =  parse_ini_string(base64_decode($config['ups_conf']), true);
                        		foreach ($conf as $name => $_conf) {
                        			$upss[] = $name;
                        		}
                        	}
                        	return $upss;
                        }
                        

                        and modified the start of the nut_ups_status function

                        function nut_ups_status($name = null)
                        {
                        	global $config;
                        	$status = array();
                        
                        	$nut_config = &$config['installedpackages']['nut']['config'][0];
                        	if (isset($nut_config['type'])) {
                        		$type = $nut_config['type'];
                        	} else {
                        		$type = 'disabled';
                        	}
                        
                        	if ($type == 'disabled') {
                        		$status['_summary'] = "Monitoring is not enabled";
                        		return $status;
                        	}
                        
                        	$ups = $name ?: $nut_config['name'];
                        

                        Then i modified /usr/local/www/widgets/widgets/nut_status.widget.php

                        <?php
                        require_once("/usr/local/www/widgets/include/nut_status.inc");
                        require_once("/usr/local/pkg/nut/nut.inc");
                        
                        
                        if ($_REQUEST && $_REQUEST['ajax']) {
                        	print_all_table(); #Get multiple tables instead of just one.
                        	exit;
                        }
                        
                        
                        function print_row($desc, $value) {
                        	#didnt touch
                        }
                        
                        function print_row_pct($desc, $value) {
                        	#didnt touch
                        }
                        
                        function print_table($name) {
                        	$status = nut_ups_status($name);
                                ##Only added the $name parameter, the rest stayed the same
                        }
                        #New Function to print a table per UPS
                        function print_all_table() {
                        	print '<table class="table table-bordered table-dark"> <tbody>';
                        	foreach (list_ups() as $name) {
                        		print '<tr class="panel-title"><td><b>' . $name . '</b></td></tr>';
                        		print '<tr><td><div">';
                        			print '<table class="table table-striped table-hover table-condensed">';
                        			print '<tbody>' . print_table($name) . '</tbody>';
                        			print '</table>';
                        		print '</div></td></tr>';
                        	}
                        	print '</tbody></table>';
                        }
                        ?>
                        <div class="table-responsive" id = "nuttable">
                        	<?php print_all_table() ?>
                        </div>
                        
                        <script type="text/javascript">
                        #Didnt touch
                        </script>
                        
                        

                        And then add my second ups under the ups.conf advanced settings.

                        login-to-view

                        D 1 Reply Last reply Aug 3, 2021, 6:15 AM Reply Quote 0
                        • D
                          dennypage @josepr
                          last edited by Aug 3, 2021, 6:15 AM

                          @josepr It might be a good idea to focus on correct NUT configuration before worrying about the monitoring widget. It appears that you've set up a situation in which the pfSense box will shutdown if either UPS fails, which I'm pretty sure is not what you want. For the work that you're doing, it would be simpler to abandon the pfSense NUT package and just configure NUT directly. Of course, you'll loose the pretty widget, but it would be a lot safer.

                          The APC UPSs are SNMP based, and also have their own web interface. Is there a reason you are focused on having status displayed in pfSense widgets? Instead of using their built-in web monitoring? Or an SNMP web based monitor such as Librenms or the like?

                          J 1 Reply Last reply Aug 3, 2021, 9:17 AM Reply Quote 0
                          • J
                            josepr @dennypage
                            last edited by josepr Aug 3, 2021, 9:18 AM Aug 3, 2021, 9:17 AM

                            @dennypage
                            Actions are not taken for the device configured at ups.conf, this is only for the upsd service which setups communications with devices and can also provide access to this devices to other remote services such as a remote upsmon instance in another server.
                            upsmon is the service that actually enforces action and it has its own configuration which the package only generates an entry for the UPS configured the normal way, I did add a two liner to the Advance part so that it acts when both UPS are down.

                            Auto generated by the package for UPSMON

                            MONITOR ups-2 1 local-monitor **** master
                            SHUTDOWNCMD "/sbin/shutdown -p +0"
                            POWERDOWNFLAG /etc/killpower
                            

                            With addition to the upsmon.conf at advance in gui

                            MONITOR ups-2 1 local-monitor **** master
                            SHUTDOWNCMD "/sbin/shutdown -p +0"
                            POWERDOWNFLAG /etc/killpower
                            
                            ###ADDED LINES upsmon.conf####
                            MONITOR ups-1 1 local-monitor2 **** master
                            MINSUPPLIES 1
                            

                            Did also have to add an extra user in upsd.users as the package generates a random password everytime it saves for local-monitor

                            [local-monitor2]
                            password=****
                            upsmon master
                            

                            This tells upsmon that it should monitor the 2 ups, that both UPS provide power for one PSU in the server and that it needs a minimum of one power supply to operate, so it is now fault tolerant (Will only conduct a shutdown if both UPS are down/critical power).

                            The reason i add them to PFSENSE is that it depends on both UPS so I wanted a way to make sure it reflected this and didnt try anything drastic when one UPS is offline.
                            It is my always on device and the last device to be shutdown and can it act as a ups provider to any other nut clients in other devices.

                            D 1 Reply Last reply Aug 3, 2021, 7:02 PM Reply Quote 0
                            • D
                              dennypage @josepr
                              last edited by Aug 3, 2021, 7:02 PM

                              @josepr said in NUT package:

                              This tells upsmon that it should monitor the 2 ups, that both UPS provide power for one PSU in the server and that it needs a minimum of one power supply to operate, so it is now fault tolerant (Will only conduct a shutdown if both UPS are down/critical power).

                              MINSUPPLIES was not shown in the configuration you posted previously.

                              J 1 Reply Last reply Aug 3, 2021, 9:43 PM Reply Quote 0
                              • J
                                josepr @dennypage
                                last edited by Aug 3, 2021, 9:43 PM

                                @dennypage
                                Yes, but i also hadnt added
                                MONITOR ups-1 1 local-monitor2 **** master
                                to upsmon so it was not watching/monitoring the second ups.

                                1 Reply Last reply Reply Quote 0
                                • G
                                  Gooberpatrol66
                                  last edited by Oct 6, 2021, 6:06 AM

                                  I have a NUT setup that used to work, but stopped working at some point (I don't know when)

                                  UPS type:
                                  snmp

                                  extra arguments:
                                  pollfreq=1

                                  upsd.conf:
                                  LISTEN pfsense

                                  upsd.users:
                                  [upsremote]
                                  password = blablabla
                                  upsmon master

                                  log:
                                  Oct 5 19:24:07 php-fpm 352 /nut_settings.php: Beginning configuration backup to https://acb.netgate.com/save
                                  Oct 5 19:24:08 upsmon 6682 Poll UPS [tripplite1] failed - Driver not connected
                                  Oct 5 19:24:09 php-fpm 352 /nut_settings.php: End of configuration backup to https://acb.netgate.com/save (success).
                                  Oct 5 19:24:09 php-fpm 352 /nut_settings.php: Stopping service nut
                                  Oct 5 19:24:09 upsmon 6682 Signal 15: exiting
                                  Oct 5 19:24:09 upsd 7295 User local-monitor@::1 logged out from UPS [tripplite1]
                                  Oct 5 19:24:09 upsd 7295 mainloop: Interrupted system call
                                  Oct 5 19:24:09 upsd 7295 Signal 15: exiting
                                  Oct 5 19:24:09 php-fpm 352 /nut_settings.php: Starting service nut
                                  Oct 5 19:24:09 upsmon 88547 Startup successful
                                  Oct 5 19:24:10 upsd 89034 listening on pfsense port 3493
                                  Oct 5 19:24:10 upsd 89034 listening on ::1 port 3493
                                  Oct 5 19:24:10 upsd 89034 listening on 127.0.0.1 port 3493
                                  Oct 5 19:24:10 upsd 89034 Can't connect to UPS [tripplite1] (snmp-ups-tripplite1): No such file or directory
                                  Oct 5 19:24:10 upsd 89336 Startup successful
                                  Oct 5 19:24:12 upsd 89336 User local-monitor@::1 logged into UPS [tripplite1]
                                  Oct 5 19:24:12 upsmon 88697 Poll UPS [tripplite1] failed - Driver not connected
                                  Oct 5 19:24:12 upsmon 88697 Communications with UPS tripplite1 lost
                                  Oct 5 19:24:13 php 10742 nut_email.php: Message sent to logger@gentooserver.dehnel.info OK
                                  Oct 5 19:24:17 upsmon 88697 Poll UPS [tripplite1] failed - Driver not connected
                                  Oct 5 19:24:17 upsmon 88697 UPS tripplite1 is unavailable
                                  Oct 5 19:24:18 php 19486 nut_email.php: Message sent to logger@gentooserver.dehnel.info OK

                                  D 1 Reply Last reply Oct 6, 2021, 4:09 PM Reply Quote 1
                                  • D
                                    dennypage @Gooberpatrol66
                                    last edited by Oct 6, 2021, 4:09 PM

                                    @gooberpatrol66 You haven't included the pertinent portions of your config, but best guess based on the log is that you are simply not able to connect to the UPS.

                                    • Be sure that you are referring to the UPS by address. Don't depend upon host name resolution for a UPS.
                                    • Confirm that you can actually access the UPS with the SNMP credentials specified.

                                    Unrelated, but a poll frequency of 1 is really overkill. The default of 5 works just fine. The lowest poll frequency recommended by NUT is 2.

                                    A 1 Reply Last reply Oct 12, 2021, 8:44 AM Reply Quote 0
                                    • A
                                      AndreyMoiseev @dennypage
                                      last edited by Oct 12, 2021, 8:44 AM

                                      @dennypage Hello(Sorry for my english)

                                      pfeens 2.5.2 + Nut + UPS Ippon Back Basic 650 (connected Usb Driver Blazer).

                                      Turned on nut and set it up
                                      login-to-view login-to-view
                                      There was a problem with the definition UPS Ippon after reboot pfsens (Before restarting the UPS, it is determined).
                                      login-to-view

                                      K D 2 Replies Last reply Oct 12, 2021, 12:14 PM Reply Quote 0
                                      • K
                                        kevindd992002 @AndreyMoiseev
                                        last edited by Oct 12, 2021, 12:14 PM

                                        @dennypage

                                        There was a blackout in my house a few days ago. I've noticed a very weird behavior with my Eaton UPS while I was actually monitoring the shutdown process. Here are the logs:

                                        Oct 11 11:49:14 	kernel 		Origin="AuthenticAMD" Id=0x730f01 Family=0x16 Model=0x30 Stepping=1
                                        Oct 11 11:49:14 	kernel 		CPU: AMD GX-412TC SOC (998.15-MHz K8-class CPU)
                                        Oct 11 11:49:14 	kernel 		VT(vga): resolution 640x480
                                        Oct 11 11:49:14 	kernel 		FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
                                        Oct 11 11:49:14 	kernel 		FreeBSD 12.2-STABLE fd0f54f44b5c(RELENG_2_5_0) pfSense amd64
                                        Oct 11 11:49:14 	kernel 		FreeBSD is a registered trademark of The FreeBSD Foundation.
                                        Oct 11 11:49:14 	kernel 		The Regents of the University of California. All rights reserved.
                                        Oct 11 11:49:14 	kernel 		Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
                                        Oct 11 11:49:14 	kernel 		Copyright (c) 1992-2020 The FreeBSD Project.
                                        Oct 11 11:49:14 	kernel 		---<<BOOT>>---
                                        Oct 11 11:49:14 	syslogd 		kernel boot file is /boot/kernel/kernel
                                        Oct 11 11:42:10 	kernel 		done. 
                                        Oct 11 09:48:27 	shutdown 	45407 	power-down by root:
                                        Oct 11 09:48:25 	upsd 	61950 	User monuser@192.168.10.10 logged into UPS [ups]
                                        Oct 11 09:48:22 	upsmon 	18273 	Auto logout and shutdown proceeding
                                        Oct 11 09:48:22 	upsmon 	18273 	Executing automatic power-fail shutdown
                                        Oct 11 09:48:21 	upsd 	61950 	User monuser@192.168.10.10 logged out from UPS [ups]
                                        Oct 11 09:47:18 	php 	27924 	nut_email.php: Message sent to kevindd992002@yahoo.com OK
                                        Oct 11 09:47:04 	upsd 	61950 	Client local-monitor@::1 set FSD on UPS [ups]
                                        Oct 11 09:47:04 	upsmon 	18273 	UPS ups battery is low 
                                        

                                        The weird behavior was that after the UPS gets a shutdown command from pfsense NUT, it shuts itself down, cuts power off from the load and then turns back on right away even though there is no power from the mains yet. And then it shuts itself down again and continues this cycle until the battery gets depleted. Any ideas what's causing this?

                                        Also, at 9:48:21 I see a logout from one of the remote monitors, but why is there another login event at 9:48:25 right before the shutdown event by root at 09:48:27?

                                        G 1 Reply Last reply Oct 12, 2021, 2:26 PM Reply Quote 0
                                        • G
                                          Gertjan @kevindd992002
                                          last edited by Oct 12, 2021, 2:26 PM

                                          @kevindd992002 said in NUT package:

                                          Any ideas what's causing this?

                                          The BIOS of your pfSense uses the setting "Auto power on when power comes back".
                                          So, when the power comes back, it will boot again.
                                          This will loop until a) the power comes back and b) the battery is charged enough so NUT decides to stay 'on'.

                                          Easiest solution : don't auto boot when the power comes back. This means that the shut down is controlled, but human presence is needed to switch it on again.
                                          Best solution : Have a talk with your USP. Ask it to power the oullets when a and b or ok.
                                          This best solution is often not possible with a typical SoHO UPS.

                                          No "help me" PM's please. Use the forum, the community will thank you.
                                          Edit : and where are the logs ??

                                          K 1 Reply Last reply Oct 12, 2021, 2:49 PM Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.