mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: rfc1628 runtime - allow os quirks (#7340)
* fix: rfc1628 runtime - allow os quirks Also, properly divide values at discovery Remove accidental debug output
This commit is contained in:
committed by
Neil Lathwood
parent
65b29d5563
commit
b4d804f2ac
@@ -978,6 +978,16 @@ function get_device_divisor($device, $os_version, $sensor_type, $oid)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($sensor_type == 'runtime') {
|
||||
if (starts_with($oid, '.1.3.6.1.2.1.33.1.2.2.')) {
|
||||
return 60;
|
||||
}
|
||||
|
||||
if (starts_with($oid, '.1.3.6.1.2.1.33.1.2.3.')) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ $secs_on_battery_oid = '.1.3.6.1.2.1.33.1.2.2.0';
|
||||
$secs_on_battery = snmp_get($device, $secs_on_battery_oid, '-Oqv');
|
||||
|
||||
if (is_numeric($secs_on_battery)) {
|
||||
$divisor = get_device_divisor($device, $pre_cache['poweralert_serial'], 'runtime', $secs_on_battery_oid);
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'runtime',
|
||||
@@ -15,13 +16,13 @@ if (is_numeric($secs_on_battery)) {
|
||||
100,
|
||||
'rfc1628',
|
||||
'Time on battery',
|
||||
60,
|
||||
$divisor,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
$secs_on_battery
|
||||
$secs_on_battery / $divisor
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,6 +32,7 @@ $est_battery_time_oid = ".1.3.6.1.2.1.33.1.2.3.0";
|
||||
$est_battery_time = snmp_get($device, $est_battery_time_oid, '-Ovq');
|
||||
|
||||
if (is_numeric($est_battery_time)) {
|
||||
$divisor = get_device_divisor($device, $pre_cache['poweralert_serial'], 'runtime', $est_battery_time_oid);
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'runtime',
|
||||
@@ -39,13 +41,13 @@ if (is_numeric($est_battery_time)) {
|
||||
200,
|
||||
'rfc1628',
|
||||
'Estimated battery time remaining',
|
||||
1,
|
||||
$divisor,
|
||||
1,
|
||||
5,
|
||||
10,
|
||||
null,
|
||||
10000,
|
||||
$est_battery_time
|
||||
$est_battery_time / $divisor
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,6 @@ function poll_sensor($device, $class)
|
||||
$mibdir = null;
|
||||
|
||||
$sensor_value = trim(str_replace('"', '', $snmp_data[$sensor['sensor_oid']]));
|
||||
echo "HERE $sensor_value END".PHP_EOL;
|
||||
|
||||
if (file_exists('includes/polling/sensors/'. $class .'/'. $device['os'] .'.inc.php')) {
|
||||
require 'includes/polling/sensors/'. $class .'/'. $device['os'] .'.inc.php';
|
||||
|
Reference in New Issue
Block a user