sysutils/nut: add apcupsd support (#2337)

This commit is contained in:
Nicola 2021-04-22 20:38:10 +02:00 committed by GitHub
parent e10e1fa970
commit 09c28f831e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 3 deletions

View file

@ -1,6 +1,5 @@
PLUGIN_NAME= nut
PLUGIN_VERSION= 1.7
PLUGIN_REVISION= 1
PLUGIN_VERSION= 1.8
PLUGIN_COMMENT= Network UPS Tools
PLUGIN_DEPENDS= nut
PLUGIN_MAINTAINER= m.muenz@gmail.com

View file

@ -9,6 +9,10 @@ and management interface.
Plugin Changelog
----------------
1.8
* Add apcupsd-ups driver support
1.7
* Add PowerWare bcmxcp_usb driver

View file

@ -76,6 +76,26 @@
<help>Set extra arguments for this UPS, e.g. "port=auto".</help>
</field>
</subtab>
<subtab id="nut-ups-apcupsd" description="APCUPSD-Driver">
<field>
<id>nut.apcupsd.enable</id>
<label>Enable</label>
<type>checkbox</type>
<help>Enable the APCUPSD controlled devices driver.</help>
</field>
<field>
<id>nut.apcupsd.hostname</id>
<label>Hostname</label>
<type>text</type>
<help>Set the hostname or ip of the remote apcupsd server.</help>
</field>
<field>
<id>nut.apcupsd.port</id>
<label>Port</label>
<type>text</type>
<help>Set the port of the remote apcupsd server (optional).</help>
</field>
</subtab>
<subtab id="nut-ups-bcmxcpusb" description="BCMXCPUSB-Driver">
<field>
<id>nut.bcmxcpusb.enable</id>

View file

@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/Nut</mount>
<description>Network UPS Tools</description>
<version>1.0.3</version>
<version>1.0.4</version>
<items>
<general>
<enable type="BooleanField">
@ -59,6 +59,19 @@
<Required>N</Required>
</args>
</apcsmart>
<apcupsd>
<enable type="BooleanField">
<Required>Y</Required>
<default>0</default>
</enable>
<hostname type="HostnameField">
<Required>Y</Required>
<default>localhost</default>
</hostname>
<port type="PortField">
<Required>N</Required>
</port>
</apcupsd>
<bcmxcpusb>
<enable type="BooleanField">
<Required>Y</Required>

View file

@ -20,6 +20,15 @@ driver=apcsmart
{% endfor %}
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.Nut.apcupsd.enable') and OPNsense.Nut.apcupsd.enable == '1' %}
[{{ OPNsense.Nut.general.name }}]
driver=apcupsd-ups
{% if helpers.exists('OPNsense.Nut.apcupsd.port') and OPNsense.Nut.apcupsd.port != '' %}
port={{ OPNsense.Nut.apcupsd.hostname }}:{{ OPNsense.Nut.apcupsd.port }}
{% else %}
port={{ OPNsense.Nut.apcupsd.hostname }}
{% endif %}
{% endif %}
{% if helpers.exists('OPNsense.Nut.bcmxcpusb.enable') and OPNsense.Nut.bcmxcpusb.enable == '1' %}
[{{ OPNsense.Nut.general.name }}]
driver=bcmxcp_usb

View file

@ -16,6 +16,11 @@ MONITOR {{ OPNsense.Nut.general.name }} 1 monuser {{ OPNsense.Nut.account.mon_pa
SHUTDOWNCMD "/usr/local/etc/rc.halt"
POWERDOWNFLAG /etc/killpower
{% endif %}
{% if helpers.exists('OPNsense.Nut.apcupsd.enable') and OPNsense.Nut.apcupsd.enable == '1' %}
MONITOR {{ OPNsense.Nut.general.name }} 1 monuser {{ OPNsense.Nut.account.mon_password }} master
SHUTDOWNCMD "/usr/local/etc/rc.halt"
POWERDOWNFLAG /etc/killpower
{% endif %}
{% if helpers.exists('OPNsense.Nut.bcmxcpusb.enable') and OPNsense.Nut.bcmxcpusb.enable == '1' %}
MONITOR {{ OPNsense.Nut.general.name }} 1 monuser {{ OPNsense.Nut.account.mon_password }} master
SHUTDOWNCMD "/usr/local/etc/rc.halt"