1<?php 2 3/** 4 * Observium 5 * 6 * This file is part of Observium. 7 * 8 * @package observium 9 * @subpackage discovery 10 * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited 11 * 12 */ 13 14$lm_array['temp'] = snmpwalk_cache_multi_oid($device, 'lmTempSensorsEntry', array(), 'LM-SENSORS-MIB'); 15$lm_array['fan'] = snmpwalk_cache_multi_oid($device, 'lmFanSensorsEntry', array(), 'LM-SENSORS-MIB'); 16$lm_array['volt'] = snmpwalk_cache_multi_oid($device, 'lmVoltSensorsEntry', array(), 'LM-SENSORS-MIB'); 17//$lm_array['misc'] = snmpwalk_cache_multi_oid($device, 'lmMiscSensorsEntry', array(), 'LM-SENSORS-MIB'); 18 19$scale = 0.001; 20foreach ($lm_array['temp'] as $index => $entry) 21{ 22 $oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$index"; 23 $descr = str_ireplace(array('temperature-', 'temp-'), '', $entry['lmTempSensorsDevice']); 24 $value = $entry['lmTempSensorsValue']; 25 if ($entry['lmTempSensorsValue'] > 0 && $value * $scale <= 1000) 26 { 27 discover_sensor_ng($device,'temperature', $mib, 'lmTempSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]); 28 } 29} 30 31$scale = 1; 32foreach ($lm_array['fan'] as $index => $entry) 33{ 34 $oid = ".1.3.6.1.4.1.2021.13.16.3.1.3.$index"; 35 $descr = str_ireplace('fan-', '', $entry['lmFanSensorsDevice']); 36 $value = $entry['lmFanSensorsValue']; 37 if ($entry['lmFanSensorsValue'] > 0) 38 { 39 discover_sensor_ng($device,'fanspeed', $mib, 'lmFanSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]); 40 } 41} 42 43$scale = 0.001; 44foreach ($lm_array['volt'] as $index => $entry) 45{ 46 $oid = ".1.3.6.1.4.1.2021.13.16.4.1.3.$index"; 47 $descr = str_ireplace(array('voltage, ', 'volt-'), '', $entry['lmVoltSensorsDevice']); 48 $value = $entry['lmVoltSensorsValue']; 49 if (is_numeric($entry['lmVoltSensorsValue'])) 50 { 51 discover_sensor_ng($device,'voltage', $mib, 'lmVoltSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]); 52 } 53} 54 55// EOF 56