Skip to content

Commit 6c08c8b

Browse files
committed
drivers/vertiv-mib.c: refine ups.status [#3299]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 79389ad commit 6c08c8b

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

drivers/vertiv-mib.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,30 @@ static info_lkp_t vertiv_beeper_status_info[] = {
5050
info_lkp_sentinel
5151
};
5252

53+
/* FIXME: the below may introduce status redundancy, that needs to be
54+
* addressed by the driver, as for usbhid-ups! */
55+
/*
56+
* DESCRIPTION
57+
* The present source of output power. The enumeration
58+
* none(2) indicates that there is no source of output
59+
* power (and therefore no output power), for example,
60+
* the system has opened the output breaker.
61+
*
62+
* NOTE: In a single-module system, this point
63+
* is intended to have the same behavior as
64+
* the RFC1628 point upsOutputSource."
65+
*/
66+
static info_lkp_t vertiv_power_source_info[] = {
67+
info_lkp_default(1, ""), /* other */
68+
info_lkp_default(2, "OFF"), /* none */
69+
info_lkp_default(3, "OL"), /* normal */
70+
info_lkp_default(4, "BYPASS"), /* bypass */
71+
info_lkp_default(5, "OB"), /* battery */
72+
info_lkp_default(6, "BOOST"), /* booster */
73+
info_lkp_default(7, "TRIM"), /* reducer */
74+
info_lkp_sentinel
75+
};
76+
5377
static snmp_info_t vertiv_mib[] = {
5478
/* standard MIB items */
5579
snmp_info_default("device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK | SU_FLAG_SEMI_STATIC, NULL),
@@ -79,8 +103,8 @@ static snmp_info_t vertiv_mib[] = {
79103
snmp_info_default("output.power", 0, 1.0, VERTIV_VAL_OID ".4208", "", SU_FLAG_OK | SU_FLAG_NEGINVALID, NULL),
80104

81105
/* UPS Status */
82-
/* Output Source: 3=Normal(OL), 4/5=Battery(OB) */
83-
snmp_info_default("ups.status", 0, 1.0, VERTIV_VAL_OID ".4872", "", SU_FLAG_OK, NULL),
106+
/* Output Source: 3=Normal(OL), 4/5=Battery(OB) et al */
107+
snmp_info_default("ups.status", ST_FLAG_STRING, SU_INFOSIZE, VERTIV_VAL_OID ".4872", "", SU_STATUS_PWR | SU_FLAG_OK, vertiv_power_source_info),
84108

85109
/* Beeper status and commands */
86110
snmp_info_default("ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, VERTIV_BEEPER_OID, "", SU_FLAG_UNIQUE, vertiv_beeper_status_info),

0 commit comments

Comments
 (0)