Fixing Sentry 3 and 4 Temperature Sensors (#9177)

* fixing sentry3 temperature sensor issues: read all sensors not just first two, fix reading limit and current values, fixing snmp get options

* fixing sentry4 temperature sensor issues: read all sensors not just first two, fix reading limit and current values, fixing snmp get options

* fixing code style issues

* addressing review items from murrant, removing individual snmp_gets, fixing fahrenheit to celcius code back

* addressing review items, putting back the celcius fahrenheit conversion logic back

* using snmpwalk_cache_oid instead of reinventing in sentry3 code

* using pre-cache for sentry4 temp sensors, addressing review items

* checking all sentry3 humidity sensors instead of first two, bulk reading instead of individual gets

* addressing style issues

* pre-caching sentry4 humidity warning table removing duplicate temp sensor event config table

* adding two more sentry snmprec files after temperature and humidity sensor updates

* making sensor index values for sentry3/4 unique

* adding sentry3 and 4 test data files after temperature and humidity sensors update
This commit is contained in:
tarik
2018-09-19 15:16:04 +02:00
committed by Tony Murray
parent 466b5a35a8
commit 85f78e76e4
9 changed files with 5054 additions and 73 deletions

View File

@@ -1,37 +1,27 @@
<?php
$oids = snmp_walk($device, 'tempHumidSensorHumidValue', '-Osqn', 'Sentry3-MIB');
$oids = snmpwalk_cache_oid($device, 'tempHumidSensorEntry', array(), 'Sentry3-MIB');
$divisor = '1';
$multiplier = '1';
d_echo($oids."\n");
d_echo($oids);
$oids = trim($oids);
if ($oids) {
echo 'ServerTech Sentry ';
}
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if ($data) {
list($oid,$descr) = explode(' ', $data, 2);
$split_oid = explode('.', $oid);
$index = $split_oid[(count($split_oid) - 1)];
echo 'ServerTech Sentry3 Humidity ';
foreach ($oids as $sensor_index => $data) {
// tempHumidSensorHumidValue
$humidity_oid = '.1.3.6.1.4.1.1718.3.2.5.1.10.1.'.$index;
$descr = 'Removable Sensor '.$index;
$low_warn_limit = '0';
$low_limit = snmp_get($device, "tempHumidSensorHumidLowThresh.1.$index", '-Ovq', 'Sentry3-MIB');
$high_warn_limit = '0';
$high_limit = snmp_get($device, "tempHumidSensorHumidHighThresh.1.$index", '-Ovq', 'Sentry3-MIB');
$current = snmp_get($device, "$humidity_oid", '-Ovq', 'Sentry3-MIB');
$humidity_oid = '.1.3.6.1.4.1.1718.3.2.5.1.10.'.$sensor_index;
$descr = 'Removable Sensor '.$data['tempHumidSensorID'];
$low_warn_limit = null;
$low_limit = $data['tempHumidSensorHumidLowThresh'];
$high_warn_limit = null;
$high_limit = $data['tempHumidSensorHumidHighThresh'];
$current = $data['tempHumidSensorHumidValue'];
if ($current >= 0) {
discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, $index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
if (is_numeric($current) && $current >= 0) {
discover_sensor($valid['sensor'], 'humidity', $device, $humidity_oid, 'tempHumidSensorHumidValue'.$sensor_index, 'sentry3', $descr, $divisor, $multiplier, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
}
}
unset($data);
}
unset($oids);

View File

@@ -32,6 +32,6 @@ foreach ($pre_cache['sentry4_humid'] as $index => $data) {
$high_warn_limit = $data['st4HumidSensorHighWarning'];
$current = $data['st4HumidSensorValue'];
if ($current >= 0) {
discover_sensor($valid['sensor'], 'humidity', $device, $oid, "st4HumidSensor.$index", 'sentry4', $descr, 1, 1, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
discover_sensor($valid['sensor'], 'humidity', $device, $oid, "st4HumidSensorValue.$index", 'sentry4', $descr, 1, 1, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
}
}