FreeNAS with APC UPS

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
I am trying to find out if FreeNAS supports the APC (UPS) network shutdown client (over a network connection) or does it need to be connected (to the UPS) via USB/Serial?

I just recently got owned in not realizing that the built in network connection for my APC "Smart" UPS is actually only for remote monitoring, and that I need another network card in the UPS to allow the UPS to shutdown devices in my network using a network connection (as opposed to a serial/USB). So before I go that route I wanted to see if the same was true for FreeNAS (or if it would be able to support a network driven shutdown command).

Thanks in advance
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
FreeNAS uses NUT (Network UPS tools) and can receive input from the UPS over USB and provide a signal out over the network to other systems telling them to shutdown. The same software can also be configured to receive a signal from the network telling FreeNAS to shutdown. I have only configured FreeNAS to receive that signal from other FreeNAS systems, so it does work, but I can't say if it will receive what it needs from the APC UPS via the network.
You might want to check your specific model in the compatibility list:
https://networkupstools.org/stable-hcl.html
 

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
Thanks Chirs - Following your link, it says it has support for my version of the APC with a AP9630 SNMP monitoring card. When I get back home I should check to see if the driver that is listed is one that shows up in the FreeNAS services section (under the UPS). I do want to keep it simple, just to have the UPS send out a signal (over the network) to the server and the FreeNas to shut down. Guess I might need to buy one just to test it out to see what happens.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I'm connected to my APC UPS (see my sig for the exact model) using the AP9631 card installed in it. It works well.
 

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
Dan, just to confirm, by "working well" you mean that when the UPS goes onto battery (or is close to running out), it sends a signal to the FreeNas to shut down? And it looks like your UPS model is pretty similar to mine. Do you mind sharing the FreeNAS UPS options that you used? There were a bunch of APC driver options so this would save me some time.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It definitely signals the FreeNAS box that it's on battery--I've never had an outage last long enough to signal a low-battery condition and power down the server, so I can't speak to that from my own experience, but the communication is definitely working. These are my settings; everything else except the notification email address is at default:
1558462820000.png

