From 6057053963fe7e39a883028a77420141c70975c1 Mon Sep 17 00:00:00 2001 From: Peca Nesovanovic <59750439+Npeca75@users.noreply.github.com> Date: Mon, 5 Feb 2024 00:24:47 +0100 Subject: [PATCH] [rfc1628] Add UPS Test (battery test) status sensor (#15802) --- .../discovery/sensors/state/rfc1628.inc.php | 50 ++ tests/data/eaton-mgeups_9pxle.json | 115 +++ tests/data/eatonupsm2_9px+empg2.json | 179 ++++- tests/data/istars.json | 676 ++---------------- tests/data/marathonups.json | 67 ++ 5 files changed, 475 insertions(+), 612 deletions(-) diff --git a/includes/discovery/sensors/state/rfc1628.inc.php b/includes/discovery/sensors/state/rfc1628.inc.php index 34de3f2f29..00846e8926 100644 --- a/includes/discovery/sensors/state/rfc1628.inc.php +++ b/includes/discovery/sensors/state/rfc1628.inc.php @@ -1,4 +1,12 @@ + */ + +use LibreNMS\Util\Oid; echo 'RFC1628 '; @@ -82,3 +90,45 @@ if (is_numeric($state)) { //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $sensor_index); } + +// UPS battery test status +$state = SnmpQuery::get('UPS-MIB::upsTestResultsSummary.0')->value(); +if (is_numeric($state)) { + //Create State Index + $state_name = 'upsTestResult'; + create_state_index( + $state_name, + [ + ['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'OK'], + ['value' => 2, 'generic' => 1, 'graph' => 0, 'descr' => 'Warning'], + ['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'Error'], + ['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'Aborted'], + ['value' => 5, 'generic' => 1, 'graph' => 0, 'descr' => 'inProgress'], + ['value' => 6, 'generic' => 3, 'graph' => 0, 'descr' => 'noTestInitiated'], + ] + ); + + $sensor_index = 0; + $oid = oid::toNumeric('UPS-MIB::upsTestResultsSummary.0'); + discover_sensor( + $valid['sensor'], + 'state', + $device, + $oid, + $sensor_index, + $state_name, + 'UPS Test', + 1, + 1, + null, + null, + null, + null, + $state, + 'snmp', + 0 + ); + + //Create Sensor To State Index + create_sensor_to_state_index($device, $state_name, $sensor_index); +} diff --git a/tests/data/eaton-mgeups_9pxle.json b/tests/data/eaton-mgeups_9pxle.json index 52fc7fc4be..53c393a54b 100644 --- a/tests/data/eaton-mgeups_9pxle.json +++ b/tests/data/eaton-mgeups_9pxle.json @@ -1183,6 +1183,31 @@ "rrd_type": "GAUGE", "state_name": "upsOutputSourceState" }, + { + "sensor_deleted": 0, + "sensor_class": "state", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.2.1.33.1.7.3.0", + "sensor_index": "0", + "sensor_type": "upsTestResult", + "sensor_descr": "UPS Test", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 1, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": "0", + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "rrd_type": "GAUGE", + "state_name": "upsTestResult" + }, { "sensor_deleted": 0, "sensor_class": "state", @@ -1633,6 +1658,48 @@ "state_value": 7, "state_generic_value": 2 }, + { + "state_name": "upsTestResult", + "state_descr": "OK", + "state_draw_graph": 0, + "state_value": 1, + "state_generic_value": 0 + }, + { + "state_name": "upsTestResult", + "state_descr": "Warning", + "state_draw_graph": 0, + "state_value": 2, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "Error", + "state_draw_graph": 0, + "state_value": 3, + "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "Aborted", + "state_draw_graph": 0, + "state_value": 4, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "inProgress", + "state_draw_graph": 0, + "state_value": 5, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "noTestInitiated", + "state_draw_graph": 0, + "state_value": 6, + "state_generic_value": 3 + }, { "state_name": "xupsAlarms", "state_descr": "No Alarm", @@ -1671,5 +1738,53 @@ ] }, "poller": "matches discovery" + }, + "route": { + "discovery": { + "route": [ + { + "context_name": "", + "inetCidrRouteIfIndex": 2, + "inetCidrRouteType": 4, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 1, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "0.0.0.0", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "0.0.0.0", + "inetCidrRoutePolicy": "ccitt.0", + "inetCidrRoutePfxLen": 32 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 2, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "10.240.15.0", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "0.0.0.0", + "inetCidrRoutePolicy": "ccitt.0", + "inetCidrRoutePfxLen": 32 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 1, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "127.0.0.1", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "0.0.0.0", + "inetCidrRoutePolicy": "ccitt.0", + "inetCidrRoutePfxLen": 32 + } + ] + } } } diff --git a/tests/data/eatonupsm2_9px+empg2.json b/tests/data/eatonupsm2_9px+empg2.json index 20c549e179..2328825f98 100644 --- a/tests/data/eatonupsm2_9px+empg2.json +++ b/tests/data/eatonupsm2_9px+empg2.json @@ -537,8 +537,8 @@ "ifName": "can0", "portName": null, "ifIndex": 2, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "down", "ifOperStatus_prev": "down", @@ -737,8 +737,8 @@ "ifName": "usb0", "portName": null, "ifIndex": 4, - "ifSpeed": 0, - "ifSpeed_prev": null, + "ifSpeed": null, + "ifSpeed_prev": 0, "ifConnectorPresent": "true", "ifOperStatus": "up", "ifOperStatus_prev": "up", @@ -1108,6 +1108,31 @@ "rrd_type": "GAUGE", "state_name": "upsOutputSourceState" }, + { + "sensor_deleted": 0, + "sensor_class": "state", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.2.1.33.1.7.3.0", + "sensor_index": "0", + "sensor_type": "upsTestResult", + "sensor_descr": "UPS Test", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 4, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": "0", + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "rrd_type": "GAUGE", + "state_name": "upsTestResult" + }, { "sensor_deleted": 0, "sensor_class": "state", @@ -1362,6 +1387,48 @@ "state_value": 7, "state_generic_value": 2 }, + { + "state_name": "upsTestResult", + "state_descr": "OK", + "state_draw_graph": 0, + "state_value": 1, + "state_generic_value": 0 + }, + { + "state_name": "upsTestResult", + "state_descr": "Warning", + "state_draw_graph": 0, + "state_value": 2, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "Error", + "state_draw_graph": 0, + "state_value": 3, + "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "Aborted", + "state_draw_graph": 0, + "state_value": 4, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "inProgress", + "state_draw_graph": 0, + "state_value": 5, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "noTestInitiated", + "state_draw_graph": 0, + "state_value": 6, + "state_generic_value": 3 + }, { "state_name": "xupsEnvironment", "state_descr": "open", @@ -1379,5 +1446,109 @@ ] }, "poller": "matches discovery" + }, + "route": { + "discovery": { + "route": [ + { + "context_name": "", + "inetCidrRouteIfIndex": 3, + "inetCidrRouteType": 4, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "0.0.0.0", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "10.120.251.193", + "inetCidrRoutePolicy": "zeroDotZero", + "inetCidrRoutePfxLen": 0 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 1, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv6", + "inetCidrRouteDest": "0000:0000:0000:0000:0000:0000:0000:0001", + "inetCidrRouteNextHopType": "ipv6", + "inetCidrRouteNextHop": "0000:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRoutePolicy": "zeroDotZero.4", + "inetCidrRoutePfxLen": 128 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 3, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "10.120.251.192", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "0.0.0.0", + "inetCidrRoutePolicy": "zeroDotZero.3", + "inetCidrRoutePfxLen": 27 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 4, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv4", + "inetCidrRouteDest": "169.254.0.0", + "inetCidrRouteNextHopType": "ipv4", + "inetCidrRouteNextHop": "0.0.0.0", + "inetCidrRoutePolicy": "zeroDotZero.4", + "inetCidrRoutePfxLen": 16 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 4, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 256, + "inetCidrRouteDestType": "ipv6", + "inetCidrRouteDest": "fe80:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRouteNextHopType": "ipv6", + "inetCidrRouteNextHop": "0000:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRoutePolicy": "zeroDotZero.6", + "inetCidrRoutePfxLen": 64 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 1, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 0, + "inetCidrRouteDestType": "ipv6", + "inetCidrRouteDest": "fe80:0000:0000:0000:4a6f:73ff:fe74:5043", + "inetCidrRouteNextHopType": "ipv6", + "inetCidrRouteNextHop": "0000:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRoutePolicy": "zeroDotZero.5", + "inetCidrRoutePfxLen": 128 + }, + { + "context_name": "", + "inetCidrRouteIfIndex": 4, + "inetCidrRouteType": 3, + "inetCidrRouteProto": 2, + "inetCidrRouteNextHopAS": 0, + "inetCidrRouteMetric1": 256, + "inetCidrRouteDestType": "ipv6", + "inetCidrRouteDest": "ff00:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRouteNextHopType": "ipv6", + "inetCidrRouteNextHop": "0000:0000:0000:0000:0000:0000:0000:0000", + "inetCidrRoutePolicy": "zeroDotZero.7", + "inetCidrRoutePfxLen": 8 + } + ] + } } } diff --git a/tests/data/istars.json b/tests/data/istars.json index b6fa142ed6..0236ebe4fc 100644 --- a/tests/data/istars.json +++ b/tests/data/istars.json @@ -833,6 +833,31 @@ "rrd_type": "GAUGE", "state_name": "upsOutputSourceState" }, + { + "sensor_deleted": 0, + "sensor_class": "state", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.2.1.33.1.7.3.0", + "sensor_index": "0", + "sensor_type": "upsTestResult", + "sensor_descr": "UPS Test", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 6, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": "0", + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "rrd_type": "GAUGE", + "state_name": "upsTestResult" + }, { "sensor_deleted": 0, "sensor_class": "temperature", @@ -1036,616 +1061,51 @@ "state_draw_graph": 0, "state_value": 7, "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "OK", + "state_draw_graph": 0, + "state_value": 1, + "state_generic_value": 0 + }, + { + "state_name": "upsTestResult", + "state_descr": "Warning", + "state_draw_graph": 0, + "state_value": 2, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "Error", + "state_draw_graph": 0, + "state_value": 3, + "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "Aborted", + "state_draw_graph": 0, + "state_value": 4, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "inProgress", + "state_draw_graph": 0, + "state_value": 5, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "noTestInitiated", + "state_draw_graph": 0, + "state_value": 6, + "state_generic_value": 3 } ] }, - "poller": { - "sensors": [ - { - "sensor_deleted": 0, - "sensor_class": "charge", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.4.0", - "sensor_index": "500", - "sensor_type": "rfc1628", - "sensor_descr": "Battery charge remaining", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 100, - "sensor_limit": 101, - "sensor_limit_warn": null, - "sensor_limit_low": 15, - "sensor_limit_low_warn": 50, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "current", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.3.1.0", - "sensor_index": "1", - "sensor_type": "rfc1628", - "sensor_descr": "Output", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "current", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.4.1.0", - "sensor_index": "101", - "sensor_type": "rfc1628", - "sensor_descr": "Input", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "current", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.5.3.1.3.1.0", - "sensor_index": "201", - "sensor_type": "rfc1628", - "sensor_descr": "Bypass", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "current", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.6.0", - "sensor_index": "500", - "sensor_type": "rfc1628", - "sensor_descr": "Battery", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "frequency", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.2.1.0", - "sensor_index": "3.2.0.1", - "sensor_type": "rfc1628", - "sensor_descr": "Input", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 60, - "sensor_limit": 63, - "sensor_limit_warn": null, - "sensor_limit_low": 57, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "frequency", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.2.0", - "sensor_index": "4.2.0", - "sensor_type": "rfc1628", - "sensor_descr": "Output", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 60, - "sensor_limit": 63, - "sensor_limit_warn": null, - "sensor_limit_low": 57, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "frequency", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.5.1.0", - "sensor_index": "5.1.0", - "sensor_type": "rfc1628", - "sensor_descr": "Bypass", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 60, - "sensor_limit": 63, - "sensor_limit_warn": null, - "sensor_limit_low": 57, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "load", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.5.1.0", - "sensor_index": "501", - "sensor_type": "rfc1628", - "sensor_descr": "Percentage load", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 17, - "sensor_limit": 80, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "power", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.5.1.0", - "sensor_index": "101", - "sensor_type": "rfc1628", - "sensor_descr": "Input", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "power", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.5.3.1.4.1.0", - "sensor_index": "201", - "sensor_type": "rfc1628", - "sensor_descr": "Bypass", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "power", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.4.1.0", - "sensor_index": "301", - "sensor_type": "rfc1628", - "sensor_descr": "Output", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "runtime", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.2.0", - "sensor_index": "100", - "sensor_type": "rfc1628", - "sensor_descr": "Time on battery", - "group": null, - "sensor_divisor": 60, - "sensor_multiplier": 1, - "sensor_current": 0, - "sensor_limit": 2, - "sensor_limit_warn": 1, - "sensor_limit_low": 0, - "sensor_limit_low_warn": 0, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "runtime", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.3.0", - "sensor_index": "200", - "sensor_type": "rfc1628", - "sensor_descr": "Estimated battery time remaining", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 848, - "sensor_limit": 10000, - "sensor_limit_warn": null, - "sensor_limit_low": 5, - "sensor_limit_low_warn": 10, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.1.0", - "sensor_index": "0", - "sensor_type": "upsBatteryStatusState", - "sensor_descr": "Battery Status", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 2, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": "0", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "upsBatteryStatusState" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.1.0", - "sensor_index": "0", - "sensor_type": "upsOutputSourceState", - "sensor_descr": "Output Source", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 3, - "sensor_limit": null, - "sensor_limit_warn": null, - "sensor_limit_low": null, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": "0", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "upsOutputSourceState" - }, - { - "sensor_deleted": 0, - "sensor_class": "temperature", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.7.0", - "sensor_index": "0", - "sensor_type": "rfc1628", - "sensor_descr": "Battery", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 35, - "sensor_limit": 55, - "sensor_limit_warn": null, - "sensor_limit_low": 25, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.2.1.0", - "sensor_index": "1", - "sensor_type": "rfc1628", - "sensor_descr": "Output", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 115, - "sensor_limit": 132.25, - "sensor_limit_warn": null, - "sensor_limit_low": 97.75, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.2.5.0", - "sensor_index": "1.2.5.0", - "sensor_type": "rfc1628", - "sensor_descr": "Battery", - "group": null, - "sensor_divisor": 10, - "sensor_multiplier": 1, - "sensor_current": 216.9, - "sensor_limit": 249.435, - "sensor_limit_warn": null, - "sensor_limit_low": 184.365, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.3.1.0", - "sensor_index": "101", - "sensor_type": "rfc1628", - "sensor_descr": "Input", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 224, - "sensor_limit": 257.6, - "sensor_limit_warn": null, - "sensor_limit_low": 190.4, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.2.1.33.1.5.3.1.2.1.0", - "sensor_index": "201", - "sensor_type": "rfc1628", - "sensor_descr": "Bypass", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 224, - "sensor_limit": 257.6, - "sensor_limit_warn": null, - "sensor_limit_low": 190.4, - "sensor_limit_low_warn": null, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - } - ], - "state_indexes": [ - { - "state_name": "upsBatteryStatusState", - "state_descr": "Unknown", - "state_draw_graph": 0, - "state_value": 1, - "state_generic_value": 3 - }, - { - "state_name": "upsBatteryStatusState", - "state_descr": "Normal", - "state_draw_graph": 0, - "state_value": 2, - "state_generic_value": 0 - }, - { - "state_name": "upsBatteryStatusState", - "state_descr": "Low", - "state_draw_graph": 0, - "state_value": 3, - "state_generic_value": 2 - }, - { - "state_name": "upsBatteryStatusState", - "state_descr": "Depleted", - "state_draw_graph": 0, - "state_value": 4, - "state_generic_value": 2 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Other", - "state_draw_graph": 0, - "state_value": 1, - "state_generic_value": 3 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "None", - "state_draw_graph": 0, - "state_value": 2, - "state_generic_value": 3 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Normal", - "state_draw_graph": 0, - "state_value": 3, - "state_generic_value": 0 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Bypass", - "state_draw_graph": 0, - "state_value": 4, - "state_generic_value": 1 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Battery", - "state_draw_graph": 0, - "state_value": 5, - "state_generic_value": 2 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Booster", - "state_draw_graph": 0, - "state_value": 6, - "state_generic_value": 2 - }, - { - "state_name": "upsOutputSourceState", - "state_descr": "Reducer", - "state_draw_graph": 0, - "state_value": 7, - "state_generic_value": 2 - } - ] - } + "poller": "matches discovery" } } diff --git a/tests/data/marathonups.json b/tests/data/marathonups.json index 0a3d53571a..09cccafef5 100644 --- a/tests/data/marathonups.json +++ b/tests/data/marathonups.json @@ -651,6 +651,31 @@ "rrd_type": "GAUGE", "state_name": "upsOutputSourceState" }, + { + "sensor_deleted": 0, + "sensor_class": "state", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.2.1.33.1.7.3.0", + "sensor_index": "0", + "sensor_type": "upsTestResult", + "sensor_descr": "UPS Test", + "group": null, + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 1, + "sensor_limit": null, + "sensor_limit_warn": null, + "sensor_limit_low": null, + "sensor_limit_low_warn": null, + "sensor_alert": 1, + "sensor_custom": "No", + "entPhysicalIndex": "0", + "entPhysicalIndex_measured": null, + "sensor_prev": null, + "user_func": null, + "rrd_type": "GAUGE", + "state_name": "upsTestResult" + }, { "sensor_deleted": 0, "sensor_class": "temperature", @@ -829,6 +854,48 @@ "state_draw_graph": 0, "state_value": 7, "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "OK", + "state_draw_graph": 0, + "state_value": 1, + "state_generic_value": 0 + }, + { + "state_name": "upsTestResult", + "state_descr": "Warning", + "state_draw_graph": 0, + "state_value": 2, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "Error", + "state_draw_graph": 0, + "state_value": 3, + "state_generic_value": 2 + }, + { + "state_name": "upsTestResult", + "state_descr": "Aborted", + "state_draw_graph": 0, + "state_value": 4, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "inProgress", + "state_draw_graph": 0, + "state_value": 5, + "state_generic_value": 1 + }, + { + "state_name": "upsTestResult", + "state_descr": "noTestInitiated", + "state_draw_graph": 0, + "state_value": 6, + "state_generic_value": 3 } ] },