OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: joeyboon on August 07, 2021, 07:34:01 pm

Title: NUT working, how do I change appliance behavior?
Post by: joeyboon on August 07, 2021, 07:34:01 pm
Hi all,

I feel stupid for asking, but I've looked everywhere. I've managed to get NUT working (on version 21.7.1) via the SNMP driver. When I click the diagnostic tab I see my UPS and the data related to the UPS. When the UPS goes on battery the event is logged in the system log.

But how do I change the behaviour of the appliance? For example, if I would like the router to shut down when the battery capacity is low, or after it's been on battery for X number of minutes? My TrueNAS also uses the SNMP driver and NUT, but has a lot more options and I've managed to get it working there. The UPS wakes up all the devices once power is restored via WOL. Hoping you can help me out :) 
Title: Re: NUT working, how do I change appliance behavior?
Post by: Koldnitz on August 07, 2021, 08:09:22 pm
Good morning.

Check these links out.  Some are distribution specific but its all NUT and differences are less than commonalities:

https://justit.eu/quick-setup-network-ups-tools-nut-server-on-debian-10/ (https://justit.eu/quick-setup-network-ups-tools-nut-server-on-debian-10/)
https://sitrepsolution.com/monitoring-a-ups-with-nut-on-debian/ (https://sitrepsolution.com/monitoring-a-ups-with-nut-on-debian/)
https://wiki.debian.org/nut (https://wiki.debian.org/nut)
https://www.howtoforge.com/monitoring-ups-power-status-with-nut-on-opensuse10.3 (https://www.howtoforge.com/monitoring-ups-power-status-with-nut-on-opensuse10.3)
https://www.reddit.com/r/synology/comments/gtkjam/use_synology_nas_as_ups_server_to_safely_power/ (https://www.reddit.com/r/synology/comments/gtkjam/use_synology_nas_as_ups_server_to_safely_power/)
https://networkupstools.org/docs/user-manual.chunked/ar01s06.html#_basic_configuration (https://networkupstools.org/docs/user-manual.chunked/ar01s06.html#_basic_configuration)

TLDR your NUT server sets up client accounts (I believe this is in uspd.user / uspd.conf) where everything you are talking about is setup.  If you want to do this from OPNSense you will need to use terminal and I am not sure if the settings will be lost on firmware upgrade.  There are also lots of comments across these forums that the FreeBSD NUT implementation is buggier than most.

I used a Synology NAS and now a Debian Linux server for control.  Everything worked great on the one power outtage I have had since configuration.  OPNsense, SynologyNAS and my Debian Linux server shutdown gracefully / came back up once power was back on.

I recommend attaching your UPS to your TrueNAS via your usb cable or whatever, and using the netclient NUT implementation in OPNSense.  Once you can see the diagnostic information, it should work according to how you have the account configured (again upsd.user file).

One thing I did learn that was documented no where on the internet, is that if you have the NUT server configured to get its IP from DHCP instead of static IP, it can affect the NUT server getting an IP address.  On Debian Linux the network was up but the IP address was configured after NUT came up so the listening address was misconfigured.  Assigning a static IP fixed this.

Cheers,
Title: Re: NUT working, how do I change appliance behavior?
Post by: joeyboon on August 07, 2021, 08:53:25 pm
Thank you for the extensive reply! I'll do my homework and try to make it work. :)