I did a bunch of work on this today. It should be all set to go.

This patch is to add support for the Cyberpower RMCARD snmp cards.
I basically copied the driver for bestpower, changed the name and
updated the mib map.
I have this running on two separate systems (two separate ups's) and it
looks good.

The only thing I could not figure out was updating the Makefile.am (my
aclocal/libtools seem to be broken.) So I manually updated the
Makefile.in to get it compiled. Someone with a build environment that
works better than mine should be able to easily update the Makefile.am
(I think there are just 2 or 3 entries... just find bestpower and add a
cyberpower entry matching bestpower.)

Attached are two patches:
cyberpower-mib.patch
    - includes cyberpower-mib driver
    - updated snmp-ups man page
    - updated hcl

cyberpower-mib.makefile.patch
    - my little hacking to drivers/Makefile.in ... used just so I could
build it... only included for completness sake.

Any chances of this getting integrated into main? I tried to keep it
simple and tested.

-- 

Cheers,
Eric Schultz

CyVon.Com
P.O. Box 436
Antioch, IL   60002
Phone: +1.847.380.2144
Fax: +1.866.593.9058
Cell: +1.815.382.0936 

diff -Naur nut-2.6.2/data/driver.list.in nut-2.6.2.cyber//data/driver.list.in
--- nut-2.6.2/data/driver.list.in	2011-09-15 06:30:44.000000000 -0500
+++ nut-2.6.2.cyber//data/driver.list.in	2011-11-30 10:59:21.739411402 -0600
@@ -159,6 +159,11 @@
 "Cyber Power Systems"	"ups"	"2"	"CP1000AVRLCD"	"USB"	"usbhid-ups"
 "Cyber Power Systems"	"ups"	"2"	"CP1350AVRLCD"	"USB"	"usbhid-ups"
 "Cyber Power Systems"	"ups"	"2"	"CP1500AVRLCD"	"USB"	"usbhid-ups"
+"Cyber Power Systems"	"ups"	"2"	"RMCARD100"	""	"snmp-ups cyberpower"
+"Cyber Power Systems"	"ups"	"2"	"RMCARD201"	""	"snmp-ups cyberpower"
+"Cyber Power Systems"	"ups"	"2"	"RMCARD202"	""	"snmp-ups cyberpower"
+"Cyber Power Systems"	"ups"	"2"	"RMCARD301"	""	"snmp-ups cyberpower"
+
 
 "Cyclades"	"pdu"	"1"	"PM8"	"8 outlets"	"powerman-pdu (experimental)"
 "Cyclades"	"pdu"	"1"	"PM10"	"10 outlets"	"powerman-pdu (experimental)"
diff -Naur nut-2.6.2/docs/man/snmp-ups.8 nut-2.6.2.cyber//docs/man/snmp-ups.8
--- nut-2.6.2/docs/man/snmp-ups.8	2011-09-15 06:35:24.000000000 -0500
+++ nut-2.6.2.cyber//docs/man/snmp-ups.8	2011-11-30 10:56:26.619411384 -0600
@@ -80,6 +80,11 @@
 .RS 4
 HP/Compaq AF401A management card, perhaps others
 .RE
+.PP
+\fBcyberpower\fR
+.RS 4
+Cyberpower RMCARD201. Should also support RMCARD100 (net version), RMCARD202 and RMCARD301
+.RE
 .SH "EXTRA ARGUMENTS"
 .sp
 This driver supports the following optional settings in the \fBups.conf\fR(5):
diff -Naur nut-2.6.2/docs/man/snmp-ups.txt nut-2.6.2.cyber//docs/man/snmp-ups.txt
--- nut-2.6.2/docs/man/snmp-ups.txt	2011-09-15 06:30:44.000000000 -0500
+++ nut-2.6.2.cyber//docs/man/snmp-ups.txt	2011-11-30 10:54:22.729411372 -0600
@@ -46,6 +46,9 @@
 *cpqpower*::
 HP/Compaq AF401A management card, perhaps others
 
+*cyberpower*::
+Cyberpower RMCARD201. Should also support RMCARD100 (net version), RMCARD202 and RMCARD301
+
 EXTRA ARGUMENTS
 ---------------
 
diff -Naur nut-2.6.2/drivers/cyberpower-mib.c nut-2.6.2.cyber//drivers/cyberpower-mib.c
--- nut-2.6.2/drivers/cyberpower-mib.c	1969-12-31 18:00:00.000000000 -0600
+++ nut-2.6.2.cyber//drivers/cyberpower-mib.c	2011-11-30 10:32:35.000000000 -0600
@@ -0,0 +1,92 @@
+/*  cyberpower-mib.c - data to monitor Cyberpower RMCARD
+ *
+ *  Copyright (C) 2010 - Eric Schultz <[email protected]>
+ *  
+ *  derived (i.e. basically copied and modified) of bestpower by:
+ *  Copyright (C) 2010 - Arnaud Quette <[email protected]>
+ *
+ *  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 "cyberpower-mib.h"
+
+#define CYBERPOWER_MIB_VERSION		"1.5"
+/* 
+#define CYBERPOWER_OID_MODEL_NAME	".1.3.6.1.4.1.2947.1.1.2.0"
+*/
+#define CYBERPOWER_OID_MODEL_NAME	".1.3.6.1.4.1.3808.1.1.1.1.1.1.0"
+
+/* TODO: find the right sysOID for this MIB
+ * #define BESTPOWER_SYSOID			".1.3.6.1.4.1.2947???"
+ */
+
+static info_lkp_t cyberpower_power_status[] = {
+	{ 2, "OL" },
+	{ 3, "OB" },
+	{ 4, "OL" },
+	{ 5, "OL" },
+	{ 7, "OL" },
+	{ 1, "NULL" },
+	{ 6, "NULL" },
+	{ 0, "NULL" }
+} ;
+
+/* Snmp2NUT lookup table for CyberPower MIB */
+static snmp_info_t cyberpower_mib[] = {
+	/* Device page */
+	{ "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ups",
+		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
+
+	{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "CYBERPOWER",
+		SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL },
+	/*.1.3.6.1.4.1.2947.1.1.1.0 = STRING: "Ferrups"
+	.1.3.6.1.4.1.2947.1.1.2.0 = STRING: "FE850VA"*/
+	{ "ups.model", ST_FLAG_STRING, SU_INFOSIZE, CYBERPOWER_OID_MODEL_NAME,
+		"Best Ferrups", SU_FLAG_STATIC, NULL, NULL },
+
+	{ "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.3.0",
+		"", SU_FLAG_STATIC, NULL },
+	{ "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.1.0",
+		"", SU_FLAG_STATIC,   NULL },
+/*
+	{ "ups.power", 0, 1, ".1.3.6.1.4.1.2947.1.1.3.0", "", 
+		0, NULL },
+*/
+	{ "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.2.0", "",
+		0, NULL },
+
+	{ "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.4.1.1.0", "",
+		0 /*SU_STATUS_PWR*/, &cyberpower_power_status[0] },
+
+	/* Battery runtime is expressed in minutes */
+	{ "battery.runtime", 0, 60.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.4.0", "",
+		0, NULL },
+	/* The elapsed time in seconds since the
+	 * UPS has switched to battery power */
+	{ "battery.runtime.elapsed", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.1.2.0", "",
+		0, NULL },
+	{ "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.2.2.2.0", "",
+		0, NULL },
+	{ "battery.current", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.2.2.7.0", "",
+		0, NULL },
+
+	/* end of structure. */
+	{ NULL, 0, 0, NULL, NULL, 0, NULL, NULL }
+} ;
+
+mib2nut_info_t	cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, "",
+	CYBERPOWER_OID_MODEL_NAME, cyberpower_mib };
diff -Naur nut-2.6.2/drivers/cyberpower-mib.h nut-2.6.2.cyber//drivers/cyberpower-mib.h
--- nut-2.6.2/drivers/cyberpower-mib.h	1969-12-31 18:00:00.000000000 -0600
+++ nut-2.6.2.cyber//drivers/cyberpower-mib.h	2011-11-30 10:02:21.000000000 -0600
@@ -0,0 +1,9 @@
+#ifndef CYBERPOWER_MIB_H
+#define CYBERPOWER_MIB_H
+
+#include "main.h"
+#include "snmp-ups.h"
+
+extern mib2nut_info_t	cyberpower;
+
+#endif /* CYBERPOWER_MIB_H */
diff -Naur nut-2.6.2/drivers/snmp-ups.c nut-2.6.2.cyber//drivers/snmp-ups.c
--- nut-2.6.2/drivers/snmp-ups.c	2011-09-15 06:30:45.000000000 -0500
+++ nut-2.6.2.cyber//drivers/snmp-ups.c	2011-11-30 10:02:36.000000000 -0600
@@ -44,6 +44,7 @@
 #include "baytech-mib.h"
 #include "compaq-mib.h"
 #include "bestpower-mib.h"
+#include "cyberpower-mib.h"
 #include "ietf-mib.h"
 
 static mib2nut_info_t *mib2nut[] = {
@@ -58,6 +59,7 @@
 	&baytech,
 	&compaq,
 	&bestpower,
+	&cyberpower,
 	/*
 	 * Prepend vendor specific MIB mappings before IETF, so that
 	 * if a device supports both IETF and vendor specific MIB,
diff -Naur nut-2.6.2/drivers/Makefile.in nut-2.6.2.cyber//drivers/Makefile.in
--- nut-2.6.2/drivers/Makefile.in	2011-09-15 06:33:22.000000000 -0500
+++ nut-2.6.2.cyber//drivers/Makefile.in	2011-11-30 10:04:11.000000000 -0600
@@ -335,7 +335,7 @@
 	baytech-mib.$(OBJEXT) compaq-mib.$(OBJEXT) eaton-mib.$(OBJEXT) \
 	ietf-mib.$(OBJEXT) mge-mib.$(OBJEXT) netvision-mib.$(OBJEXT) \
 	powerware-mib.$(OBJEXT) raritan-pdu-mib.$(OBJEXT) \
-	bestpower-mib.$(OBJEXT)
+	bestpower-mib.$(OBJEXT) cyberpower-mib.$(OBJEXT)
 snmp_ups_OBJECTS = $(am_snmp_ups_OBJECTS)
 snmp_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1)
 am_solis_OBJECTS = solis.$(OBJEXT)
@@ -727,7 +727,7 @@
 # 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
+ bestpower-mib.c cyberpower-mib.c
 
 snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS)
 
@@ -760,7 +760,7 @@
 # tracking (which is automatic), but to ensure these files are
 # distributed by "make dist".
 dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h	\
- bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \
+ bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h cyberpower-mib.h blazer.h cps-hid.h dstate.h \
  dstate-hal.h dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.h	\
  hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h libusb.h liebert-hid.h	\
  main.h main-hal.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.h		\
@@ -1092,6 +1092,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfcom.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfortress.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestpower-mib.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyberpower-mib.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestuferrups.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestups.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer.Po@am__quote@
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev

Reply via email to