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:
Tom Laermans
2010-08-13 13:17:53 +00:00
parent 61412a70f1
commit a1bf48e63e
9 changed files with 31 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ if (file_exists('.svn'))
include("fix-events.php"); ## Fix events table (needs to copy some data around, so needs script)
}
if($db_rev+0 < 1656) { //FIXME
if($db_rev+0 < 1656) {
include('fix-port-rrd.php'); ## Rewrites all port RRDs. Nothing will work without this after 1656
}

View File

@@ -8,12 +8,12 @@ include("includes/graphs/common.inc.php");
$rrd_options .= " -u 100 -l 0 -E -b 1024 ";
$iter = "1"; $i=1;
$rrd_options .= " COMMENT:' Cur Max\\n'";
$rrd_options .= " COMMENT:' Min Cur Max\\n'";
while($mempool = mysql_fetch_array($query)) {
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 28),0,28);
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 22),0,22);
$descr = str_replace(":", "\:", $descr);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
if(is_file($rrd_filename))
@@ -22,8 +22,9 @@ while($mempool = mysql_fetch_array($query)) {
$rrd_options .= " DEF:mempoolused$i=$rrd_filename:used:AVERAGE ";
$rrd_options .= " CDEF:mempooltotal$i=mempoolused$i,mempoolused$i,mempoolfree$i,+,/,100,* ";
$rrd_options .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' ";
$rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf";
$rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf\\\l ";
$rrd_options .= " GPRINT:mempooltotal$i:MIN:%3.0lf%%";
$rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf%%";
$rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf%%\\\l ";
$iter++; $i++;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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)