My UPS has a hostname on my network of "ups1" (at one point I'd been thinking there would be another UPS which would be ups2, but that didn't actually happen).
 

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
Thanks Dan - I ordered the APC network card so once I get it I will test this out. As a side, was quite annoyed that the SmartUPS (which comes with a "Network" port) can only be used for remote monitoring of the UPS through the web, as opposed to being able to use that network port as a way for the UPS to contact devices on the network. Oh well, once the new card shows up I will test it out using your settings as the base (and modify where may be necessary). I will let you know how it goes.
 

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
Dan, my APC NMC card showed up, and I installed it and was able to see it through the network by my server (so I sort've assumed the NAS can see it).

What I am not sure of now is both for the identifier, and the port, what the correct setting should be.

For the identifier, is this some logical identifier (i.e do I need to find it in some network setting somewhere) - I am guessing that should be the case but I haven't found documentation on what the format/what that field is looking for.

And then for the port, it should be a network port, and I only have options for /dev/cuau1 or 0, and /dev/ugen0.1, 1.1, 1.2 and 0.2, 1.2, 2.2 - all of the googling I have found for these appear to point to USB ports. And anything I try to set (wont let me leave it blank) it says "driver failed to restart"

Thoughts?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
The identifier is, AFAIK, a relatively-arbitrary designator for the unit; I believe "ups" is the default, and I've left mine set there. But it looks like the screen shot I posted up-thread is a little out-of-date; -U4.1 now looks like this:
1559431858487.png

You can just type in the hostname or IP address in that field.
 

bjcsoln

Dabbler
Joined
Apr 25, 2019
Messages
15
Well, putting in an IP address of the UPS has allowed the service to start, and I am not getting the warning message in the console. Thanks Dan looks like that might've been the trick here. Will keep plugging away at it now and start trying to test it.
 

WB3FFV

Dabbler
Joined
Dec 22, 2020
Messages
27
The identifier is, AFAIK, a relatively-arbitrary designator for the unit; I believe "ups" is the default, and I've left mine set there. But it looks like the screen shot I posted up-thread is a little out-of-date; -U4.1 now looks like this:
View attachment 31121
You can just type in the hostname or IP address in that field.


I know this is an old thread, but I am trying to get the UPS driver to work with my APC SRT UPS, or with my PFsense box running apcupsd.

I looked at the above, and have walked through my driver config, and I can't locate the AP9630 monitoring driver shown. I see lots of stuff for APC, but nothing for the newest 963x cards. I have TrueNAS core 12.0-U1 running, and also on another server the new TrueNAS Scale alpha, and on neither server can I seem to get the UPS driver to work..

Any help most appreciated..
 

adcurtin

Dabbler
Joined
Feb 23, 2019
Messages
13
What error are you running into? Coincidentally, I just found this thread for a very similar issue. I previously had my APC UPS with an AP9630 working via snmp (and snmp-ups driver). Now, on truenas core 12.0-U1, I get

>Driver selected does not match local machine's driver list

when trying to save either the value that previously worked, or trying to save a new value that also uses snmp-ups.
 

WB3FFV

Dabbler
Joined
Dec 22, 2020
Messages
27
What error are you running into? Coincidentally, I just found this thread for a very similar issue. I previously had my APC UPS with an AP9630 working via snmp (and snmp-ups driver). Now, on truenas core 12.0-U1, I get

>Driver selected does not match local machine's driver list

when trying to save either the value that previously worked, or trying to save a new value that also uses snmp-ups.


When I click on the driver dropdown, or type in APC, in the list of available drivers I do not see any option for the AP9630 like shown in the images in the prior posts. I will attach an image, but also it seems like putting in an IP address where it asks for hostname or port, it always defaults to localhost, and the UPS is not local, but it seems to ignore the specified IP..


Screenshot APC 181234.png


Dec 27 18:00:36 tnas 1 2020-12-27T18:00:36.010803-05:00 tnas.xxx.net upsmon 26632 - - UPS [HURLOCK-UPS-1@localhost:3551]: connect failed: Connection failure: Connection refused

I pretty much all my servers talking with the UPS or PFsense box (using apcupsd), but this TrueNAS is for sure leaving me scratching my head..
 

adcurtin

Dabbler
Joined
Feb 23, 2019
Messages
13
sounds like the same problem. I chose "Various ups 3 (various) SNMP - RFC 1628 (snmp-ups, experimental)" from the list (in the middle of the apc listings) and got the error I previously pasted.
 

adcurtin

Dabbler
Joined
Feb 23, 2019
Messages
13
I did end up getting "Various ups 3 (various) SNMP - RFC 1628 (snmp-ups, experimental)" working. I did have to check the "Remote Monitor" checkbox, I think that fixes the listening on localhost issue.
 

Attachments

  • Screen Shot 2020-12-28 at 2.13.19 PM.png
    Screen Shot 2020-12-28 at 2.13.19 PM.png
    268.6 KB · Views: 611

revengineer

Contributor
Joined
Oct 27, 2019
Messages
193
I run a Smart-UPS 1500 and use the same driver. I did not have to check the "Remote Monitor" box. I did, however, have to set the auxiliary parameter "MAXAGE 25" for upsd.conf. (Make sure you put this in the correct "auxiliary" field.) You may also want to define a shutdown script to cleanly shut down any virtual machines. I use the one below. Good luck.

Code:
#!/bin/sh
PAUSE=1
ps auwwx | awk '/[0-9] bhyve:.*(bhyve)/ {print $2}' | while read pid
do
    kill -TERM "${pid}"
    while kill -0 "${pid}" >/dev/null 2>&1
    do
        sleep "${PAUSE}"
    done
done
exit 0
 
Top