Imported Upstream version 2.7.4

This commit is contained in:
Laurent Bigonville 2016-07-18 02:11:41 +02:00
parent fd413a3168
commit c9cb2187ee
290 changed files with 7473 additions and 2607 deletions

View file

@ -4,7 +4,7 @@
* Copyright (C)
* 2005-2006 Olli Savia <ops@iki.fi>
* 2005-2006 Niels Baggesen <niels@baggesen.net>
* 2015 Arnaud Quette <ArnaudQuette@Eaton.com>
* 2015-2016 Arnaud Quette <ArnaudQuette@Eaton.com>
*
* 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
@ -25,7 +25,7 @@
#include "powerware-mib.h"
#define PW_MIB_VERSION "0.7"
#define PW_MIB_VERSION "0.87"
/* TODO: more sysOID and MIBs support:
*
@ -37,6 +37,8 @@
/* Powerware UPS (Ingrasys X-SLOT and BD-SLOT) */
#define POWERWARE_SYSOID ".1.3.6.1.4.1.534.1"
/* Powerware UPS newer PXGX UPS cards (BladeUPS, ...) */
#define EATON_PXGX_SYSOID ".1.3.6.1.4.1.534.2.12"
/* SNMP OIDs set */
#define PW_OID_MFR_NAME "1.3.6.1.4.1.534.1.1.1.0" /* XUPS-MIB::xupsIdentManufacturer.0 */
@ -68,10 +70,6 @@
#define PW_OID_BY_LINES "1.3.6.1.4.1.534.1.5.2.0" /* XUPS-MIB::xupsBypassNumPhases.0 */
#define PW_OID_BY_VOLTAGE "1.3.6.1.4.1.534.1.5.3.1.2" /* XUPS-MIB::xupsBypassVoltage */
#define PW_OID_AMBIENT_TEMP "1.3.6.1.4.1.534.1.6.1.0" /* XUPS-MIB::xupsEnvAmbientTemp.0 */
#define PW_OID_AMBIENT_LOW "1.3.6.1.4.1.534.1.6.2.0" /* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */
#define PW_OID_AMBIENT_HIGH "1.3.6.1.4.1.534.1.6.3.0" /* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */
#define PW_OID_BATTEST_START "1.3.6.1.4.1.534.1.8.1" /* XUPS-MIB::xupsTestBattery set to startTest(1) to initiate test*/
#define PW_OID_BATTEST_RES "1.3.6.1.4.1.534.1.8.2" /* XUPS-MIB::xupsTestBatteryStatus */
@ -79,6 +77,7 @@
#define PW_OID_CONT_ONDELAY "1.3.6.1.4.1.534.1.9.2" /* XUPS-MIB::xupsControlOutputOnDelay */
#define PW_OID_CONT_OFFT_DEL "1.3.6.1.4.1.534.1.9.3" /* XUPS-MIB::xupsControlOutputOffTrapDelay */
#define PW_OID_CONT_ONT_DEL "1.3.6.1.4.1.534.1.9.4" /* XUPS-MIB::xupsControlOutputOnTrapDelay */
#define PW_OID_CONT_LOAD_SHED_AND_RESTART "1.3.6.1.4.1.534.1.9.6" /* XUPS-MIB::xupsLoadShedSecsWithRestart */
#define PW_OID_CONF_OVOLTAGE "1.3.6.1.4.1.534.1.10.1.0" /* XUPS-MIB::xupsConfigOutputVoltage.0 */
#define PW_OID_CONF_IVOLTAGE "1.3.6.1.4.1.534.1.10.2.0" /* XUPS-MIB::xupsConfigInputVoltage.0 */
@ -94,45 +93,69 @@
#define IETF_OID_CONF_OUT_VA "1.3.6.1.2.1.33.1.9.5.0" /* UPS-MIB::upsConfigOutputVA.0 */
#define IETF_OID_CONF_RUNTIME_LOW "1.3.6.1.2.1.33.1.9.7.0" /* UPS-MIB::upsConfigLowBattTime.0 */
#define IETF_OID_LOAD_LEVEL "1.3.6.1.2.1.33.1.4.4.1.5" /* UPS-MIB::upsOutputPercentLoad */
#define IETF_OID_AUTO_RESTART "1.3.6.1.2.1.33.1.8.5.0" /* UPS-MIB::upsAutoRestart */
/* Delay before powering off in seconds */
#define DEFAULT_OFFDELAY 30
/* Delay before powering on in seconds */
#define DEFAULT_ONDELAY 20
/* Default shutdown.return delay in seconds */
#define DEFAULT_SHUTDOWNDELAY 0
static info_lkp_t pw_alarm_ob[] = {
{ 1, "OB" },
{ 2, "" },
{ 0, "NULL" }
{ 0, NULL }
} ;
static info_lkp_t pw_alarm_lb[] = {
{ 1, "LB" },
{ 2, "" },
{ 0, "NULL" }
{ 0, NULL }
} ;
static info_lkp_t pw_pwr_info[] = {
{ 1, "" /* other */ },
{ 2, "OFF" /* none */ },
{ 3, "OL" /* normal */ },
{ 4, "BYPASS" /* bypass */ },
{ 5, "OB" /* battery */ },
{ 6, "OL BOOST" /* booster */ },
{ 7, "OL TRIM" /* reducer */ },
{ 8, "OL" /* parallel capacity */ },
{ 9, "OL" /* parallel redundancy */ },
{10, "OL" /* high efficiancy */ },
{ 0, "NULL" }
{ 1, "" /* other */ },
{ 2, "OFF" /* none */ },
{ 3, "OL" /* normal */ },
{ 4, "BYPASS" /* bypass */ },
{ 5, "OB" /* battery */ },
{ 6, "OL BOOST" /* booster */ },
{ 7, "OL TRIM" /* reducer */ },
{ 8, "OL" /* parallel capacity */ },
{ 9, "OL" /* parallel redundancy */ },
{ 10, "OL" /* high efficiency */ },
/* Extended status values */
{ 240, "OB" /* battery (0xF0) */ },
{ 100, "BYPASS" /* maintenanceBypass (0x64) */ },
{ 96, "BYPASS" /* Bypass (0x60) */ },
{ 81, "OL" /* high efficiency (0x51) */ },
{ 80, "OL" /* normal (0x50) */ },
{ 64, "OL" /* UPS supporting load, normal degraded mode (0x40) */ },
{ 16, "OFF" /* none (0x10) */ },
{ 0, NULL }
};
static info_lkp_t pw_mode_info[] = {
{ 1, "" },
{ 2, "" },
{ 3, "normal" },
{ 4, "" },
{ 5, "" },
{ 6, "" },
{ 7, "" },
{ 8, "parallel capacity" },
{ 9, "parallel redundancy" },
{10, "high efficiency" },
{ 0, "NULL" }
{ 1, "" },
{ 2, "" },
{ 3, "normal" },
{ 4, "" },
{ 5, "" },
{ 6, "" },
{ 7, "" },
{ 8, "parallel capacity" },
{ 9, "parallel redundancy" },
{ 10, "high efficiency" },
/* Extended status values */
{ 240, "" /* battery (0xF0) */ },
{ 100, "" /* maintenanceBypass (0x64) */ },
{ 96, "" /* Bypass (0x60) */ },
{ 81, "high efficiency" /* high efficiency (0x51) */ },
{ 80, "normal" /* normal (0x50) */ },
{ 64, "" /* UPS supporting load, normal degraded mode (0x40) */ },
{ 16, "" /* none (0x10) */ },
{ 0, NULL }
};
/* Legacy implementation */
@ -142,7 +165,7 @@ static info_lkp_t pw_battery_abm_status[] = {
/* { 3, "Floating" }, */
/* { 4, "Resting" }, */
/* { 5, "Unknown" }, */
{ 0, "NULL" }
{ 0, NULL }
} ;
static info_lkp_t eaton_abm_status_info[] = {
@ -152,7 +175,7 @@ static info_lkp_t eaton_abm_status_info[] = {
{ 4, "resting" },
{ 5, "unknown" }, /* Undefined - ABM is not activated */
{ 6, "disabled" }, /* ABM Charger Disabled */
{ 0, "NULL" }
{ 0, NULL }
};
static info_lkp_t pw_batt_test_info[] = {
@ -163,13 +186,19 @@ static info_lkp_t pw_batt_test_info[] = {
{ 5, "Not supported" },
{ 6, "Inhibited" },
{ 7, "Scheduled" },
{ 0, "NULL" }
{ 0, NULL }
};
static info_lkp_t ietf_yes_no_info[] = {
{ 1, "yes" },
{ 2, "no" },
{ 0, NULL }
};
/* Snmp2NUT lookup table */
static snmp_info_t pw_mib[] = {
/* FIXME: miss device page! */
/* UPS page */
/* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */
{ "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_MFR_NAME, "",
@ -200,10 +229,19 @@ static snmp_info_t pw_mib[] = {
0, NULL },
{ "ups.power.nominal", 0, 1.0, IETF_OID_CONF_OUT_VA, "",
0, NULL },
/* XUPS-MIB::xupsEnvAmbientTemp.0 */
{ "ups.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.1.0", "", 0, NULL },
/* FIXME: These 2 data needs RFC! */
/* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */
{ "ups.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.2.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */
{ "ups.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.3.0", "", 0, NULL },
{ "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATTEST_RES, "",
0, &pw_batt_test_info[0] },
{ "ups.start.auto", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_AUTO_RESTART, "",
SU_FLAG_OK, &ietf_yes_no_info[0] },
{ "battery.charger.status", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATT_STATUS, "",
SU_STATUS_BATT, &eaton_abm_status_info[0] },
SU_STATUS_BATT, &eaton_abm_status_info[0] },
/* Battery page */
{ "battery.charge", 0, 1.0, PW_OID_BATT_CHARGE, "",
@ -246,6 +284,7 @@ static snmp_info_t pw_mib[] = {
SU_OUTPUT_3, NULL },
{ "output.L3.realpower", 0, 1.0, PW_OID_OUT_POWER ".3", "",
SU_OUTPUT_3, NULL },
/* FIXME: should better be output.Lx.load */
{ "output.L1.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".1", "",
SU_OUTPUT_3, NULL },
{ "output.L2.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".2", "",
@ -302,25 +341,39 @@ static snmp_info_t pw_mib[] = {
SU_INPUT_3, NULL },
/* Ambient page */
{ "ambient.temperature", 0, 1.0, PW_OID_AMBIENT_TEMP, "",
0, NULL },
{ "ambient.temperature.low", 0, 1.0, PW_OID_AMBIENT_LOW, "",
0, NULL },
{ "ambient.temperature.high", 0, 1.0, PW_OID_AMBIENT_HIGH, "",
0, NULL },
/* XUPS-MIB::xupsEnvRemoteTemp.0 */
{ "ambient.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.5.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvRemoteTempLowerLimit.0 */
{ "ambient.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.9.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvRemoteTempUpperLimit.0 */
{ "ambient.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.10.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvRemoteHumidity.0 */
{ "ambient.humidity", 0, 1.0, "1.3.6.1.4.1.534.1.6.6.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvRemoteHumidityLowerLimit.0 */
{ "ambient.humidity.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.11.0", "", 0, NULL },
/* XUPS-MIB::xupsEnvRemoteHumidityUpperLimit.0 */
{ "ambient.humidity.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.12.0", "", 0, NULL },
/* instant commands */
{ "test.battery.start.quick", 0, 1, PW_OID_BATTEST_START, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
/* Cancel output off, by writing 0 to xupsControlOutputOffDelay */
/* Shed load and restart when line power back on; cannot be canceled */
{ "shutdown.return", 0, DEFAULT_SHUTDOWNDELAY, PW_OID_CONT_LOAD_SHED_AND_RESTART, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
/* Cancel output off, by writing 0 to xupsControlOutputOffDelay */
{ "shutdown.stop", 0, 0, PW_OID_CONT_OFFDELAY, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
/* load off after 1 sec, shortest possible delay */
/* load off after 1 sec, shortest possible delay; 0 cancels */
{ "load.off", 0, 1, PW_OID_CONT_OFFDELAY, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
/* load on after 1 sec, shortest possible delay */
{ "load.off.delay", 0, DEFAULT_OFFDELAY, PW_OID_CONT_OFFDELAY, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
/* load on after 1 sec, shortest possible delay; 0 cancels */
{ "load.on", 0, 1, PW_OID_CONT_ONDELAY, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
{ "load.on.delay", 0, DEFAULT_ONDELAY, PW_OID_CONT_ONDELAY, "",
SU_TYPE_CMD | SU_FLAG_OK, NULL },
{ "ups.alarms", 0, 1.0, PW_OID_ALARMS, "",
0, NULL },
@ -330,10 +383,107 @@ static snmp_info_t pw_mib[] = {
} ;
static alarms_info_t pw_alarms[] = {
{ PW_OID_ALARM_LB, "LB" },
/* xupsLowBattery */
{ PW_OID_ALARM_LB, "LB", NULL },
/* xupsOutputOverload */
{ ".1.3.6.1.4.1.534.1.7.7", "OVER", "Output overload!" },
/* xupsInternalFailure */
{ ".1.3.6.1.4.1.534.1.7.8", NULL, "Internal failure!" },
/* xupsBatteryDischarged */
{ ".1.3.6.1.4.1.534.1.7.9", NULL, "Battery discharged!" },
/* xupsInverterFailure */
{ ".1.3.6.1.4.1.534.1.7.10", NULL, "Inverter failure!" },
/* xupsOnBypass
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.11", "BYPASS", "On bypass!" },
/* xupsBypassNotAvailable
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.12", NULL, "Bypass not available!" },
/* xupsOutputOff
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.13", "OFF", "Output off!" },
/* xupsInputFailure
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.14", NULL, "Input failure!" },
/* xupsBuildingAlarm
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.15", NULL, "Building alarm!" },
/* xupsShutdownImminent */
{ ".1.3.6.1.4.1.534.1.7.16", NULL, "Shutdown imminent!" },
/* xupsOnInverter
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.17", NULL, "On inverter!" },
/* xupsBreakerOpen
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.20", NULL, "Breaker open!" },
/* xupsAlarmBatteryBad */
{ ".1.3.6.1.4.1.534.1.7.23", "RB", "Battery bad!" },
/* xupsOutputOffAsRequested
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.24", "OFF", "Output off as requested!" },
/* xupsDiagnosticTestFailed
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.25", NULL, "Diagnostic test failure!" },
/* xupsCommunicationsLost */
{ ".1.3.6.1.4.1.534.1.7.26", NULL, "Communication with UPS lost!" },
/* xupsUpsShutdownPending */
{ ".1.3.6.1.4.1.534.1.7.27", NULL, "Shutdown pending!" },
/* xupsAmbientTempBad */
{ ".1.3.6.1.4.1.534.1.7.29", NULL, "Bad ambient temperature!" },
/* xupsLossOfRedundancy */
{ ".1.3.6.1.4.1.534.1.7.30", NULL, "Redundancy lost!" },
/* xupsAlarmTempBad */
{ ".1.3.6.1.4.1.534.1.7.31", NULL, "Bad temperature!" },
/* xupsAlarmChargerFailed */
{ ".1.3.6.1.4.1.534.1.7.32", NULL, "Charger failure!" },
/* xupsAlarmFanFailure */
{ ".1.3.6.1.4.1.534.1.7.33", NULL, "Fan failure!" },
/* xupsAlarmFuseFailure */
{ ".1.3.6.1.4.1.534.1.7.34", NULL, "Fuse failure!" },
/* xupsPowerSwitchBad */
{ ".1.3.6.1.4.1.534.1.7.35", NULL, "Powerswitch failure!" },
/* xupsModuleFailure */
{ ".1.3.6.1.4.1.534.1.7.36", NULL, "Parallel or composite module failure!" },
/* xupsOnAlternatePowerSource
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.37", NULL, "Using alternative power source!" },
/* xupsAltPowerNotAvailable
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.38", NULL, "Alternative power source unavailable!" },
/* xupsRemoteTempBad */
{ ".1.3.6.1.4.1.534.1.7.40", NULL, "Bad remote temperature!" },
/* xupsRemoteHumidityBad */
{ ".1.3.6.1.4.1.534.1.7.41", NULL, "Bad remote humidity!" },
/* xupsAlarmOutputBad */
{ ".1.3.6.1.4.1.534.1.7.42", NULL, "Bad output condition!" },
/* xupsAlarmAwaitingPower
* FIXME: informational (not an alarm),
* to RFC'ed for device.event? */
{ ".1.3.6.1.4.1.534.1.7.43", NULL, "Awaiting power!" },
/* xupsOnMaintenanceBypass
* FIXME: informational (not an alarm),
* to RFC'ed for device.event?
* FIXME: NUT currently doesn't distinguish between Maintenance and
* Automatic Bypass (both published as "ups.alarm: BYPASS)
* Should we make the distinction? */
{ ".1.3.6.1.4.1.534.1.7.44", "BYPASS", "On maintenance bypass!" },
/* end of structure. */
{ NULL, NULL }
{ NULL, NULL, NULL }
} ;
mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, "", PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms };
mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms };
mib2nut_info_t pxgx_ups = { "pxgx_ups", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, EATON_PXGX_SYSOID , pw_alarms };