OPNsense Forum

English Forums => General Discussion => Topic started by: schnipp on March 28, 2018, 07:51:00 pm

Title: Uninterruptible Power Supply (UPS) support
Post by: schnipp on March 28, 2018, 07:51:00 pm
This is a follow up topic of UPS (Uninterruptible Power Supply) related discussion from https://forum.opnsense.org/index.php?topic=7480.msg35033#msg35033 (https://forum.opnsense.org/index.php?topic=7480.msg35033#msg35033)



Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on March 28, 2018, 07:52:26 pm
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?
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on March 28, 2018, 07:58:42 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?
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on March 28, 2018, 08:42:27 pm
man upsc I'd guess
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on March 29, 2018, 09:34:24 am
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/

Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on March 29, 2018, 09:40:36 am
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
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: 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.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on April 05, 2018, 06:05:31 pm
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  :(
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on April 15, 2018, 05:00:03 pm
@mimugmail: Can you give me an hint, when the next update (> v.0.3) is out and I can perform some tests? Thanks.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on April 15, 2018, 06:26:44 pm
18.1.7 will include 0.4 .. still without Diagnostics but working Setup for stabdalone and usbhid Driver. Also remote should be stable then.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on May 04, 2018, 06:57:33 am
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)
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on May 06, 2018, 02:48:35 pm
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.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on May 06, 2018, 03:31:50 pm
Nut is indeed not running, only upsmon at the bottom.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: schnipp on May 06, 2018, 04:30:21 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.
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on May 06, 2018, 05:10:02 pm
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
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: franco on May 06, 2018, 07:04:35 pm
We can solve this in the service logic in nut.inc -- it needs to be adjusted slightly to how/when nut and upsmon are used. Please drop a comment here:

https://github.com/opnsense/plugins/commit/5b110ffbe192ebbd9ef8eafe9f80588dbbdcc67e#r28620640

The change was that upsmon always runs, but nut only in the other case... right?


Cheers,
Franco
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: mimugmail on May 06, 2018, 08:29:17 pm
Correct
Title: Re: Uninterruptible Power Supply (UPS) support
Post by: franco on May 07, 2018, 12:12:32 am
https://github.com/opnsense/plugins/commit/448f4e1c

# opnsense-patch -c plugins 448f4e1c


Cheers,
Franco