From 568a2bf21d56767ada67dd36982602b522ad0d85 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Wed, 3 May 2017 15:24:57 +0100 Subject: [PATCH] Added more sensors for Exalt ExtendAir devices (#6531) --- .../discovery/sensors/state/extendair.inc.php | 153 +++++++++++++++++- .../sensors/temperature/extendair.inc.php | 10 +- 2 files changed, 158 insertions(+), 5 deletions(-) diff --git a/includes/discovery/sensors/state/extendair.inc.php b/includes/discovery/sensors/state/extendair.inc.php index 5fc135e974..abd5edcfd8 100644 --- a/includes/discovery/sensors/state/extendair.inc.php +++ b/includes/discovery/sensors/state/extendair.inc.php @@ -54,11 +54,84 @@ if (is_numeric($temp)) { } } - $descr = 'Link status for end radio'; + $descr = 'Link status (far end radio)'; discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); create_sensor_to_state_index($device, $state_name, $index); } +$temp = snmp_get($device, 'locLinkState.0', "-Ovqe", "ExaltComProducts"); +$cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.1.0'; + +if (is_numeric($temp)) { + $state_name = 'locLinkState'; + $index = $state_name; + $state_index_id = create_state_index($state_name); + + if ($state_index_id !== null) { + $states = array( + array($state_index_id,'almNORMAL',1,0,0) , + array($state_index_id,'almMINOR',1,1,1) , + array($state_index_id,'almMAJOR',1,2,2) , + array($state_index_id,'almDisable',1,3,1) , + array($state_index_id,'almNotAvailable',1,4,1), + array($state_index_id,'almClearChanel',1,5,1), + array($state_index_id,'almNonOccupant',1,6,1), + ); + + foreach ($states as $value) { + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + + $descr = 'Link status (local radio)'; + discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); + create_sensor_to_state_index($device, $state_name, $index); +} + +$temp = snmp_get($device, 'locTempAlarm.0', "-Ovqe", "ExaltComProducts"); +$cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.2.0'; + +if (is_numeric($temp)) { + $state_name = 'locTempAlarm'; + $index = $state_name; + $state_index_id = create_state_index($state_name); + + if ($state_index_id !== null) { + $states = array( + array($state_index_id,'almNORMAL',1,0,0) , + array($state_index_id,'almMINOR',1,1,1) , + array($state_index_id,'almMAJOR',1,2,2) , + array($state_index_id,'almDisable',1,3,1) , + array($state_index_id,'almNotAvailable',1,4,1), + array($state_index_id,'almClearChanel',1,5,1), + array($state_index_id,'almNonOccupant',1,6,1), + ); + + foreach ($states as $value) { + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + + $descr = 'Temperature status (local radio)'; + discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); + create_sensor_to_state_index($device, $state_name, $index); +} + + $temp = snmp_get($device, 'remTempAlarm.0', "-Ovqe", "ExaltComProducts"); $cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.2.0'; @@ -90,7 +163,7 @@ if (is_numeric($temp)) { } } - $descr = 'Temperature status for end radio'; + $descr = 'Temperature status (far end radio)'; discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); create_sensor_to_state_index($device, $state_name, $index); } @@ -131,6 +204,78 @@ if (is_numeric($temp)) { create_sensor_to_state_index($device, $state_name, $index); } +$temp = snmp_get($device, 'locLinkStateV.0', "-Ovqe", "ExaltComProducts"); +$cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.15.0'; + +if (is_numeric($temp)) { + $state_name = 'locLinkStateV'; + $index = $state_name; + $state_index_id = create_state_index($state_name); + + if ($state_index_id !== null) { + $states = array( + array($state_index_id,'almNORMAL',1,0,0) , + array($state_index_id,'almMINOR',1,1,1) , + array($state_index_id,'almMAJOR',1,2,2) , + array($state_index_id,'almDisable',1,3,1) , + array($state_index_id,'almNotAvailable',1,4,1), + array($state_index_id,'almClearChanel',1,5,1), + array($state_index_id,'almNonOccupant',1,6,1), + ); + + foreach ($states as $value) { + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + + $descr = 'Vertial link status (local radio)'; + discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); + create_sensor_to_state_index($device, $state_name, $index); +} + +$temp = snmp_get($device, 'locLinkStateH.0', "-Ovqe", "ExaltComProducts"); +$cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.16.0'; + +if (is_numeric($temp)) { + $state_name = 'locLinkStateH'; + $index = $state_name; + $state_index_id = create_state_index($state_name); + + if ($state_index_id !== null) { + $states = array( + array($state_index_id,'almNORMAL',1,0,0) , + array($state_index_id,'almMINOR',1,1,1) , + array($state_index_id,'almMAJOR',1,2,2) , + array($state_index_id,'almDisable',1,3,1) , + array($state_index_id,'almNotAvailable',1,4,1), + array($state_index_id,'almClearChanel',1,5,1), + array($state_index_id,'almNonOccupant',1,6,1), + ); + + foreach ($states as $value) { + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + + $descr = 'Horizontal link status (local radio)'; + discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); + create_sensor_to_state_index($device, $state_name, $index); +} + $temp = snmp_get($device, 'remLinkStateV.0', "-Ovqe", "ExaltComProducts"); $cur_oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.15.0'; @@ -162,7 +307,7 @@ if (is_numeric($temp)) { } } - $descr = 'Vertial link status'; + $descr = 'Vertial link status (far end radio)'; discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); create_sensor_to_state_index($device, $state_name, $index); } @@ -198,7 +343,7 @@ if (is_numeric($temp)) { } } - $descr = 'Horizontal link status'; + $descr = 'Horizontal link status (far end radio)'; discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp); create_sensor_to_state_index($device, $state_name, $index); } diff --git a/includes/discovery/sensors/temperature/extendair.inc.php b/includes/discovery/sensors/temperature/extendair.inc.php index db5ffbebc6..e44d271981 100644 --- a/includes/discovery/sensors/temperature/extendair.inc.php +++ b/includes/discovery/sensors/temperature/extendair.inc.php @@ -25,12 +25,20 @@ $oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.3.0'; $index = 0; -$descr = 'End radio internal temp'; +$descr = 'Internal temp (far end radio)'; $value = snmp_get($device, 'remCurrentTemp.0', '-Oqv', 'ExaltComProducts'); if ($value) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'extendair', $descr, '1', '1', null, null, null, null, $value); } +$oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.3.0'; +$index = 1; +$descr = 'Internal temp (local radio)'; +$value = snmp_get($device, 'locCurrentTemp.0', '-Oqv', 'ExaltComProducts'); +if ($value) { + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'extendair', $descr, '1', '1', null, null, null, null, $value); +} + unset( $oid, $index,