Files
librenms-librenms/includes/discovery/sensors/temperature/sub10.inc.php

29 lines
1022 B
PHP
Raw Normal View History

2015-09-11 18:40:51 +01:00
<?php
echo 'Sub10 temperature ';
2015-09-11 18:40:51 +01:00
// Get Current Value
$temp_oid = 'sub10UnitLclMWUTemperature.0';
list($oid, $current) = explode(' ', snmp_get($device, $temp_oid, '-OsqnU', 'SUB10SYSTEMS-MIB'));
2015-09-11 18:40:51 +01:00
// Get Alarm Ranges
$alarm_oid = 'sub10UnitMgmtAlarmName';
$alarms = snmp_walk($device, $alarm_oid, '-OsqU', 'SUB10SYSTEMS-MIB');
$indexes = [];
foreach (explode("\n", $alarms) as $alarm) {
if (preg_match('/^\w+\.(\d) MWU Temperature (.*)$/', $alarm, $matches)) {
$indexes[strtolower($matches[2])] = $matches[1];
2015-09-11 18:40:51 +01:00
}
}
2015-09-11 18:40:51 +01:00
$thresh_oid = 'sub10UnitMgmtAlarmRaiseThresh';
$threshes = snmp_walk($device, $thresh_oid, '-OsqU', 'SUB10SYSTEMS-MIB');
$thresholds = [];
foreach (explode("\n", $threshes) as $thresh) {
preg_match('/^\w+\.(\d) (.*)$/', $thresh, $matches);
$thresholds[$matches[1]] = $matches[2];
2015-09-11 18:40:51 +01:00
}
// Create Sensor
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $oid, 'sub10', 'Modem', '1', '1', $thresholds[$indexes['low']], null, null, $thresholds[$indexes['high']], $current);