From cea3e64babb9c198d003b4be3c5517f44f4f48c3 Mon Sep 17 00:00:00 2001 From: Craig Holyoak Date: Fri, 7 Jul 2023 11:09:59 +1000 Subject: [PATCH 1/4] Added more variables from the CyberPower MIB --- drivers/cyberpower-mib.c | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/cyberpower-mib.c b/drivers/cyberpower-mib.c index cff6d64d88..9612a6bc01 100644 --- a/drivers/cyberpower-mib.c +++ b/drivers/cyberpower-mib.c @@ -24,7 +24,7 @@ #include "cyberpower-mib.h" -#define CYBERPOWER_MIB_VERSION "0.52" +#define CYBERPOWER_MIB_VERSION "0.53" #define CYBERPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" /* CPS-MIB::ups */ @@ -70,6 +70,29 @@ static info_lkp_t cyberpower_battrepl_status[] = { { 0, NULL, NULL, NULL } }; +static info_lkp_t cyberpower_ups_status[] = { + { 1, "", NULL, NULL }, /* Normal */ + { 2, "OH", NULL, NULL }, /* Overheat */ + { 3, "HW", NULL, NULL }, /* Hardware Fault */ + { 0, NULL, NULL, NULL } +}; + +static info_lkp_t cyberpower_transfer_reasons[] = { + { 1, "noTransfer", NULL, NULL }, + { 2, "highLineVoltage", NULL, NULL }, + { 3, "brownout", NULL, NULL }, + { 4, "selfTest", NULL, NULL }, + { 0, NULL, NULL, NULL } +}; + +static info_lkp_t cyberpower_testdiag_results[] = { + { 1, "Ok", NULL, NULL }, + { 2, "Failed", NULL, NULL }, + { 3, "InvalidTest", NULL, NULL }, + { 4, "TestInProgress", NULL, NULL }, + { 0, NULL, NULL, NULL } +}; + /* Snmp2NUT lookup table for CyberPower MIB */ static snmp_info_t cyberpower_mib[] = { @@ -86,6 +109,8 @@ static snmp_info_t cyberpower_mib[] = { SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, CYBERPOWER_OID_MODEL_NAME, "CyberPower", SU_FLAG_STATIC, NULL }, + { "ups.id", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.3808.1.1.1.1.1.2.0", + "", SU_FLAG_OK | SU_FLAG_STATIC, 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 }, @@ -102,9 +127,13 @@ static snmp_info_t cyberpower_mib[] = { SU_FLAG_OK | SU_STATUS_CAL, &cyberpower_cal_status[0] }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.2.2.5.0", "", SU_FLAG_OK | SU_STATUS_RB, &cyberpower_battrepl_status[0] }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.10.1.0", "", + SU_FLAG_OK, &cyberpower_ups_status[0] }, { "ups.load", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.4.2.3.0", "", 0, NULL }, + { "ups.temperature", 0, 1, ".1.3.6.1.4.1.3808.1.1.1.10.2.0", "", SU_FLAG_OK, NULL }, + /* Battery runtime is expressed in seconds */ { "battery.runtime", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.4.0", "", 0, NULL }, @@ -128,11 +157,17 @@ static snmp_info_t cyberpower_mib[] = { 0, NULL }, { "battery.temperature", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.3.0", "", 0, NULL }, + /* upsBaseBatteryLastReplaceDate */ + { "battery.date", ST_FLAG_STRING, 8, ".1.3.6.1.4.1.3808.1.1.1.2.1.3.0", "", + SU_FLAG_OK | SU_FLAG_SEMI_STATIC, NULL }, { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.3.2.1.0", "", 0, NULL }, { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.3.2.4.0", "", 0, NULL }, + /* upsAdvanceInputLineFailCause */ + { "input.transfer.reason", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.3808.1.1.1.3.2.5.0", "", + SU_TYPE_INT | SU_FLAG_OK, &cyberpower_transfer_reasons[0] }, { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.4.2.1.0", "", 0, NULL }, @@ -171,6 +206,13 @@ static snmp_info_t cyberpower_mib[] = { { "calibrate.start", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.7.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, { "calibrate.stop", 0, 3, ".1.3.6.1.4.1.3808.1.1.1.7.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, + /* upsAdvanceTestLastDiagnosticsDate */ + { "ups.test.date", ST_FLAG_STRING, 8, ".1.3.6.1.4.1.3808.1.1.1.7.2.4.0", "", + SU_FLAG_OK | SU_FLAG_SEMI_STATIC, NULL }, + /* upsAdvanceTestDiagnosticsResults */ + { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.7.2.3.0", "", + SU_FLAG_OK, &cyberpower_testdiag_results[0] }, + /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } } ; From 76f3a97f67d14611febe6b65f922156eb08bdbdc Mon Sep 17 00:00:00 2001 From: Craig Holyoak Date: Sun, 6 Aug 2023 08:19:33 +1000 Subject: [PATCH 2/4] Moved additional ups.status to ups.alarm --- drivers/cyberpower-mib.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/cyberpower-mib.c b/drivers/cyberpower-mib.c index cbb563440f..c83395625c 100644 --- a/drivers/cyberpower-mib.c +++ b/drivers/cyberpower-mib.c @@ -75,10 +75,10 @@ static info_lkp_t cyberpower_battrepl_status[] = { { 0, NULL, NULL, NULL } }; -static info_lkp_t cyberpower_ups_status[] = { - { 1, "", NULL, NULL }, /* Normal */ - { 2, "OH", NULL, NULL }, /* Overheat */ - { 3, "HW", NULL, NULL }, /* Hardware Fault */ +static info_lkp_t cyberpower_ups_alarm_info[] = { + { 1, "", NULL, NULL }, /* Normal */ + { 2, "Temperature too high!", NULL, NULL }, /* Overheat */ + { 3, "Internal UPS fault!", NULL, NULL }, /* Hardware Fault */ { 0, NULL, NULL, NULL } }; @@ -132,13 +132,14 @@ static snmp_info_t cyberpower_mib[] = { SU_FLAG_OK | SU_STATUS_CAL, &cyberpower_cal_status[0] }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.2.2.5.0", "", SU_FLAG_OK | SU_STATUS_RB, &cyberpower_battrepl_status[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.10.1.0", "", - SU_FLAG_OK, &cyberpower_ups_status[0] }, { "ups.load", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.4.2.3.0", "", 0, NULL }, { "ups.temperature", 0, 1, ".1.3.6.1.4.1.3808.1.1.1.10.2.0", "", SU_FLAG_OK, NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.10.1.0", "", + SU_FLAG_OK, &cyberpower_ups_alarm_info[0] }, + /* Battery runtime is expressed in seconds */ { "battery.runtime", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.4.0", "", 0, NULL }, From a8f4586b0a52cb2d4950b88690eeb04394ce2841 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 13 Aug 2023 00:42:10 +0200 Subject: [PATCH 3/4] drivers/cyberpower-mib.c: bump version for new entries Signed-off-by: Jim Klimov --- drivers/cyberpower-mib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cyberpower-mib.c b/drivers/cyberpower-mib.c index c83395625c..d240b5c0ec 100644 --- a/drivers/cyberpower-mib.c +++ b/drivers/cyberpower-mib.c @@ -24,7 +24,7 @@ #include "cyberpower-mib.h" -#define CYBERPOWER_MIB_VERSION "0.53" +#define CYBERPOWER_MIB_VERSION "0.54" #define CYBERPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" /* CPS-MIB::ups */ From 4fd53afd5cb73eba28fc288e341ef47afd753423 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 13 Aug 2023 00:44:05 +0200 Subject: [PATCH 4/4] NEWS: cyberpower-mib.c supports more data points now [#1982] Signed-off-by: Jim Klimov --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 3334786ef7..17ccac1fa7 100644 --- a/NEWS +++ b/NEWS @@ -165,6 +165,7 @@ as part of https://github.com/networkupstools/nut/issues/1410 solution. of valid outlet status values [#1871] * `cyberpower-mib.c` subdriver: support devices which report the shorter Vendor OID as their sysOID, e.g. "CyberPower PowerPanel Personal" [#1997] + and support more data points including hardware status alarms [#1982] - The `bestfortress` driver shutdown handling was fixed to use a non-trivial default timeout [#1820]