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

    UPS shutdown

    pfSense Packages
    12
    67
    32.4k
    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.
    • Cry HavokC
      Cry Havok
      last edited by

      A package of NUT (Network UPS Tools) is almost certainly what you're after.

      Not that there is one, yet  :)

      1 Reply Last reply Reply Quote 0
      • R
        rsw686
        last edited by

        The issue I see is that most people arn't buying a UPS just for their pfsense box. I have a Belkin 1500VA UPS running my rack with 2 servers, couple of switches, and pfsense. Interfacing it with the UPS software would make it more ideal. However since I run the embedded version of pfsense its not as big of a deal for me.

        I know both APC and Belkin have networking versions of their software for multiple server shutdowns. Does NUT interface with those in anyway? Maybe theres a way it could receive a network broadcast from the software in some way?

        1 Reply Last reply Reply Quote 0
        • S
          sullrich
          last edited by

          This seems like a popular package request.  Perhaps you guys can starta  bounty?

          1 Reply Last reply Reply Quote 0
          • T
            trendchiller
            last edited by

            I already started to test with UPSD, but there is still no GUI and I'm not too familiar with how to get it started automatically when pfsense starts… or the pfsense package system...  :'(

            I'd prefer upsd because it's the most compatible UPS software i think... there also is a bsd port that's working with pfsense (at least in my tests)

            perhaps anyone posts a bounty for scott or if noone does  ??? then I definitively need help with that one...

            so...

            Martin

            1 Reply Last reply Reply Quote 0
            • R
              rsw686
              last edited by

              @trendchiller:

              I already started to test with UPSD, but there is still no GUI and I'm not too familiar with how to get it started automatically when pfsense starts… or the pfsense package system...  :'(

              I'd prefer upsd because it's the most compatible UPS software i think... there also is a bsd port that's working with pfsense (at least in my tests)

              perhaps anyone posts a bounty for scott or if noone does  ??? then I definitively need help with that one...

              so...

              Martin

              UPSD doesn't seem to be the most compatible. When I looked at the freebsd ports theres 5 different version one for each type of ups (apcupsd, bkpupsd, mgeupsd, openupsd, upsd). Where NUT is just one binary that includes the files for all UPS versions. Atleast thats what I saw.

              However in terms of implementing UPSD looks to be easier as its just the daemon, config and rc file.

              NUT would allow users with linux, freebsd, windows, etc to interface together and shutdown all systems connected to the UPS as there are multiple versions.

              Also NUT has snmp which would be nice as I should be able to interface it into my existing Belkin software solution on my 2 servers.

              When I have free time I'll work on trying to get NUT to work and look at building a package. I need to get my spare box and ups setup to do this so I really don't know the timeframe.

              The nut daemon is called upsd so maybe there is some confusion there.

              1 Reply Last reply Reply Quote 0
              • T
                trendchiller
                last edited by

                so you are right… when upsd supports more ups'ses it'll be better, since there is just one package needed... so i'll have a look at it too...  ;)

                Thanks for advice...

                Martin

                1 Reply Last reply Reply Quote 0
                • B
                  Berg
                  last edited by

                  I would certainly be in favour of using NUT.

                  I am already using it on a Linux server that would should down a couple of Linux and Windows machines from the server. This would be a great addition to pfSense,

                  1 Reply Last reply Reply Quote 0
                  • R
                    rsw686
                    last edited by

                    Disreguard this post I figured it out.

                    So in

                    http://ftp-mirror.internap.com/pub/FreeBSD/ports/i386/packages-6.0-release/All/

                    the nut package seems to include everything but upsdrvctl which is needed to start the driver control part of nut.

                    1 Reply Last reply Reply Quote 0
                    • R
                      rsw686
                      last edited by

                      I have made some progress on this. Again I need to get my other box setup with its own ups setup to continue.

                      http://wgnrs.dynalias.com:81/pfsense/nut

                      Make sure you read through the files before you run anything as this is all in the devel phase. The files needed are in place and the user and group are there.

                      1 Reply Last reply Reply Quote 0
                      • R
                        rsw686
                        last edited by

                        I've gotten NUT up and running on pfSense. Here is the install script I am running. Everything is hardcoded and I've tested it from a clean install of pfsense in VMware with a UPS on the serial port and below is the output. The hard part of this is making a web interface that will be able to change the numerous settings required. I will work on that.

                        Once I get it all working if anybody would like to make a donation for my time it would be appreciated.

                        http://wgnrs.dynalias.com:81/pfsense/nut/installnut.sh

                        
                        installnut.sh                                 100% of 2733  B 3360 kBps
                        -                                             100% of  799 kB  876 kBps
                        Network UPS Tools - UPS driver controller 2.0.2
                        Network UPS Tools (version 2.0.2) - APC Smart protocol driver
                                Driver version 1.99.7, command table version 2.0
                        Detected SMART-UPS 700 [XS9904001510] on /dev/ttyd0
                        Network UPS Tools upsd 2.0.2
                        Connected to UPS [sparky]: apcsmart-ttyd0
                        Synchronizing....done
                        OL LB
                        Network UPS Tools upsmon 2.0.2
                        Using power down flag file /etc/killpower
                        
                        UPS: sparky@10.10.1.200 (master) (power value 1)
                        
                        Broadcast Message from admin@pfsense.local
                                (no tty) at 21:57 UTC...
                        
                        UPS sparky@10.10.1.200 battery is low
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • B
                          Berg
                          last edited by

                          @rsw686:

                          I've gotten NUT up and running on pfSense. Here is the install script I am running. Everything is hardcoded and I've tested it from a clean install of pfsense in VMware with a UPS on the serial port and below is the output. The hard part of this is making a web interface that will be able to change the numerous settings required. I will work on that.

                          Once I get it all working if anybody would like to make a donation for my time it would be appreciated.

                          http://wgnrs.dynalias.com:81/pfsense/nut/installnut.sh

                          Awesome !!!! Thanks for working on this !

                          1 Reply Last reply Reply Quote 0
                          • R
                            rsw686
                            last edited by

                            Okay I've run into a snag. Can one of the devs tell me how I can change the url for the package manager so I can test this out?

                            1 Reply Last reply Reply Quote 0
                            • R
                              rsw686
                              last edited by

                              I have a working package. However it needs error handling and features to be added, which I will work on.  Heres the package edit screen. And below that the log from clicking change. You can see it stops the old and starts the service back up. Also it starts successfully on reboot.

                              **I really needs one of the devs help in getting the package manager to work. If I can change the url somehow to run it off my server. I looked into it and it talks to xmlrpc.php. I can't test the install and uninstall functions and have to perform them at the command line.

                              Also the global booting variable is false when the packages are being synced. Is there a way to know when the system is booting so the sync package command doesn't start the package, that way when the rc.d scripts execute it will start. Otherwise it starts, stops, then starts again.**

                              Oct 21 03:50:09 	upsmon[2160]: UPS sparky@10.10.1.200 battery is low
                              Oct 21 03:50:09 	upsmon[2160]: UPS sparky@10.10.1.200 battery is low
                              Oct 21 03:50:09 	upsd[2157]: Client monuser@10.10.1.200 logged into UPS [sparky]
                              Oct 21 03:50:09 	upsd[2157]: Connection from 10.10.1.200
                              Oct 21 03:50:09 	upsmon[2159]: Startup successful
                              Oct 21 03:50:09 	upsd[2157]: Startup successful
                              Oct 21 03:50:07 	upsd[2156]: Connected to UPS [sparky]: apcsmart-ttyd0
                              Oct 21 03:50:07 	apcsmart[2155]: Startup successful
                              Oct 21 03:49:57 	php: nut: Starting service
                              Oct 21 03:49:57 	php: nut: Taking control of port
                              Oct 21 03:49:56 	php: nut: Releasing control of port
                              Oct 21 03:49:55 	apcsmart[1970]: Signal 15: exiting
                              Oct 21 03:49:55 	upsd[1972]: Signal 15: exiting
                              Oct 21 03:49:55 	upsmon[1975]: Signal 15: exiting
                              Oct 21 03:49:55 	php: nut: Stopping service
                              
                              1 Reply Last reply Reply Quote 0
                              • R
                                rsw686
                                last edited by

                                Wanted to add when the power fails it starts shutdown and halts the box. This is from remote syslog. I need to set the delay as right now it shutsdown immediately on powerfail.

                                10-21-2006	01:17:08	Daemon.Info	10.10.1.200	Oct 21 05:18:05 upsd[622]: Signal 15: exiting
                                10-21-2006	01:17:06	Auth.Notice	10.10.1.200	Oct 21 05:18:03 shutdown: halt by root:
                                10-21-2006	01:17:06	Daemon.Info	10.10.1.200	Oct 21 05:18:03 upsd[622]: Host 10.10.1.200 disconnected (read failure)
                                10-21-2006	01:17:01	Daemon.Notice	10.10.1.200	Oct 21 05:17:58 upsmon[625]: Auto logout and shutdown proceeding
                                10-21-2006	01:17:01	Daemon.Critical	10.10.1.200	Oct 21 05:17:58 upsmon[625]: Executing automatic power-fail shutdown
                                10-21-2006	01:17:01	Daemon.Info	10.10.1.200	Oct 21 05:17:58 upsd[622]: Client monuser@10.10.1.200 set FSD on UPS [sparky]
                                10-21-2006	01:17:01	Daemon.Notice	10.10.1.200	Oct 21 05:17:58 upsmon[625]: UPS sparky@10.10.1.200 on battery
                                
                                1 Reply Last reply Reply Quote 0
                                • Cry HavokC
                                  Cry Havok
                                  last edited by

                                  Left to it's own devices NUT would normally trigger a shutdown on LB (low battery).  This should be the correct process (otherwise you'll start a shutdown if the power goes out for a fraction of a second, probably not what you want).

                                  I'd also be interested in a client only option - for those of us already running a NUT server.

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rsw686
                                    last edited by

                                    Thats probably what it is as the UPS I was testing with is old and has a low battery condition. I have others but there used for production boxes. The client is easy to implement as well. What I'm trying to figure out is how to change the pacakge url so I can install and uninstall the package to test everything out.

                                    1 Reply Last reply Reply Quote 0
                                    • B
                                      billm
                                      last edited by

                                      @rsw686:

                                      Okay I've run into a snag. Can one of the devs tell me how I can change the url for the package manager so I can test this out?

                                      "xmlrpcbaseurl" => "www.pfsense.com",
                                          "xmlrpcpath" => "/pfSense/xmlrpc.php",

                                      in /etc/inc/globals.inc

                                      –Bill

                                      pfSense core developer
                                      blog - http://www.ucsecurity.com/
                                      twitter - billmarquette

                                      1 Reply Last reply Reply Quote 0
                                      • R
                                        rsw686
                                        last edited by

                                        @billm:

                                        @rsw686:

                                        Okay I've run into a snag. Can one of the devs tell me how I can change the url for the package manager so I can test this out?

                                        "xmlrpcbaseurl" => "www.pfsense.com",
                                            "xmlrpcpath" => "/pfSense/xmlrpc.php",

                                        in /etc/inc/globals.inc

                                        –Bill

                                        Thanks I had looked in the globals.inc before but I don't have the xmlrpc.php file. I got a copy of the xmlrpc.php and will try this out.

                                        http://cvstrac.pfsense.com/rlog?f=www/xmlrpc/xmlrpc.php

                                        1 Reply Last reply Reply Quote 0
                                        • R
                                          rsw686
                                          last edited by

                                          I got the package installer up and running on my local server. I can install the package now and have worked on the gui interface for it. I need to implement this in the backend code. Hopefully in a week I will have it committed and you all can start testing it out.

                                          1 Reply Last reply Reply Quote 0
                                          • R
                                            rsw686
                                            last edited by

                                            Tomorrow (Friday) it should be committed. I just have to add more models to the list and check a few things.

                                            The interface is shown in the above post. Its plain but gets the job done. Suggestions would be appreciated. However due to the package system generating the page theres not much more I can do unless I want to build my own configuration page, which I might work on later.

                                            Local, local monitoring with remote access, and remote monitoring are all supported.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.