Manually configuring NUT
-
Hi all,
While trying to setup my UPS for pfSense, I found that my device was not listed in the dropdown of supported UPSes.
First of all, a small suggestion to developers, could you please add the option to force the usage of a specific driver? The option to choose your UPS from the list works fine for users that have a UPS on that list. NUT supports a massive range of UPSes, and I imagine that maintaining this list in the package is at the bottom of their priorities. As such, the option to manually choose the driver would allow us to select the appropriate driver if we do not have a UPS on that list.
I found some blog posts about changing the config for pfSense 2.0, and noticed that for versions greater than 2.0, the nut configuration folder has changed!
This is in the code for /usr/local/pkg/nut.inc
if (substr(trim(file_get_contents("/etc/version")),0,3) == "2.0") { define('NUT_DIR','/usr/local/etc/nut'); } else { define('NUT_DIR', '/usr/pbi/nut-' . php_uname("m") . '/etc/nut'); }
I.e., if you are running pfSense version 2.1 or greater, you have to use the /usr/pbi/nut-amd64/etc/nut directory (for 64-bit pfSense, not sure for 32-bit).
Also, if you want your settings to be persistent over reboots, change the following line:
define('NUT_DIR', '/usr/pbi/nut-' . php_uname("m") . '/etc/nut');
to
define('NUT_DIR', '/usr/pbi/nutfake-' . php_uname("m") . '/etc/nut');
This will give you an error message if you try to save the settings in the web interface, so all NUT modifications have to be done from the shell from now on.
Step by step guide for configuring a PowerWalker VI1200 UPS.
1. Open an SSH shell to your pfSense box
2. Change to the console (Press 8 )
3. Change to the nut config folder```
cd /usr/pbi/nut-amd64/etc/nut4\. Configure the UPS``` vi ups.conf
Change the settings accordingly, for me they were:
user=root [pwups] driver=blazer_usb port=auto
5. Change the listing interface for the NUT server```
vi upsd.confLISTEN 127.0.0.1 3493
LISTEN 192.168.4.1 3493It defaults to 127.0.0.1\. I added my LAN interface aswell. 6\. Verify that nut is running in server mode``` vi nut.conf
It should be:```
MODE=netserver7\. Add users for remote access``` vi upsd.users
[admin] password = xxxxxxxxxxxxxxxxx upsmon master [monitor] password = yyyyyyyyyyyyyyyyy upsmon slave
I added one user for pfsense (upsmon master) and one user for slaves (secondary computers also running on the UPS).
8. Check that the nut monitoring configuration has the same username and connects one of the interfaces you chose earlier```
vi upsmon.confMONITOR pwups@127.0.0.1 1 admin xxxxxxxxxxxxxx master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
POWERDOWNFLAG /etc/killpower9\. Restart nut``` /usr/local/etc/rc.d/nut.sh restart
10. Set up a CRON job to restart the nut server regularly. It is pretty unstable, and frequently looses connection to the UPS.
crontab -e
*/15 * * * * /usr/local/etc/rc.d/nut.sh restart
Or do it via the CRON web interface.
11. Check that nut is running
upsc pwups@127.0.0.1
You should get a similar output:
battery.charge: 100 battery.voltage: 27.20 battery.voltage.high: 26.00 battery.voltage.low: 20.80 battery.voltage.nominal: 24.0 device.type: ups driver.name: blazer_usb driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.6.5 driver.version.internal: 0.09 input.current.nominal: 5.0 input.frequency: 49.8 input.frequency.nominal: 50 input.voltage: 240.1 input.voltage.fault: 240.1 input.voltage.nominal: 230 output.voltage: 240.1 ups.beeper.status: enabled ups.delay.shutdown: 30 ups.delay.start: 180 ups.load: 38 ups.productid: 5161 ups.status: OL ups.type: offline / line interactive ups.vendorid: 0665
Check up: http://xorl.wordpress.com/2011/06/05/how-to-pfsense-nut-ups-monitoring-with-email-notification/
for more advanced configs. Not posted by me, but I used it to get started :)
-
I am using TS SHARA 1200 UPS, I have found a linux driver and copied to "/usr/pbi/nut-i386/bin/tsshara_usb" and created a link "/usr/pbi/bin/libexec/nut/tsshara_usb -> /usr/pbi/nut-i386/bin/tsshara_usb". I have added in the end of the file driver.list "TS Shara" "ups" "3" "UPS 1200VA" "" "tsshara_usb". But I can not see the TS Shara option in the NUT settings. What am I doing wrong? :-\