From eb6006248f7a804459a2fd57d2ae6fefbd1468e6 Mon Sep 17 00:00:00 2001 From: Peca Nesovanovic <59750439+Npeca75@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:48:40 +0100 Subject: [PATCH] Rewrite ups-nut discovery to SnmpQuery:: (#15850) * modernize and move ups-nut to unix * fix test data (group and invalid runtime) * add Battery Temperature to test data * lnms dev:check style --- LibreNMS/Util/ModuleTestHelper.php | 2 +- .../discovery/sensors/charge/linux.inc.php | 16 - .../discovery/sensors/charge/unix.inc.php | 62 ++ includes/discovery/sensors/load/linux.inc.php | 17 - includes/discovery/sensors/load/unix.inc.php | 62 ++ .../discovery/sensors/pre-cache/linux.inc.php | 2 - .../discovery/sensors/runtime/linux.inc.php | 17 - .../discovery/sensors/runtime/unix.inc.php | 62 ++ .../discovery/sensors/state/linux.inc.php | 44 - includes/discovery/sensors/state/unix.inc.php | 68 ++ .../sensors/temperature/unix.inc.php | 40 +- .../discovery/sensors/voltage/linux.inc.php | 59 -- .../discovery/sensors/voltage/unix.inc.php | 43 +- tests/data/linux_ups-nut.json | 797 ++---------------- tests/snmpsim/linux_ups-nut.snmprec | 1 + 15 files changed, 385 insertions(+), 907 deletions(-) create mode 100644 includes/discovery/sensors/charge/unix.inc.php delete mode 100644 includes/discovery/sensors/load/linux.inc.php create mode 100644 includes/discovery/sensors/load/unix.inc.php delete mode 100644 includes/discovery/sensors/runtime/linux.inc.php create mode 100644 includes/discovery/sensors/runtime/unix.inc.php create mode 100644 includes/discovery/sensors/state/unix.inc.php diff --git a/LibreNMS/Util/ModuleTestHelper.php b/LibreNMS/Util/ModuleTestHelper.php index 389dc4dbff..e22ed766a8 100644 --- a/LibreNMS/Util/ModuleTestHelper.php +++ b/LibreNMS/Util/ModuleTestHelper.php @@ -191,7 +191,7 @@ class ModuleTestHelper $collection_output = preg_replace('/\033\[[\d;]+m/', '', $collection_output); // extract snmp queries - $snmp_query_regex = '/^SNMP\[\'.*snmp(?:bulk)?(walk|get|getnext)\' .+\'(udp|tcp|tcp6|udp6):(?:\[[0-9a-f:]+\]|[^:]+):[0-9]+\' \'(.+)\'\]$/m'; + $snmp_query_regex = '/SNMP\[\'.*snmp(?:bulk)?(walk|get|getnext)\' .+\'(udp|tcp|tcp6|udp6):(?:\[[0-9a-f:]+\]|[^:]+):[0-9]+\' \'(.+)\'\]/m'; preg_match_all($snmp_query_regex, $collection_output, $snmp_matches); // extract mibs and group with oids diff --git a/includes/discovery/sensors/charge/linux.inc.php b/includes/discovery/sensors/charge/linux.inc.php index f89610c89a..84a14f0b3e 100644 --- a/includes/discovery/sensors/charge/linux.inc.php +++ b/includes/discovery/sensors/charge/linux.inc.php @@ -14,19 +14,3 @@ if (preg_match('/(Linux).+(ntc)/', $device['sysDescr'])) { discover_sensor($valid['sensor'], 'charge', $device, $oid . $index, $index, $sensor_type, $descr, 1, 1, $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value); } } - -$oids = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.1'; -$value = snmp_get($device, $oids, '-Osqnv'); - -if (! empty($value)) { - $type = 'ups-nut'; - $index = 1; - $limit = 100; - $lowlimit = 0; - $lowwarnlimit = 10; - $descr = 'Battery Charge'; - if (is_numeric($value)) { - discover_sensor($valid['sensor'], 'charge', $device, $oids, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, null, $limit, $value); - } -} -unset($oids); diff --git a/includes/discovery/sensors/charge/unix.inc.php b/includes/discovery/sensors/charge/unix.inc.php new file mode 100644 index 0000000000..ce24a172df --- /dev/null +++ b/includes/discovery/sensors/charge/unix.inc.php @@ -0,0 +1,62 @@ +. + * + * @link https://www.librenms.org + * + * @author Peca Nesovanovic + */ +use LibreNMS\Util\Oid; + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); //drop [ups-nut] + $upsnut = [ + 1 => ['descr' => 'Battery Charge', 'LL' => 0, 'LW' => 10, 'W' => null, 'H' => 100], + ]; + foreach ($snmpData as $index => $upsData) { + if ($upsnut[$index]) { + $value = intval($upsData['nsExtendOutLine']); + if (! empty($value)) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index); + discover_sensor( + $valid['sensor'], + 'charge', + $device, + $oid, + $index, + 'ups-nut', + $upsnut[$index]['descr'], + 1, + 1, + $upsnut[$index]['LL'], + $upsnut[$index]['LW'], + $upsnut[$index]['W'], + $upsnut[$index]['H'], + $value, + 'snmp', + null, + null, + null, + 'ups-nut' + ); + } + } + } +} diff --git a/includes/discovery/sensors/load/linux.inc.php b/includes/discovery/sensors/load/linux.inc.php deleted file mode 100644 index 40cd98e4d1..0000000000 --- a/includes/discovery/sensors/load/linux.inc.php +++ /dev/null @@ -1,17 +0,0 @@ -. + * + * @link https://www.librenms.org + * + * @author Peca Nesovanovic + */ +use LibreNMS\Util\Oid; + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); //drop [ups-nut] + $upsnut = [ + 8 => ['descr' => 'Ups Load', 'LL' => 0, 'LW' => 0, 'W' => null, 'H' => 100], + ]; + foreach ($snmpData as $index => $upsData) { + if ($upsnut[$index]) { + $value = intval($upsData['nsExtendOutLine']); + if (! empty($value)) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index); + discover_sensor( + $valid['sensor'], + 'load', + $device, + $oid, + $index, + 'ups-nut', + $upsnut[$index]['descr'], + 1, + 1, + $upsnut[$index]['LL'], + $upsnut[$index]['LW'], + $upsnut[$index]['W'], + $upsnut[$index]['H'], + $value, + 'snmp', + null, + null, + null, + 'ups-nut' + ); + } + } + } +} diff --git a/includes/discovery/sensors/pre-cache/linux.inc.php b/includes/discovery/sensors/pre-cache/linux.inc.php index db4f761d4d..ed58af1c94 100644 --- a/includes/discovery/sensors/pre-cache/linux.inc.php +++ b/includes/discovery/sensors/pre-cache/linux.inc.php @@ -24,5 +24,3 @@ */ echo 'RaspberryPi '; $pre_cache['raspberry_pi_sensors'] = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.8072.1.3.2.4.1.2.9.114.97.115.112.98.101.114.114.121', [], 'NET-SNMP-EXTEND-MIB'); -echo 'ups-nut '; -$pre_cache['ups_nut_sensors'] = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116', [], 'NET-SNMP-EXTEND-MIB'); diff --git a/includes/discovery/sensors/runtime/linux.inc.php b/includes/discovery/sensors/runtime/linux.inc.php deleted file mode 100644 index 0624230178..0000000000 --- a/includes/discovery/sensors/runtime/linux.inc.php +++ /dev/null @@ -1,17 +0,0 @@ -. + * + * @link https://www.librenms.org + * + * @author Peca Nesovanovic + */ +use LibreNMS\Util\Oid; + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); //drop [ups-nut] + $upsnut = [ + 3 => ['descr' => 'Time Remaining', 'LL' => 0, 'LW' => 0, 'W' => null, 'H' => 1000], + ]; + foreach ($snmpData as $index => $upsData) { + if ($upsnut[$index]) { + $value = intval($upsData['nsExtendOutLine']) / 60; + if (! empty($value)) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index); + discover_sensor( + $valid['sensor'], + 'runtime', + $device, + $oid, + $index, + 'ups-nut', + $upsnut[$index]['descr'], + 60, + 1, + $upsnut[$index]['LL'], + $upsnut[$index]['LW'], + $upsnut[$index]['W'], + $upsnut[$index]['H'], + $value, + 'snmp', + null, + null, + null, + 'ups-nut' + ); + } + } + } +} diff --git a/includes/discovery/sensors/state/linux.inc.php b/includes/discovery/sensors/state/linux.inc.php index c7822735b4..012c229f39 100644 --- a/includes/discovery/sensors/state/linux.inc.php +++ b/includes/discovery/sensors/state/linux.inc.php @@ -42,47 +42,3 @@ if (! empty($pre_cache['raspberry_pi_sensors'])) { } } } - -if (! empty($pre_cache['ups_nut_sensors'])) { - /* - * All the possible states from https://networkupstools.org/docs/developer-guide.chunked/ar01s04.html#_status_data - */ - $sensors = [ - ['state_name' => 'UPSOnLine', 'genericT' => 0, 'genericF' => 1, 'descr' => 'UPS on line'], - ['state_name' => 'UPSOnBattery', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS on battery'], - ['state_name' => 'UPSLowBattery', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS low battery'], - ['state_name' => 'UPSHighBattery', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS high battery'], - ['state_name' => 'UPSBatteryReplace', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery needs to be replaced'], - ['state_name' => 'UPSBatteryCharging', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery is charging'], - ['state_name' => 'UPSBatteryDischarging', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery is discharging'], - ['state_name' => 'UPSUPSBypass', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS bypass circuit is active'], - ['state_name' => 'UPSRuntimeCalibration', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is currently performing runtime calibration'], - ['state_name' => 'UPSOffline', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS is offline and is not supplying power to the load'], - ['state_name' => 'UPSUPSOverloaded', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS is overloaded.'], - ['state_name' => 'UPSUPSBuck', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is trimming incoming voltage'], - ['state_name' => 'UPSUPSBoost', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is boosting incoming voltage'], - ['state_name' => 'UPSForcedShutdown', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS forced shutdown'], - ]; - foreach ($sensors as $index => $sensor) { - $sensor_oid = 9 + $index; - - if (! empty($pre_cache['ups_nut_sensors']['ups-nut.' . $sensor_oid])) { - $oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.' . $sensor_oid; - $value = current($pre_cache['ups_nut_sensors']['ups-nut.' . $sensor_oid]); - $state_name = $sensor['state_name']; - $descr = $sensor['descr']; - $states = [ - ['value' => 0, 'generic' => $sensor['genericF'], 'graph' => 1, 'descr' => 'False'], - ['value' => 1, 'generic' => $sensor['genericT'], 'graph' => 1, 'descr' => 'True'], - ]; - - create_state_index($state_name, $states); - - //Discover Sensors - discover_sensor($valid['sensor'], 'state', $device, $oid, $sensor_oid, $state_name, $descr, '1', '1', null, null, null, null, $value, 'snmp', $sensor_oid); - - //Create Sensor To State Index - create_sensor_to_state_index($device, $state_name, $sensor_oid); - } - } -} diff --git a/includes/discovery/sensors/state/unix.inc.php b/includes/discovery/sensors/state/unix.inc.php new file mode 100644 index 0000000000..3119eaa382 --- /dev/null +++ b/includes/discovery/sensors/state/unix.inc.php @@ -0,0 +1,68 @@ +. + * + * @link https://www.librenms.org + * + * @author Peca Nesovanovic + */ +use LibreNMS\Util\Oid; + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); // drop [ups-nut] + $sensors = [ + ['state_name' => 'UPSOnLine', 'genericT' => 0, 'genericF' => 1, 'descr' => 'UPS on line'], + ['state_name' => 'UPSOnBattery', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS on battery'], + ['state_name' => 'UPSLowBattery', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS low battery'], + ['state_name' => 'UPSHighBattery', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS high battery'], + ['state_name' => 'UPSBatteryReplace', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery needs to be replaced'], + ['state_name' => 'UPSBatteryCharging', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery is charging'], + ['state_name' => 'UPSBatteryDischarging', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS the battery is discharging'], + ['state_name' => 'UPSUPSBypass', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS bypass circuit is active'], + ['state_name' => 'UPSRuntimeCalibration', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is currently performing runtime calibration'], + ['state_name' => 'UPSOffline', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS is offline and is not supplying power to the load'], + ['state_name' => 'UPSUPSOverloaded', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS is overloaded.'], + ['state_name' => 'UPSUPSBuck', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is trimming incoming voltage'], + ['state_name' => 'UPSUPSBoost', 'genericT' => 1, 'genericF' => 0, 'descr' => 'UPS is boosting incoming voltage'], + ['state_name' => 'UPSForcedShutdown', 'genericT' => 2, 'genericF' => 0, 'descr' => 'UPS forced shutdown'], + ]; + foreach ($sensors as $index => $sensor) { + $sensor_oid = 9 + $index; + + if (! empty($snmpData[$sensor_oid])) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $sensor_oid); + $value = current($snmpData[$sensor_oid]); + $state_name = $sensor['state_name']; + $descr = $sensor['descr']; + $states = [ + ['value' => 0, 'generic' => $sensor['genericF'], 'graph' => 1, 'descr' => 'False'], + ['value' => 1, 'generic' => $sensor['genericT'], 'graph' => 1, 'descr' => 'True'], + ]; + + create_state_index($state_name, $states); + + //Discover Sensors + discover_sensor($valid['sensor'], 'state', $device, $oid, $sensor_oid, $state_name, $descr, '1', '1', null, null, null, null, $value, 'snmp', $sensor_oid, null, null, 'ups-nut'); + + //Create Sensor To State Index + create_sensor_to_state_index($device, $state_name, $sensor_oid); + } + } +} diff --git a/includes/discovery/sensors/temperature/unix.inc.php b/includes/discovery/sensors/temperature/unix.inc.php index ae5a9fe051..6058260d4e 100644 --- a/includes/discovery/sensors/temperature/unix.inc.php +++ b/includes/discovery/sensors/temperature/unix.inc.php @@ -2,7 +2,7 @@ /** * unix.inc.php * - * LibreNMS temperature discovery module for UNIX based OS + * LibreNMS temperature sensor discovery module for UNIX based OS * * 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 @@ -38,3 +38,41 @@ if (! empty($snmpData)) { } } } + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); //drop [ups-nut] + $upsnut = [ + 24 => ['descr' => 'Battery Temperature', 'LL' => 10, 'LW' => 15, 'W' => 35, 'H' => 40], + ]; + foreach ($snmpData as $index => $upsData) { + if ($upsnut[$index]) { + $value = intval($upsData['nsExtendOutLine']); + if (! empty($value)) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index); + discover_sensor( + $valid['sensor'], + 'temperature', + $device, + $oid, + $index, + 'ups-nut', + $upsnut[$index]['descr'], + 1, + 1, + $upsnut[$index]['LL'], + $upsnut[$index]['LW'], + $upsnut[$index]['W'], + $upsnut[$index]['H'], + $value, + 'snmp', + null, + null, + null, + 'ups-nut' + ); + } + } + } +} diff --git a/includes/discovery/sensors/voltage/linux.inc.php b/includes/discovery/sensors/voltage/linux.inc.php index e9851d5a6f..df22d27392 100644 --- a/includes/discovery/sensors/voltage/linux.inc.php +++ b/includes/discovery/sensors/voltage/linux.inc.php @@ -97,62 +97,3 @@ if (preg_match('/(Linux).+(ntc)/', $device['sysDescr'])) { discover_sensor($valid['sensor'], 'voltage', $device, $oid . $index, $index, $sensor_type, $descr, '1', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $value); } } - -$oids = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.4'; -$value = snmp_get($device, $oids, '-Osqnv'); - -if (! empty($value)) { - $type = 'ups-nut'; - $index = 4; - $limit = 60; - $lowlimit = 0; - $lowwarnlimit = 0; - $descr = 'Battery Voltage'; - - discover_sensor($valid['sensor'], 'voltage', $device, $oids, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, null, $limit, $value); -} -unset($oids); - -$oids = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.5'; -$value = snmp_get($device, $oids, '-Osqnv'); - -if (! empty($value)) { - $type = 'ups-nut'; - $index = 5; - $limit = 60; - $lowlimit = 0; - $lowwarnlimit = 0; - $descr = 'Battery Nominal'; - - discover_sensor($valid['sensor'], 'voltage', $device, $oids, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, null, $limit, $value); -} -unset($oids); - -$oids = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.6'; -$value = snmp_get($device, $oids, '-Osqnv'); - -if (! empty($value)) { - $type = 'ups-nut'; - $index = 6; - $limit = 0; - $lowlimit = 0; - $lowwarnlimit = 0; - $descr = 'Line Nominal'; - - discover_sensor($valid['sensor'], 'voltage', $device, $oids, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, null, $limit, $value); -} -unset($oids); - -$oids = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.7'; -$value = snmp_get($device, $oids, '-Osqnv'); - -if (! empty($value)) { - $type = 'ups-nut'; - $index = 7; - $limit = 280; - $lowlimit = 200; - $lowwarnlimit = 0; - $descr = 'Input Voltage'; - - discover_sensor($valid['sensor'], 'voltage', $device, $oids, $index, $type, $descr, 1, 1, $lowlimit, $lowwarnlimit, null, $limit, $value); -} diff --git a/includes/discovery/sensors/voltage/unix.inc.php b/includes/discovery/sensors/voltage/unix.inc.php index 5459275e4a..ade8698bca 100644 --- a/includes/discovery/sensors/voltage/unix.inc.php +++ b/includes/discovery/sensors/voltage/unix.inc.php @@ -2,7 +2,7 @@ /** * unix.inc.php * - * LibreNMS voltage discovery module for UNIX based OS + * LibreNMS voltage sensor discovery module for UNIX based OS * * 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 @@ -38,3 +38,44 @@ if (! empty($snmpData)) { } } } + +$snmpData = SnmpQuery::cache()->hideMib()->walk('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut"')->table(3); +if (! empty($snmpData)) { + echo 'UPS-NUT-MIB: ' . PHP_EOL; + $snmpData = array_shift($snmpData); //drop [ups-nut] + $upsnut = [ + 4 => ['descr' => 'Battery Voltage', 'LL' => 0, 'LW' => 0, 'W' => null, 'H' => 60], + 5 => ['descr' => 'Battery Nominal', 'LL' => 0, 'LW' => 0, 'W' => null, 'H' => 60], + 6 => ['descr' => 'Line Nominal', 'LL' => 0, 'LW' => 0, 'W' => null, 'H' => 0], + 7 => ['descr' => 'Input Voltage', 'LL' => 200, 'LW' => 0, 'W' => null, 'H' => 280], + ]; + foreach ($snmpData as $index => $upsData) { + if ($upsnut[$index]) { + $value = $upsData['nsExtendOutLine']; + if (is_numeric($value)) { + $oid = Oid::toNumeric('NET-SNMP-EXTEND-MIB::nsExtendOutLine."ups-nut".' . $index); + discover_sensor( + $valid['sensor'], + 'voltage', + $device, + $oid, + $index, + 'ups-nut', + $upsnut[$index]['descr'], + 1, + 1, + $upsnut[$index]['LL'], + $upsnut[$index]['LW'], + $upsnut[$index]['W'], + $upsnut[$index]['H'], + $value, + 'snmp', + null, + null, + null, + 'ups-nut' + ); + } + } + } +} diff --git a/tests/data/linux_ups-nut.json b/tests/data/linux_ups-nut.json index 0f1ccfb092..e59cc7ee41 100644 --- a/tests/data/linux_ups-nut.json +++ b/tests/data/linux_ups-nut.json @@ -31,7 +31,7 @@ "sensor_index": "1", "sensor_type": "ups-nut", "sensor_descr": "Battery Charge", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 100, @@ -56,7 +56,7 @@ "sensor_index": "8", "sensor_type": "ups-nut", "sensor_descr": "Ups Load", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 17, @@ -81,10 +81,10 @@ "sensor_index": "3", "sensor_type": "ups-nut", "sensor_descr": "Time Remaining", - "group": null, + "group": "ups-nut", "sensor_divisor": 60, "sensor_multiplier": 1, - "sensor_current": 2280, + "sensor_current": 38, "sensor_limit": 1000, "sensor_limit_warn": null, "sensor_limit_low": 0, @@ -106,7 +106,7 @@ "sensor_index": "14", "sensor_type": "UPSBatteryCharging", "sensor_descr": "UPS the battery is charging", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -131,7 +131,7 @@ "sensor_index": "15", "sensor_type": "UPSBatteryDischarging", "sensor_descr": "UPS the battery is discharging", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -156,7 +156,7 @@ "sensor_index": "13", "sensor_type": "UPSBatteryReplace", "sensor_descr": "UPS the battery needs to be replaced", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -181,7 +181,7 @@ "sensor_index": "22", "sensor_type": "UPSForcedShutdown", "sensor_descr": "UPS forced shutdown", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -206,7 +206,7 @@ "sensor_index": "12", "sensor_type": "UPSHighBattery", "sensor_descr": "UPS high battery", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -231,7 +231,7 @@ "sensor_index": "11", "sensor_type": "UPSLowBattery", "sensor_descr": "UPS low battery", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -256,7 +256,7 @@ "sensor_index": "18", "sensor_type": "UPSOffline", "sensor_descr": "UPS is offline and is not supplying power to the load", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -281,7 +281,7 @@ "sensor_index": "10", "sensor_type": "UPSOnBattery", "sensor_descr": "UPS on battery", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -306,7 +306,7 @@ "sensor_index": "9", "sensor_type": "UPSOnLine", "sensor_descr": "UPS on line", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -331,7 +331,7 @@ "sensor_index": "17", "sensor_type": "UPSRuntimeCalibration", "sensor_descr": "UPS is currently performing runtime calibration", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -356,7 +356,7 @@ "sensor_index": "21", "sensor_type": "UPSUPSBoost", "sensor_descr": "UPS is boosting incoming voltage", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -381,7 +381,7 @@ "sensor_index": "20", "sensor_type": "UPSUPSBuck", "sensor_descr": "UPS is trimming incoming voltage", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -406,7 +406,7 @@ "sensor_index": "16", "sensor_type": "UPSUPSBypass", "sensor_descr": "UPS bypass circuit is active", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -431,7 +431,7 @@ "sensor_index": "19", "sensor_type": "UPSUPSOverloaded", "sensor_descr": "UPS is overloaded.", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 1, @@ -448,6 +448,31 @@ "rrd_type": "GAUGE", "state_name": "UPSUPSOverloaded" }, + { + "sensor_deleted": 0, + "sensor_class": "temperature", + "poller_type": "snmp", + "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.24", + "sensor_index": "24", + "sensor_type": "ups-nut", + "sensor_descr": "Battery Temperature", + "group": "ups-nut", + "sensor_divisor": 1, + "sensor_multiplier": 1, + "sensor_current": 25, + "sensor_limit": 40, + "sensor_limit_warn": 35, + "sensor_limit_low": 10, + "sensor_limit_low_warn": 15, + "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", @@ -456,7 +481,7 @@ "sensor_index": "4", "sensor_type": "ups-nut", "sensor_descr": "Battery Voltage", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 44, @@ -481,7 +506,7 @@ "sensor_index": "5", "sensor_type": "ups-nut", "sensor_descr": "Battery Nominal", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 45, @@ -506,7 +531,7 @@ "sensor_index": "6", "sensor_type": "ups-nut", "sensor_descr": "Line Nominal", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 230, @@ -531,7 +556,7 @@ "sensor_index": "7", "sensor_type": "ups-nut", "sensor_descr": "Input Voltage", - "group": null, + "group": "ups-nut", "sensor_divisor": 1, "sensor_multiplier": 1, "sensor_current": 252, @@ -748,732 +773,6 @@ } ] }, - "poller": { - "sensors": [ - { - "sensor_deleted": 0, - "sensor_class": "charge", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.1", - "sensor_index": "1", - "sensor_type": "ups-nut", - "sensor_descr": "Battery Charge", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 100, - "sensor_limit": 100, - "sensor_limit_warn": null, - "sensor_limit_low": 0, - "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": "load", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.8", - "sensor_index": "8", - "sensor_type": "ups-nut", - "sensor_descr": "Ups Load", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 17, - "sensor_limit": 100, - "sensor_limit_warn": null, - "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.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.3", - "sensor_index": "3", - "sensor_type": "ups-nut", - "sensor_descr": "Time Remaining", - "group": null, - "sensor_divisor": 60, - "sensor_multiplier": 1, - "sensor_current": 38, - "sensor_limit": 1000, - "sensor_limit_warn": null, - "sensor_limit_low": 0, - "sensor_limit_low_warn": 0, - "sensor_alert": 1, - "sensor_custom": "No", - "entPhysicalIndex": null, - "entPhysicalIndex_measured": null, - "sensor_prev": 2280, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": null - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.14", - "sensor_index": "14", - "sensor_type": "UPSBatteryCharging", - "sensor_descr": "UPS the battery is charging", - "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": "14", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSBatteryCharging" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.15", - "sensor_index": "15", - "sensor_type": "UPSBatteryDischarging", - "sensor_descr": "UPS the battery is discharging", - "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": "15", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSBatteryDischarging" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.13", - "sensor_index": "13", - "sensor_type": "UPSBatteryReplace", - "sensor_descr": "UPS the battery needs to be replaced", - "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": "13", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSBatteryReplace" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.22", - "sensor_index": "22", - "sensor_type": "UPSForcedShutdown", - "sensor_descr": "UPS forced shutdown", - "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": "22", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSForcedShutdown" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.12", - "sensor_index": "12", - "sensor_type": "UPSHighBattery", - "sensor_descr": "UPS high battery", - "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": "12", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSHighBattery" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.11", - "sensor_index": "11", - "sensor_type": "UPSLowBattery", - "sensor_descr": "UPS low battery", - "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": "11", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSLowBattery" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.18", - "sensor_index": "18", - "sensor_type": "UPSOffline", - "sensor_descr": "UPS is offline and is not supplying power to the load", - "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": "18", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSOffline" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.10", - "sensor_index": "10", - "sensor_type": "UPSOnBattery", - "sensor_descr": "UPS on battery", - "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": "10", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSOnBattery" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.9", - "sensor_index": "9", - "sensor_type": "UPSOnLine", - "sensor_descr": "UPS on line", - "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": "9", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSOnLine" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.17", - "sensor_index": "17", - "sensor_type": "UPSRuntimeCalibration", - "sensor_descr": "UPS is currently performing runtime calibration", - "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": "17", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSRuntimeCalibration" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.21", - "sensor_index": "21", - "sensor_type": "UPSUPSBoost", - "sensor_descr": "UPS is boosting incoming voltage", - "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": "21", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSUPSBoost" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.20", - "sensor_index": "20", - "sensor_type": "UPSUPSBuck", - "sensor_descr": "UPS is trimming incoming voltage", - "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": "20", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSUPSBuck" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.16", - "sensor_index": "16", - "sensor_type": "UPSUPSBypass", - "sensor_descr": "UPS bypass circuit is active", - "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": "16", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSUPSBypass" - }, - { - "sensor_deleted": 0, - "sensor_class": "state", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.19", - "sensor_index": "19", - "sensor_type": "UPSUPSOverloaded", - "sensor_descr": "UPS is overloaded.", - "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": "19", - "entPhysicalIndex_measured": null, - "sensor_prev": null, - "user_func": null, - "rrd_type": "GAUGE", - "state_name": "UPSUPSOverloaded" - }, - { - "sensor_deleted": 0, - "sensor_class": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.4", - "sensor_index": "4", - "sensor_type": "ups-nut", - "sensor_descr": "Battery Voltage", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 44, - "sensor_limit": 60, - "sensor_limit_warn": null, - "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": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.5", - "sensor_index": "5", - "sensor_type": "ups-nut", - "sensor_descr": "Battery Nominal", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 45, - "sensor_limit": 60, - "sensor_limit_warn": null, - "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": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.6", - "sensor_index": "6", - "sensor_type": "ups-nut", - "sensor_descr": "Line Nominal", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 230, - "sensor_limit": 0, - "sensor_limit_warn": null, - "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": "voltage", - "poller_type": "snmp", - "sensor_oid": ".1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.7", - "sensor_index": "7", - "sensor_type": "ups-nut", - "sensor_descr": "Input Voltage", - "group": null, - "sensor_divisor": 1, - "sensor_multiplier": 1, - "sensor_current": 252, - "sensor_limit": 280, - "sensor_limit_warn": null, - "sensor_limit_low": 200, - "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 - } - ], - "state_indexes": [ - { - "state_name": "UPSBatteryCharging", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSBatteryCharging", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSBatteryDischarging", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSBatteryDischarging", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSBatteryReplace", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSBatteryReplace", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSForcedShutdown", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSForcedShutdown", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 2 - }, - { - "state_name": "UPSHighBattery", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSHighBattery", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSLowBattery", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSLowBattery", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 2 - }, - { - "state_name": "UPSOffline", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSOffline", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 2 - }, - { - "state_name": "UPSOnBattery", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSOnBattery", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSOnLine", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 1 - }, - { - "state_name": "UPSOnLine", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 0 - }, - { - "state_name": "UPSRuntimeCalibration", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSRuntimeCalibration", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSUPSBoost", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSUPSBoost", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSUPSBuck", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSUPSBuck", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSUPSBypass", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSUPSBypass", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 1 - }, - { - "state_name": "UPSUPSOverloaded", - "state_descr": "False", - "state_draw_graph": 1, - "state_value": 0, - "state_generic_value": 0 - }, - { - "state_name": "UPSUPSOverloaded", - "state_descr": "True", - "state_draw_graph": 1, - "state_value": 1, - "state_generic_value": 2 - } - ] - } + "poller": "matches discovery" } } diff --git a/tests/snmpsim/linux_ups-nut.snmprec b/tests/snmpsim/linux_ups-nut.snmprec index 584b2e1d72..470db2d196 100644 --- a/tests/snmpsim/linux_ups-nut.snmprec +++ b/tests/snmpsim/linux_ups-nut.snmprec @@ -25,3 +25,4 @@ 1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.20|4|1 1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.21|4|1 1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.22|4|1 +1.3.6.1.4.1.8072.1.3.2.4.1.2.7.117.112.115.45.110.117.116.24|4|25