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

Successfully monitoring a UPS connected to a Synology RS?

pfSense Packages
3
25
15.6k
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.
  • A
    AR15USR
    last edited by Sep 26, 2016, 5:08 PM

    OK the user I was using was the default master. I'll create a new user as a slave and try that. I'll change the default master passed as well. Thanks


    2.6.0-RELEASE

    1 Reply Last reply Reply Quote 0
    • A
      AR15USR
      last edited by Sep 27, 2016, 1:25 PM

      Well that successfully caused the Synology RS to not recognize the UPS anymore. I removed the added user and reset the monuser password back to default and finally after an hour got it to work again.


      2.6.0-RELEASE

      1 Reply Last reply Reply Quote 0
      • D
        dennypage
        last edited by Sep 27, 2016, 4:02 PM

        The user and password settings don't have any effect on the driver (usbhid-ups) recognizing the UPS.

        If you have a syntax error in upsd.users, this can prevent upsd from starting, but that's about it. I'd have to test to see how this manifests itself in the Synology ui.

        Can you say more about what you saw?

        1 Reply Last reply Reply Quote 0
        • A
          AR15USR
          last edited by Sep 27, 2016, 4:15 PM

          I suspect that the default user/pass is used in other locations/.conf files and changing its password in upsd.users caused probs. I started poking around and noticed the default user/pass listed in at least one of the other .conf files.

          Pretty sure I didn't have any syntax errors, I set it like this:

          
          [monuser]
                  password = zdfbgdfgsdf
                  upsmon master
          
          [remoteuser]
                  password = sdcsfewrfgwdv
                  upsmon slave
          
          

          After I updated the user/pass to the [remoteuser] in pfSense the log generated "connection refused" entries. (I'm not at home at the moment to copy/paste the exact data).

          Thanks for your help btw..


          2.6.0-RELEASE

          1 Reply Last reply Reply Quote 0
          • D
            dennypage
            last edited by Sep 27, 2016, 4:22 PM

            I'll have to connect a UPS to my Synology to test. Tomorrow night.

            Did the remote access work?

            1 Reply Last reply Reply Quote 0
            • A
              AR15USR
              last edited by Sep 27, 2016, 4:37 PM

              Not sure what you mean by "Did the remote access work?". pfSense was trying to connect to the SynologyRS but the logs said "connection refused". I do have it's IP (192.168.1.1) set in the "allowed access IP's" on the SynologyRS UPS prefs.

              I have a second Synology (411j) connecting as a UPS slave to the SynologyRS and it works perfectly with no configuration needed BTW.


              2.6.0-RELEASE

              1 Reply Last reply Reply Quote 0
              • D
                dennypage
                last edited by Sep 27, 2016, 5:24 PM

                I mean did pfSense remote access work with user "remoteuser" and password "sdcsfewrfgwdv"?

                1 Reply Last reply Reply Quote 0
                • D
                  dennypage
                  last edited by Sep 27, 2016, 6:40 PM Sep 27, 2016, 5:26 PM

                  The person that did the NUT plugin for Synology either didn't have a good understanding of NUT, or was totally focused on keeping Synology's support costs to zero. Their remote access depends upon every node using master mode which is very bad from a NUT point of view. There should be only one upsmon in master mode, the rest should be in slave mode. Also the use of a globally known password for a remote master is horrible from a security pov. The good news is that they let you edit the files, so you can fix it after the fact.

                  @AR15USR:

                  I have a second Synology (411j) connecting as a UPS slave to the SynologyRS and it works perfectly with no configuration needed BTW.

                  1 Reply Last reply Reply Quote 0
                  • A
                    AR15USR
                    last edited by Sep 27, 2016, 6:08 PM

                    @dennypage:

                    I mean did pfSense remote access work with user "remoteuser" and password "sdcsfewrfgwdv"?

                    No it didn't. Logs said "connection refused" but I think this was due to the SynologyRS not being connected to the UPS as soon as I modified the default user password in upsd.users.

                    I will try again tonight with only adding the [remoteuser] and not changing the default user password at all.


                    2.6.0-RELEASE

                    1 Reply Last reply Reply Quote 0
                    • D
                      dennypage
                      last edited by Sep 29, 2016, 4:41 AM

                      So, mixture of good news and bad news.

                      Bad news first: There is a change of behavior, which I assume is part of DSM 6.0. The change is that upsmon.conf is rewritten on each system boot. Even though upsd.users continues to not be rewritten each time, this still means that you can no longer change the default username/password of monuser/secret. Serious bummer.

                      On to the good news: Synology no longer requires master for remote monitoring. This applies to both locally hosted UPS units and remote hosted units. What this means is that you can host the UPS on pfSesnse with monuser/secret declared as a slave, and the Synology will happily connect to it even though Synology is attempting to say it's a master. You can also host the UPS on the Synology, and use it as a remote connection for pfSense. If you host the UPS on the Synology, you can either add a user to upsd.users as discussed above, or you can use the default monuser/secret.

                      Regardless of the username/password, if you host on the Synology, you need explicitly list the IP address of pfSense in the list of permitted remote hosts in the Synology (Control Panel -> Hardware & Power -> UPS). This may have been why you were getting permission denied previously.

                      Given a choice, I would host the UPS on pfSense and use remote connections on the Synology units. If you want to do this, you will need to enable remote access as described in this post.

                      For the remote user, you will need to use this in order to match the expectations of the Synology:

                      [monuser]
                       password = secret
                       upsmon slave
                      
                      

                      However if you want to host on one of the Synology units, that will work as well.

                      Hope this helps.

                      1 Reply Last reply Reply Quote 0
                      • A
                        AR15USR
                        last edited by Sep 29, 2016, 3:34 PM

                        Thanks dennypage for taking the time to look into this, much appreciated.

                        I did have the pfSense IP added into the allowable IPs on the Synology unit from the start. I'll give it another go tonight and report back..


                        2.6.0-RELEASE

                        1 Reply Last reply Reply Quote 0
                        • A
                          AR15USR
                          last edited by Sep 30, 2016, 4:11 AM

                          OK I've set it up as I understand it based on your post. Not working. Here's my settings:

                          UPS is connected to the Synology unit.

                          Setting screenshots are below.
                          SS1 = Synology unit ups.users
                          SS2 = Synology UPS Settings
                          SS3 = pfSense settings
                          SS4 = pfSense log

                          SS1.png
                          SS1.png_thumb
                          SS2.png
                          SS2.png_thumb
                          SS3.png
                          SS3.png_thumb
                          SS4.png
                          SS4.png_thumb


                          2.6.0-RELEASE

                          1 Reply Last reply Reply Quote 0
                          • D
                            dennypage
                            last edited by Sep 30, 2016, 4:33 AM

                            Can you post the MONITOR line from /usr/local/etc/nut/upsmon.conf on the pfSense box please? And the MONITOR lines from /usr/syno/etc/ups on both Synology boxes please?

                            1 Reply Last reply Reply Quote 0
                            • A
                              AR15USR
                              last edited by Sep 30, 2016, 12:56 PM

                              Sure:

                              pfSense:
                              No MONITOR line, is commented out. Also the upmon.conf is called "upsmon.conf.sample"

                              Synology 1 (has the UPS plugged in to this one):
                              MONITOR ups@localhost 1 monuser secret master

                              Synology 2
                              MONITOR ups@192.168.2.20 1 monuser secret slave


                              2.6.0-RELEASE

                              1 Reply Last reply Reply Quote 0
                              • D
                                dennypage
                                last edited by Sep 30, 2016, 5:16 PM

                                Hmm…. if there is no /usr/local/etc/nut/upsmon.conf it means that NUT is not actually configured and enabled. I'm at a loss to explain how there are upsmon error messages in the log when there is no upsmon configuration file.

                                Can you check a couple version things please?

                                pkg info | grep -i nut
                                pkg which /usr/local/etc/nut/upsmon.conf.sample
                                

                                Following that, please go to Services / UPS / Settings and press the save button. Then check contents of /usr/local/etc/nut/upsmon.conf.

                                @AR15USR:

                                pfSense:
                                No MONITOR line, is commented out. Also the upmon.conf is called "upsmon.conf.sample"

                                1 Reply Last reply Reply Quote 0
                                • A
                                  AR15USR
                                  last edited by Oct 1, 2016, 3:03 AM

                                  OK I had a thought, at the time I checked on the pfSense upsilon.conf I had the NUT package disabled because it wasn't working. Turned it back on and now there was a upsmon.conf file there. Here is its contents:

                                  MONITOR ups@192.168.2.20 1 monuser secret slave
                                  SHUTDOWNCMD "/sbin/shutdown -p +0"
                                  POWERDOWNFLAG /etc/killpower
                                  

                                  Here are the other outputs:

                                  /root: pkg info | grep -i nut
                                  nut-2.7.4_1                    Network UPS Tools
                                  pfSense-pkg-nut-2.7.4_2        Network UPS Tools
                                  
                                  
                                  : pkg which /usr/local/etc/nut/upsmon.conf
                                  /usr/local/etc/nut/upsmon.conf was not found in the database
                                  [2.3.2-RELEASE][admin@Yukon.lan]/usr/local/etc/nut: ls
                                  cmdvartab            nut.conf.sample      upsd.conf.sample     upsmon.conf          upssched.conf.sample
                                  driver.list          ups.conf.sample      upsd.users.sample    upsmon.conf.sample
                                  

                                  That result seems not right? I did ls so you could see it right there


                                  2.6.0-RELEASE

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    dennypage
                                    last edited by Oct 1, 2016, 4:28 AM

                                    @AR15USR:

                                    OK I had a thought, at the time I checked on the pfSense upsilon.conf I had the NUT package disabled because it wasn't working. Turned it back on and now there was a upsmon.conf file there. Here is its contents:

                                    MONITOR ups@192.168.2.20 1 monuser secret slave
                                    SHUTDOWNCMD "/sbin/shutdown -p +0"
                                    POWERDOWNFLAG /etc/killpower
                                    

                                    Okay, that makes much more sense.

                                    @AR15USR:

                                    : pkg which /usr/local/etc/nut/upsmon.conf
                                    /usr/local/etc/nut/upsmon.conf was not found in the database
                                    [2.3.2-RELEASE][admin@Yukon.lan]/usr/local/etc/nut: ls
                                    cmdvartab            nut.conf.sample      upsd.conf.sample     upsmon.conf          upssched.conf.sample
                                    driver.list          ups.conf.sample      upsd.users.sample    upsmon.conf.sample
                                    

                                    That result seems not right? I did ls so you could see it right there

                                    I was asking for pkg which on "/usr/local/etc/nut/upsmon.conf.sample". The sample config file should be owned by nut-2.7.4 or nut-2.7.4_1. The file "/usr/local/etc/nut/upsmon.conf" is generated by the configuration and is not owned by any package.

                                    Anyway, the remote access configuration matches the remote access configuration of the slave Synology unit. About the only thing left is that IP address of the pfSense box isn't what the master Synology box thinks it is. Or perhaps there is some a bug again in the Synology NUT configuration for remote clients. Btw, you are running DSM 6, yes?

                                    Two things you can try:

                                    1. On the master Synology, delete each permitted device and save. Disable remote the network UPS server and save. Re-enable the remote network UPS server and save. Re-add each (slave Synology and pfSense) IP address to the Synology permitted devices and save. If you have multiple local network addresses for pfSense, add them all. This is simple and easy, and I would do this first.

                                    2. On the master Synology, log in as root and run

                                    tcpdump -n port 3493
                                    

                                    You should begin seeing traffic from the slave Synology.

                                    On the pfSense box, log in as root and run

                                    /usr/local/etc/rc.d/nut.sh restart
                                    

                                    You should see upsmon on pfSense connect to upsd on the Synology.

                                    If you want to listen in on the conversation you can run tcpdump with the -A option

                                    tcpdump -n -A port 3493
                                    

                                    There will be a number of things that don't print, but you should be able to follow the gist of the conversation.

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      AR15USR
                                      last edited by Oct 1, 2016, 4:49 PM

                                      OK got it sorted out and it is working now. Much thanks for your help.

                                      I did both of your suggestions below. #1 didn't make a difference.

                                      #2, When running "tcpdump -n -A port 3493" I saw this:

                                      09:38:33.744802 IP 192.168.2.20.3493 > 192.168.2.1.61499: Flags [FP.], seq 19:37, ack 22, win 114, options [nop,nop,TS val 268312 ecr 1101366621], length 18
                                      E..FC\@.@.q............;y.O..3.....r.......
                                      ....A..]ERR ACCESS-DENIED
                                      
                                      

                                      This shows the pfSense box being denied from 192.168.2.1, I was using its actual IP of 192.168.1.1. As soon as I entered the 192.168.2.1 IP into the allowed devices on the Synology unit it worked instantly. I'm guessing it has to do with the Gateway, the Synology is on LAN 2.1 instead of 1.1.

                                      Anyhow big thanks for all your help, much appreciated.

                                      Not sure if you are still interested, but here is the output for the users.conf.sample anyhow:

                                      /root: pkg which /usr/local/etc/nut/upsmon.conf.sample
                                      /usr/local/etc/nut/upsmon.conf.sample was installed by package nut-2.7.4_1
                                      

                                      2.6.0-RELEASE

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        dennypage
                                        last edited by Oct 1, 2016, 5:26 PM

                                        No problem. Glad you got it working.

                                        1 Reply Last reply Reply Quote 0
                                        • W
                                          willrun4fun
                                          last edited by Oct 9, 2016, 9:05 AM

                                          I have a similar setup working thanks to this thread and some others.

                                          Question though, with my Synology the master as soon as it goes on battery pfsense shuts down immediately. Is there an option I can use on upsmon to make it wait until low battery reached?

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