We’re running 2 “old” HP N40L Microservers at home and they’ve been working great for the last few years [I think I got them in 2011 !]

The one is running XigmaNAS  [a free NAS based on FreeBSD] and the other is running Ubuntu 18.10 [we use this to run a few Docker containers].

As we’ve been experiencing so-called “Load-shedding” again in South Africa in the last couple of months, it is imperative to have some sort of backup power to allow the servers to shutdown in a controlled manner [I’ve lost a drive on the NAS in the past due to multiple power outages/spikes :-(]

I purchased an Eaton 5E 650i UPS which has a USB interface.

I’m using the UPS on the Ubuntu machine as the “master” and on XigmaNAS, I’ve configured it as a “slave” – this means when the power goes out and the UPS is running low on battery, the “slave” will shutdown 1st and then the “master”.

Here are the steps I followed to make this work:

Step 1 – install NUT

You can find information on NUT [Network UPS Tools] on their website.

Basic step is:

sudo apt-get install nut

Step 2 – Configure

Driver setup – UPS.CONF

Now you need to configure the /etc/nut/ups.conf file
By default this file does only contains samples [in comments]
Add the following:
[EatonUPS]
    driver = usbhid-ups
    port = auto
    vendorid = 0463
    pollfreq = 30
    desc = "Eaton UPS on MyServer"
For the Eaton UPS, the driver is listed as usbhid-ups on the NUT compatibility site
port is auto for USB
I had to get the vendorid as it would not start up without specifying it.
Vendorid was checked with the following command – lsusb:
$ lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 005: ID 0463:ffff MGE UPS Systems UPS
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
So when you configure it for yourself, you can confirm the vendor ID for your own device using the lsusb command.

User access – UPSD.USERS

Now you have to configure the users who can access the service – edit the /etc/nut/upsd.users file
[upsmon]password = "your_password_goes_here"
upsmon master

[mynas]
password = "your_password_goes_here"
upsmon slave

[admin]
password = "your_password_goes_here"
actions = SET
instcmds = ALL
Format:
[username]
password – your password
and then tell upsmon whether it will be the master or slave user [slave for other ups monitoring on the network]
The [admin] user is for some UPS specific settings changes [like beeper disable – see later]

Allow for multiple monitoring points – NUT.CONF

Configure NUT as netserver – so multiple devices [like LazyNAS] can also monitor it
Edit the /etc/nut/nut.conf file and set mode to netserver [if only for local, you would make it standalone]
MODE=netserver
You now need to let the UPSD service know on which network interfaces to listen – edit /etc/nut/upsd.conf
LISTEN 127.0.0.1 3493
LISTEN 192.168.2.5
Localhost is 127.0.0.1 and our internal network interface is 192.168.2.5

TEST your configuration

Ok now to start all the stuff !
Run this command
sudo upsdrvctl start
Results when successfully started:
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Using subdriver: MGE HID 1.39
Then the moment of truth for checking the status:
Use the upsc command to connect to the service and get info on the EatonUPS UPS
upsc EatonUPS@192.168.2.5
Results:
Init SSL without certificate database
battery.charge: 100
battery.runtime: 1192
battery.type: PbAc
device.mfr: EATON
device.model: 5E 650i
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.parameter.vendorid: 0463
driver.version: 2.7.4
driver.version.data: MGE HID 1.39
driver.version.internal: 0.41
input.voltage: 241.0
outlet.1.status: on
outlet.desc: Main Outlet
outlet.id: 1
outlet.switchable: no
output.frequency: 49.9
output.frequency.nominal: 50
output.voltage: 238.0
output.voltage.nominal: 230
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 03.08.0018
ups.load: 26
ups.mfr: EATON
ups.model: 5E 650i
ups.power.nominal: 650
ups.productid: ffff
ups.start.battery: yes
ups.status: OL
ups.timer.shutdown: -1
ups.vendorid: 0463
Success ! 🙂

Step 3 – Disabling the BEEPER !

By default the beeper is set to ENABLED.
It will beep on start-up and on loss of power AND when it’s about to shutdown – NOISY !!!
So to check the current beeper status, you can run this command [on the localhost]:
upsc EatonUPS ups.beeper.status
To change the status to DISABLED, use the upscmd utility:
upscmd EatonUPS beeper.disable
Username (lazyserver): admin
Password:
OK
This would use the user [admin] /password created in the /etc/nut/upsd.users file earlier
Now the status will be disabled & it won’t disturb you when the power goes out in the middle of the night !

Step 4 – Configure XigmaNAS to also monitor this UPS as a slave device

XigmaNAS has a UPS option under Services -> UPS
screenshot 2019-01-06 at 16.25.09
Configure the following:
Mode: Slave
Identifier: EatonUPS    [this is the name as defined on the Ubuntu machine (lazyserver) for the UPS]
IP Address: 192.168.2.5 [this is the ip address of the machine with the UPS linked to via USB]
Shutdown mode: UPS reaches low battery   [ to ensure it will only shutdown after it’s been on UPS for a while & power did not come back]
Username: mynas  [as defined in the /etc/nut/upsd.users file]
Password: your_password_goes_here  [as defined in the /etc/nut/upsd.users file]
Enable the service (tickbox & save & restart) and check the logs to confirm it is working.
On homepage, you should see status in UPS section at the bottom
screenshot 2019-01-06 at 16.28.33
For more detail you can click on the “Show UPS Information” link and you will see all the detail:
screenshot 2019-01-06 at 16.29.58
That’s it !
Next steps would be to configure XigmaNAS to send you emails, etc. – but that’s standard functionality when you setup XigmaNAS – so not covered here.

References

The following links helped a lot with my setup.
Advertisements