Uninterruptible Power Supply (UPS) support

Started by schnipp, March 28, 2018, 07:51:00 PM

Previous topic - Next topic
This is a follow up topic of UPS (Uninterruptible Power Supply) related discussion from https://forum.opnsense.org/index.php?topic=7480.msg35033#msg35033



OPNsense 24.7.11_2-amd64

Now, NUT is in running in client mode with a synology diskstation as master. After some debugging NUT is communicating with the UPS daemon. I found out that spaces in the name input field (Nut -> UPS Type -> Netclient) breaks config file scheme.

When disrupting power the ups monitor correctly broadcasts its messages on the console (see below)

    Broadcast Message from root@opnsense.fritz.box
            (no tty) at 17:34 CEST...
    UPS ups@x.x.x.x on battery
   
    Broadcast Message from root@opnsense.fritz.box
            (no tty) at 17:34 CEST...
    UPS ups@x.x.x.x on line power


But, where can I configure additional parameters (voltage, timeout etc.) for tiggering events and what kind of events are supported beside powering down the machine?
OPNsense 24.7.11_2-amd64

Quote from: mimugmail on March 28, 2018, 07:48:11 PM
Can you run some commands like upsc to retrieve some values? I need them to build a status tab.

Where did you configure these values in pf?

Of course, during debugging I tested some commands of the NUT protocol in a raw telnet session connected to the ups master daemon. But, I think we should use the middleware. So, what commands may I use to retrieve information?
OPNsense 24.7.11_2-amd64


Here we go...

root@opnsense:~ # upsc ups@10.3.0.2
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 3312
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 16.0
battery.voltage.nominal: 24
device.mfr: CP900EPFCLCD
device.model: CRIB101.6M2
device.serial: CPS
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 5
driver.parameter.port: auto
driver.version: SDS6-0-8700-factory-repack-8700-170413
driver.version.data: CyberPower HID 0.3
driver.version.internal: 0.38
input.transfer.high: 260
input.transfer.low: 170
input.voltage: 225.0
input.voltage.nominal: 230
output.voltage: 260.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 8
ups.mfr: CP900EPFCLCD
ups.model: CRIB101.6M2
ups.productid: 0501
ups.realpower.nominal: 540
ups.serial: CPS
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: -60
ups.timer.start: -60
ups.vendorid: 0764


Please consider that variables not supported by my UPS are not displayed. Further information can be found here (esp. appendix A): http://networkupstools.org/docs/developer-guide.chunked/

OPNsense 24.7.11_2-amd64

remote commands supported by the ups (for security reasons blocked by the master daemon due to missing permissions):

root@opnsense:~ # upscmd -l ups@10.3.0.2
Instant commands supported on UPS [ups]:

beeper.disable - Description unavailable
beeper.enable - Description unavailable
beeper.mute - Description unavailable
beeper.off - Description unavailable
beeper.on - Description unavailable
load.off - Description unavailable
load.off.delay - Description unavailable
load.on - Description unavailable
load.on.delay - Description unavailable
shutdown.return - Description unavailable
shutdown.stayoff - Description unavailable
shutdown.stop - Description unavailable
test.battery.start.deep - Description unavailable
test.battery.start.quick - Description unavailable
test.battery.stop - Description unavailable
OPNsense 24.7.11_2-amd64

Cool! I'll build a page for this.

Regarding commands and parameters .. is it possible you join IRC channel? Would be quite easier to exchange.

Quote from: mimugmail on March 29, 2018, 10:14:13 AM
Cool! I'll build a page for this.

Regarding commands and parameters .. is it possible you join IRC channel? Would be quite easier to exchange.

Great idea. Unfortunately, this will be difficult for me the next time due to high work load  :(
OPNsense 24.7.11_2-amd64

@mimugmail: Can you give me an hint, when the next update (> v.0.3) is out and I can perform some tests? Thanks.
OPNsense 24.7.11_2-amd64

18.1.7 will include 0.4 .. still without Diagnostics but working Setup for stabdalone and usbhid Driver. Also remote should be stable then.

May 04, 2018, 06:57:33 AM #10 Last Edit: May 04, 2018, 09:51:14 AM by mimugmail
With latest 18.1.7 there's 0.6, with support for standalone, netserver via NAT and netclient. Also a diagnostics page is included. Please test so this plugin can go stable  8)

After update I had re-enter the ups name. Now it runs fine in netclient mode and also the diagnostics page shows the attributes and their values.

But the dashboard says that nut is not running, which is not the case.
OPNsense 24.7.11_2-amd64


Quote from: mimugmail on May 06, 2018, 03:31:50 PM
Nut is indeed not running, only upsmon at the bottom.

You are right. For me it's a little bit confusing that the services pane shows nut is not running.
OPNsense 24.7.11_2-amd64

For me too, but I cant solve it better for now. If it's working for you one reason more to go for 1.0