mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
many small fixes, hacky way to ignore no more variables, fix up supermicro sensor limits, loosen automatic sensor limit settings a bit
git-svn-id: http://www.observium.org/svn/observer/trunk@1675 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
global $valid_sensor;
|
||||
|
||||
echo(" ENTITY-SENSOR");
|
||||
echo(" ENTITY-SENSOR ");
|
||||
|
||||
echo("\nCaching OIDs:");
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ if ($device['os'] == "linux")
|
||||
$monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10.$index";
|
||||
$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");
|
||||
$low_limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
#$divisor = snmp_get($device, $divisor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
|
||||
# ^ This returns an incorrect precision. At least using the raw value... I think. -TL
|
||||
$divisor = "1";
|
||||
@@ -35,7 +35,7 @@ if ($device['os'] == "linux")
|
||||
$descr = str_replace(' Speed','',$descr);
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $fan_oid, $index, 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
|
||||
discover_sensor($valid_sensor, 'fanspeed', $device, $fan_oid, $index, 'supermicro', $descr, $divisor, '1', $low_limit, NULL, NULL, NULL, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
### Discover sensors
|
||||
function discover_sensor (&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
function discover_sensor (&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
@@ -83,7 +83,7 @@ function sensor_low_limit ($class, $current) {
|
||||
$limit = $current * 0.7;
|
||||
break;
|
||||
case 'voltage':
|
||||
$limit = $current * 0.95;
|
||||
$limit = $current * 0.85;
|
||||
break;
|
||||
case 'humidity':
|
||||
$limit = "70";
|
||||
@@ -108,10 +108,10 @@ function sensor_limit ($class, $current) {
|
||||
|
||||
switch($class) {
|
||||
case 'temperature':
|
||||
$limit = $current * 1.20;
|
||||
$limit = $current * 1.60;
|
||||
break;
|
||||
case 'voltage':
|
||||
$limit = $current * 1.05;
|
||||
$limit = $current * 1.15;
|
||||
break;
|
||||
case 'humidity':
|
||||
$limit = "70";
|
||||
@@ -120,7 +120,7 @@ function sensor_limit ($class, $current) {
|
||||
$limit = $current * 1.05;
|
||||
break;
|
||||
case 'current':
|
||||
$limit = $current * 1.20;
|
||||
$limit = $current * 1.50;
|
||||
break;
|
||||
case 'fanspeed':
|
||||
$limit = $current * 1.30;
|
||||
|
||||
@@ -31,7 +31,7 @@ if($device['os'] == "linux")
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
$descr = trim(str_ireplace("temperature", "", $descr));
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, trim($index,'.'), 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, NULL, $temperature);
|
||||
discover_sensor($valid_sensor, 'temperature', $device, $temperature_oid, trim($index,'.'), 'supermicro', $descr, $divisor, '1', NULL, NULL, NULL, $limit, $temperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ if ($device['os'] == "linux")
|
||||
|
||||
if ($monitor == 'true')
|
||||
{
|
||||
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, NULL, $limit, NULL, $current);
|
||||
echo discover_sensor($valid_sensor, 'voltage', $device, $volt_oid, $index, $type, $descr, $divisor, '1', $lowlimit, NULL, NULL, $limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-2
@@ -74,8 +74,20 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
|
||||
$runtime_stats['snmpwalk']++;
|
||||
if($debug) { echo("$data\n"); }
|
||||
if (is_string($data) && (preg_match("/No Such (Object|Instance)/i", $data)))
|
||||
## || preg_match("/No more variables left/i", $data)))
|
||||
{ $data = false; } else { return $data; }
|
||||
{
|
||||
$data = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match("/No more variables left in this MIB View \(It is past the end of the MIB tree\)$/",$data))
|
||||
{
|
||||
# Bit ugly :-(
|
||||
$d_ex = explode("\n",$data);
|
||||
unset($d_ex[count($d_ex)-1]);
|
||||
$data = implode("\n",$d_ex);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
|
||||
|
||||
Reference in New Issue
Block a user