Add an snmp-ups subdriver to NUT for Huawei, tested with UPS5000-E
Add a meta rc script that starts/stops upsd and upsmon in the right order
This commit is contained in:
parent
79c79fca32
commit
c895957b7c
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.83 2015/01/22 16:42:09 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.84 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
COMMENT-main= UPS monitoring program supporting many brands
|
||||
COMMENT-cgi= CGIs for monitoring Nut-based UPSs
|
||||
@ -6,14 +6,14 @@ COMMENT-snmp= driver for monitoring UPS via SNMP
|
||||
COMMENT-xml= driver for monitoring UPS via XML/HTTP
|
||||
|
||||
DISTNAME= nut-2.7.2
|
||||
REVISION-main= 4
|
||||
REVISION-snmp= 0
|
||||
|
||||
PKGNAME-main= ${DISTNAME}
|
||||
PKGNAME-cgi= ${DISTNAME:S/-/-cgi-/}
|
||||
PKGNAME-snmp= ${DISTNAME:S/-/-snmp-/}
|
||||
PKGNAME-xml= ${DISTNAME:S/-/-xml-/}
|
||||
|
||||
REVISION-main= 3
|
||||
|
||||
SHARED_LIBS += upsclient 3.0 # .4.0
|
||||
SHARED_LIBS += nutclient 0.0 # .0.0
|
||||
SHARED_LIBS += nutscan 1.0 # .1.0
|
||||
|
25
sysutils/nut/patches/patch-drivers_Makefile_am
Normal file
25
sysutils/nut/patches/patch-drivers_Makefile_am
Normal file
@ -0,0 +1,25 @@
|
||||
$OpenBSD: patch-drivers_Makefile_am,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
Support Huawei UPS5000-E
|
||||
|
||||
--- drivers/Makefile.am.orig Thu Feb 27 21:17:32 2014
|
||||
+++ drivers/Makefile.am Wed Mar 25 22:52:03 2015
|
||||
@@ -195,8 +195,7 @@ mge_shut_LDADD = $(LDADD)
|
||||
# SNMP
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \
|
||||
- bestpower-mib.c cyberpower-mib.c delta_ups-mib.c \
|
||||
- xppc-mib.c
|
||||
+ bestpower-mib.c cyberpower-mib.c delta_ups-mib.c xppc-mib.c huawei-mib.c
|
||||
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
|
||||
|
||||
# NEON XML/HTTP
|
||||
@@ -255,7 +254,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.
|
||||
delta_ups-mib.h nutdrv_qx.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \
|
||||
nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h \
|
||||
nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_zinto.h \
|
||||
- xppc-mib.h
|
||||
+ xppc-mib.h huawei-mib.h
|
||||
|
||||
# Define a dummy library so that Automake builds rules for the
|
||||
# corresponding object files. This library is not actually built,
|
41
sysutils/nut/patches/patch-drivers_Makefile_in
Normal file
41
sysutils/nut/patches/patch-drivers_Makefile_in
Normal file
@ -0,0 +1,41 @@
|
||||
$OpenBSD: patch-drivers_Makefile_in,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
Support Huawei UPS5000-E
|
||||
|
||||
--- drivers/Makefile.in.orig Wed Mar 25 22:52:12 2015
|
||||
+++ drivers/Makefile.in Wed Mar 25 22:52:45 2015
|
||||
@@ -379,7 +379,7 @@ am_snmp_ups_OBJECTS = snmp-ups.$(OBJEXT) apc-mib.$(OBJ
|
||||
ietf-mib.$(OBJEXT) mge-mib.$(OBJEXT) netvision-mib.$(OBJEXT) \
|
||||
powerware-mib.$(OBJEXT) raritan-pdu-mib.$(OBJEXT) \
|
||||
bestpower-mib.$(OBJEXT) cyberpower-mib.$(OBJEXT) \
|
||||
- delta_ups-mib.$(OBJEXT) xppc-mib.$(OBJEXT)
|
||||
+ delta_ups-mib.$(OBJEXT) xppc-mib.$(OBJEXT) huawei-mib.$(OBJEXT)
|
||||
snmp_ups_OBJECTS = $(am_snmp_ups_OBJECTS)
|
||||
snmp_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1)
|
||||
am_solis_OBJECTS = solis.$(OBJEXT)
|
||||
@@ -805,7 +805,7 @@ mge_shut_LDADD = $(LDADD)
|
||||
snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \
|
||||
ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \
|
||||
bestpower-mib.c cyberpower-mib.c delta_ups-mib.c \
|
||||
- xppc-mib.c
|
||||
+ xppc-mib.c huawei-mib.c
|
||||
|
||||
snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
|
||||
|
||||
@@ -854,7 +854,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.
|
||||
delta_ups-mib.h nutdrv_qx.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \
|
||||
nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h \
|
||||
nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_zinto.h \
|
||||
- xppc-mib.h
|
||||
+ xppc-mib.h huawei-mib.h
|
||||
|
||||
|
||||
# Define a dummy library so that Automake builds rules for the
|
||||
@@ -1275,6 +1275,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbhid-ups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/victronups.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xppc-mib.Po@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huawei-mib.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
241
sysutils/nut/patches/patch-drivers_huawei-mib_c
Normal file
241
sysutils/nut/patches/patch-drivers_huawei-mib_c
Normal file
@ -0,0 +1,241 @@
|
||||
$OpenBSD: patch-drivers_huawei-mib_c,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
Support Huawei UPS5000-E
|
||||
|
||||
--- drivers/huawei-mib.c.orig Wed Mar 25 22:56:19 2015
|
||||
+++ drivers/huawei-mib.c Thu Mar 26 00:58:08 2015
|
||||
@@ -0,0 +1,234 @@
|
||||
+/* huawei-mib.c - subdriver to monitor Huawei SNMP devices with NUT
|
||||
+ *
|
||||
+ * Copyright (C)
|
||||
+ * 2011 - 2012 Arnaud Quette <arnaud.quette@free.fr>
|
||||
+ * 2015 Stuart Henderson <stu@spacehopper.org>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ */
|
||||
+
|
||||
+#include "huawei-mib.h"
|
||||
+
|
||||
+#define HUAWEI_MIB_VERSION "0.1"
|
||||
+
|
||||
+#define HUAWEI_SYSOID ".1.3.6.1.4.1.8072.3.2.10"
|
||||
+#define HUAWEI_UPSMIB ".1.3.6.1.4.1.2011"
|
||||
+
|
||||
+/* To create a value lookup structure (as needed on the 2nd line of the example
|
||||
+ * below), use the following kind of declaration, outside of the present snmp_info_t[]:
|
||||
+ * static info_lkp_t onbatt_info[] = {
|
||||
+ * { 1, "OB" },
|
||||
+ * { 2, "OL" },
|
||||
+ * { 0, "NULL" }
|
||||
+ * };
|
||||
+ */
|
||||
+
|
||||
+static info_lkp_t supplymethod_info[] = {
|
||||
+ { 1, "" }, /* no supply */
|
||||
+ { 2, "OL BYPASS" },
|
||||
+ { 3, "OL" },
|
||||
+ { 4, "OB" },
|
||||
+ { 5, "" }, /* combined */
|
||||
+ { 6, "OL ECO" },
|
||||
+ { 7, "OB ECO" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t battstate_info[] = {
|
||||
+ { 1, "" }, /* not connected */
|
||||
+ { 2, "" }, /* not charging or discharging */
|
||||
+ { 3, "" }, /* hibernation */
|
||||
+ { 4, "" }, /* float */
|
||||
+ { 5, "CHRG" }, /* equalized charging */
|
||||
+ { 6, "DISCHRG" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t phase_info[] = {
|
||||
+ { 1, "1" },
|
||||
+ { 2, "3" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t voltrating_info[] = {
|
||||
+ { 1, "200" },
|
||||
+ { 2, "208" },
|
||||
+ { 3, "220" },
|
||||
+ { 4, "380" },
|
||||
+ { 5, "400" },
|
||||
+ { 6, "415" },
|
||||
+ { 7, "480" },
|
||||
+ { 8, "600" },
|
||||
+ { 9, "690" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t freqrating_info[] = {
|
||||
+ { 1, "50" },
|
||||
+ { 2, "60" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t pwrrating_info[] = {
|
||||
+ { 1, "80000" },
|
||||
+ { 2, "100000" },
|
||||
+ { 3, "120000" },
|
||||
+ { 4, "160000" },
|
||||
+ { 5, "200000" },
|
||||
+ { 6, "30000" },
|
||||
+ { 7, "40000" },
|
||||
+ { 8, "60000" },
|
||||
+ { 9, "2400000" },
|
||||
+ { 10, "2500000" },
|
||||
+ { 11, "2800000" },
|
||||
+ { 12, "3000000" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+static info_lkp_t ietf_test_result_info[] = {
|
||||
+ { 1, "done and passed" },
|
||||
+ { 2, "done and warning" },
|
||||
+ { 3, "done and error" },
|
||||
+ { 4, "aborted" },
|
||||
+ { 5, "in progress" },
|
||||
+ { 6, "no test initiated" },
|
||||
+ { 0, "NULL" }
|
||||
+};
|
||||
+
|
||||
+
|
||||
+/* HUAWEI Snmp2NUT lookup table */
|
||||
+static snmp_info_t huawei_mib[] = {
|
||||
+
|
||||
+ /* Data format:
|
||||
+ * { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar },
|
||||
+ *
|
||||
+ * info_type: NUT INFO_ or CMD_ element name
|
||||
+ * info_flags: flags to set in addinfo
|
||||
+ * info_len: length of strings if STR
|
||||
+ * cmd value if CMD, multiplier otherwise
|
||||
+ * OID: SNMP OID or NULL
|
||||
+ * dfl: default value
|
||||
+ * flags: snmp-ups internal flags (FIXME: ...)
|
||||
+ * oid2info: lookup table between OID and NUT values
|
||||
+ * setvar: variable to set for SU_FLAG_SETINT
|
||||
+ *
|
||||
+ * Example:
|
||||
+ * { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL },
|
||||
+ * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info },
|
||||
+ *
|
||||
+ * To create a value lookup structure (as needed on the 2nd line), use the
|
||||
+ * following kind of declaration, outside of the present snmp_info_t[]:
|
||||
+ * static info_lkp_t onbatt_info[] = {
|
||||
+ * { 1, "OB" },
|
||||
+ * { 2, "OL" },
|
||||
+ * { 0, "NULL" }
|
||||
+ * };
|
||||
+ */
|
||||
+
|
||||
+ /* UPS page */
|
||||
+
|
||||
+ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Huawei", SU_FLAG_ABSENT | SU_FLAG_OK, NULL },
|
||||
+ { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.2.1", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
+ { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.1.1.2.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "ups.time", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.11.1.0", NULL, SU_FLAG_OK, NULL }, /* seconds since epoch */
|
||||
+
|
||||
+ { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.3.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
+ { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.5.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.1.1", NULL, SU_FLAG_OK, supplymethod_info },
|
||||
+ { "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.3.1", NULL, SU_STATUS_BATT | SU_FLAG_OK, battstate_info },
|
||||
+
|
||||
+ { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, ietf_test_result_info },
|
||||
+
|
||||
+
|
||||
+ /* Input page */
|
||||
+
|
||||
+ /* hwUpsCtrlInputStandard listed in MIB but not present on tested UPS5000-E */
|
||||
+ { "input.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.8", "3", SU_FLAG_ABSENT | SU_FLAG_OK, phase_info },
|
||||
+
|
||||
+ { "input.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "input.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "input.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.5.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.6.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.7.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "input.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.8.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.9.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.L3.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.10.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "input.bypass.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.bypass.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "input.bypass.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "input.bypass.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+
|
||||
+ /* Output page */
|
||||
+
|
||||
+ /* hwUpsCtrlOutputStandard listed in MIB but not present on tested UPS5000-E */
|
||||
+ { "output.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.9", "3", SU_FLAG_ABSENT | SU_FLAG_OK, phase_info },
|
||||
+
|
||||
+ { "output.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.5.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.6.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.7.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.8.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.9.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.10.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.L1.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.11.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.12.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L3.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.13.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.L1.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.14.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.15.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L3.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.16.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+ { "output.voltage.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.17.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, voltrating_info },
|
||||
+ { "output.frequency.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.18.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, freqrating_info },
|
||||
+ { "output.power.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.6.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, pwrrating_info },
|
||||
+
|
||||
+ { "output.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.19.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.20.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.21.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+
|
||||
+ /* Battery page */
|
||||
+
|
||||
+ { "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.1.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "battery.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.2.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "battery.charge", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.3.1", NULL, SU_FLAG_OK, NULL },
|
||||
+ { "battery.runtime", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.4.1", NULL, SU_FLAG_OK, NULL },
|
||||
+
|
||||
+
|
||||
+ /* { "unmapped.hwUpsBattTest", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.103.101.1.6.1", NULL, SU_FLAG_OK, NULL }, */
|
||||
+
|
||||
+
|
||||
+ /* end of structure. */
|
||||
+ { NULL, 0, 0, NULL, NULL, 0, NULL }
|
||||
+};
|
||||
+
|
||||
+mib2nut_info_t huawei = { "huawei", HUAWEI_MIB_VERSION, NULL, NULL, huawei_mib, HUAWEI_SYSOID };
|
16
sysutils/nut/patches/patch-drivers_huawei-mib_h
Normal file
16
sysutils/nut/patches/patch-drivers_huawei-mib_h
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-drivers_huawei-mib_h,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
Support Huawei UPS5000-E
|
||||
|
||||
--- drivers/huawei-mib.h.orig Wed Mar 25 22:56:19 2015
|
||||
+++ drivers/huawei-mib.h Wed Mar 25 22:56:27 2015
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef HUAWEI_MIB_H
|
||||
+#define HUAWEI_MIB_H
|
||||
+
|
||||
+#include "main.h"
|
||||
+#include "snmp-ups.h"
|
||||
+
|
||||
+extern mib2nut_info_t huawei;
|
||||
+
|
||||
+#endif /* HUAWEI_MIB_H */
|
33
sysutils/nut/patches/patch-drivers_snmp-ups_c
Normal file
33
sysutils/nut/patches/patch-drivers_snmp-ups_c
Normal file
@ -0,0 +1,33 @@
|
||||
$OpenBSD: patch-drivers_snmp-ups_c,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
Support Huawei UPS5000-E
|
||||
|
||||
--- drivers/snmp-ups.c.orig Wed Feb 26 20:48:36 2014
|
||||
+++ drivers/snmp-ups.c Wed Mar 25 22:50:37 2015
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "bestpower-mib.h"
|
||||
#include "cyberpower-mib.h"
|
||||
#include "delta_ups-mib.h"
|
||||
+#include "huawei-mib.h"
|
||||
#include "ietf-mib.h"
|
||||
#include "xppc-mib.h"
|
||||
|
||||
@@ -72,7 +73,8 @@ static mib2nut_info_t *mib2nut[] = {
|
||||
&bestpower,
|
||||
&cyberpower,
|
||||
&delta_ups,
|
||||
- &xppc,
|
||||
+ &xppc,
|
||||
+ &huawei,
|
||||
/*
|
||||
* Prepend vendor specific MIB mappings before IETF, so that
|
||||
* if a device supports both IETF and vendor specific MIB,
|
||||
@@ -100,7 +102,7 @@ const char *mibvers;
|
||||
static void disable_transfer_oids(void);
|
||||
|
||||
#define DRIVER_NAME "Generic SNMP UPS driver"
|
||||
-#define DRIVER_VERSION "0.72"
|
||||
+#define DRIVER_VERSION "0.73"
|
||||
|
||||
/* driver description structure */
|
||||
upsdrv_info_t upsdrv_info = {
|
@ -1,4 +1,4 @@
|
||||
@comment $OpenBSD: PLIST-main,v 1.22 2014/08/14 06:54:24 ajacoutot Exp $
|
||||
@comment $OpenBSD: PLIST-main,v 1.23 2015/03/26 01:07:32 sthen Exp $
|
||||
@conflict nut-<2.6.2p0
|
||||
@conflict nut-scanner-*
|
||||
@conflict upsd-*
|
||||
@ -241,5 +241,6 @@ share/examples/nut/upsset.conf.sample
|
||||
share/ups/
|
||||
share/ups/cmdvartab
|
||||
share/ups/driver.list
|
||||
@rcscript ${RCDIR}/nut
|
||||
@rcscript ${RCDIR}/upsd
|
||||
@rcscript ${RCDIR}/upsmon
|
||||
|
24
sysutils/nut/pkg/nut.rc
Normal file
24
sysutils/nut/pkg/nut.rc
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $OpenBSD: nut.rc,v 1.1 2015/03/26 01:07:32 sthen Exp $
|
||||
|
||||
# "meta" script running the following rc.d(8) scripts with the given argument;
|
||||
# note that daemon_flags, daemon_user and daemon_class are not passed to
|
||||
# the child scripts.
|
||||
|
||||
if [ "$1" = restart ]; then
|
||||
$0 stop && $0 start
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = stop ]; then
|
||||
_pkg_scripts="upsmon upsd"
|
||||
else
|
||||
_pkg_scripts="upsd upsmon"
|
||||
fi
|
||||
|
||||
for _i in ${_pkg_scripts}; do
|
||||
if [[ -x ${RCDIR}/${_i} ]]; then
|
||||
${RCDIR}/${_i} $@ || exit $?
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user