Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -6,57 +6,65 @@
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
* @copyright (C) Adam Armstrong
*
*/
$lm_array['temp'] = snmpwalk_cache_oid($device, 'lmTempSensorsEntry', array(), 'LM-SENSORS-MIB');
$lm_array['fan'] = snmpwalk_cache_oid($device, 'lmFanSensorsEntry', array(), 'LM-SENSORS-MIB');
$lm_array['volt'] = snmpwalk_cache_oid($device, 'lmVoltSensorsEntry', array(), 'LM-SENSORS-MIB');
//$lm_array['misc'] = snmpwalk_cache_oid($device, 'lmMiscSensorsEntry', array(), 'LM-SENSORS-MIB');
$scale = 0.001;
foreach ($lm_array['temp'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$index";
$descr = str_ireplace(array('temperature-', 'temp-'), '', $entry['lmTempSensorsDevice']);
$value = $entry['lmTempSensorsValue'];
/* VM:
lmTempSensorsDevice.1 = Core 0
lmTempSensorsDevice.2 = Core 1
lmTempSensorsValue.1 = 100000
lmTempSensorsValue.2 = 100000
*/
if ($entry['lmTempSensorsValue'] > 0 &&
$value != 100000 && // VM always report 100000
$value * $scale <= 200)
{
discover_sensor_ng($device,'temperature', $mib, 'lmTempSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
if (!isset($valid['sensor']['temperature']['UBNT-EdgeMAX-MIB-ubntThermTemperature']) &&
!isset($valid['sensor']['temperature']['ENTITY-SENSOR-MIB-entPhySensorValue'])) {
$scale = 0.001;
$oids = snmpwalk_cache_oid($device, 'lmTempSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$index";
$descr = str_ireplace([ 'temperature-', 'temp-', 'temp_' ], '', $entry['lmTempSensorsDevice']);
$value = $entry['lmTempSensorsValue'];
/* VM:
lmTempSensorsDevice.1 = Core 0
lmTempSensorsDevice.2 = Core 1
lmTempSensorsValue.1 = 100000
lmTempSensorsValue.2 = 100000
*/
if ($entry['lmTempSensorsValue'] > 0 &&
$value != 100000 && // VM always report 100000
$value * $scale <= 200) {
discover_sensor_ng($device, 'temperature', $mib, 'lmTempSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
}
$scale = 1;
foreach ($lm_array['fan'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.3.1.3.$index";
$descr = str_ireplace('fan-', '', $entry['lmFanSensorsDevice']);
$value = $entry['lmFanSensorsValue'];
if ($entry['lmFanSensorsValue'] > 0)
{
discover_sensor_ng($device,'fanspeed', $mib, 'lmFanSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
if (!isset($valid['sensor']['fanspeed']['UBNT-EdgeMAX-MIB-ubntFanRpm']) &&
!isset($valid['sensor']['fanspeed']['ENTITY-SENSOR-MIB-entPhySensorValue'])) {
$scale = 1;
$oids = snmpwalk_cache_oid($device, 'lmFanSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.3.1.3.$index";
$descr = str_ireplace('fan-', '', $entry['lmFanSensorsDevice']);
$value = $entry['lmFanSensorsValue'];
if ($entry['lmFanSensorsValue'] > 0) {
discover_sensor_ng($device, 'fanspeed', $mib, 'lmFanSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
}
$scale = 0.001;
foreach ($lm_array['volt'] as $index => $entry)
{
$oid = ".1.3.6.1.4.1.2021.13.16.4.1.3.$index";
$descr = str_ireplace(array('voltage, ', 'volt-'), '', $entry['lmVoltSensorsDevice']);
$value = $entry['lmVoltSensorsValue'];
if (is_numeric($entry['lmVoltSensorsValue']))
{
discover_sensor_ng($device,'voltage', $mib, 'lmVoltSensorsValue', $oid, $index, NULL, $descr, $scale, $value, ['rename_rrd' => "lmsensors-$index"]);
}
}
//if (!isset($valid['sensor']['voltage'])) {
$scale = 0.001;
$oids = snmpwalk_cache_oid($device, 'lmVoltSensorsEntry', [], 'LM-SENSORS-MIB');
foreach ($oids as $index => $entry) {
$oid = ".1.3.6.1.4.1.2021.13.16.4.1.3.$index";
$descr = str_ireplace([ 'voltage, ', 'volt-' ], '', $entry['lmVoltSensorsDevice']);
$value = $entry['lmVoltSensorsValue'];
if (is_numeric($entry['lmVoltSensorsValue']) && ($entry['lmVoltSensorsValue'] < 4000000000)) {
// LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: in1
// LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: in2
// LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 4294967234
// LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 273
discover_sensor_ng($device, 'voltage', $mib, 'lmVoltSensorsValue', $oid, $index, $descr, $scale, $value, [ 'rename_rrd' => "lmsensors-$index" ]);
}
}
//}
//$oids = snmpwalk_cache_oid($device, 'lmMiscSensorsEntry', array(), 'LM-SENSORS-MIB');
unset($oids);
// EOF