mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
retooled sensors discovery. use global $valid_sensor, use sensors table only, replace sensor_precision with sensor_multiplier and sensor_divisor, remove all old discover_* functions and replace with discover_sensor
git-svn-id: http://www.observium.org/svn/observer/trunk@1529 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## Areca Fanspeeds
|
||||
if ($device['os'] == "areca")
|
||||
@@ -8,8 +8,6 @@ if ($device['os'] == "areca")
|
||||
$oids = snmp_walk($device, "1.3.6.1.4.1.18928.1.2.2.1.9.1.2", "-OsqnU", "");
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
if ($oids) echo("Areca ");
|
||||
$precision = 1;
|
||||
$type = "areca";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -20,7 +18,7 @@ if ($device['os'] == "areca")
|
||||
$index = $split_oid[count($split_oid)-1];
|
||||
$oid = "1.3.6.1.4.1.18928.1.2.2.1.9.1.3." . $index;
|
||||
$current = snmp_get($device, $oid, "-Oqv", "") / $precision;
|
||||
discover_fan($valid_fan,$device, $oid, $index, $type, trim($descr,'"'), $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'areca', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## LMSensors Fanspeeds
|
||||
if ($device['os'] == "linux")
|
||||
@@ -9,8 +9,6 @@ if ($device['os'] == "linux")
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
$oids = trim($oids);
|
||||
if ($oids) echo("LM-SENSORS ");
|
||||
$precision = 1;
|
||||
$type = 'lmsensors';
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -23,10 +21,10 @@ if ($device['os'] == "linux")
|
||||
$current = snmp_get($device, $oid, "-Oqv", "LM-SENSORS-MIB");
|
||||
$descr = trim(str_ireplace("fan-", "", $descr));
|
||||
if($current > '0' && $current < '500') {
|
||||
discover_fan($valid_fan,$device, $oid, $index, $type, $descr, $precision, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'lmsensors', $descr, '1', '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
global $valid_fan;
|
||||
global $valid_sensor;
|
||||
|
||||
## Supermicro Fanspeeds
|
||||
if ($device['os'] == "linux")
|
||||
@@ -9,7 +9,6 @@ if ($device['os'] == "linux")
|
||||
if ($debug) { echo($oids."\n"); }
|
||||
$oids = trim($oids);
|
||||
if ($oids) echo("Supermicro ");
|
||||
$type = "supermicro";
|
||||
foreach(explode("\n", $oids) as $data)
|
||||
{
|
||||
$data = trim($data);
|
||||
@@ -28,16 +27,15 @@ if ($device['os'] == "linux")
|
||||
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$current = snmp_get($device, $fan_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# $precision = snmp_get($device, $precision_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# This returns an incorrect precision. At least using the raw value... I think. -TL
|
||||
$precision = 1;
|
||||
#$precision = snmp_get($device, $precision_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# This returns an incorrect precision. At least using the raw value... I think. -TL
|
||||
$divisor = "1";
|
||||
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
$descr = str_replace(' Fan Speed','',$descr);
|
||||
$descr = str_replace(' Speed','',$descr);
|
||||
|
||||
$descr = str_replace(' Speed','',$descr);
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
echo discover_fan($valid_fan,$device, $fan_oid, $index, $type, $descr, $precision, $limit, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $oid, $index, 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user