some updates to fdb_count graph and entity-sensor discovery (ignore temp > 200C, and use Name instead of Descr if available)

git-svn-id: http://www.observium.org/svn/observer/trunk@1544 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-30 14:50:09 +00:00
parent 985ec190c6
commit 71a0ffab1e
2 changed files with 13 additions and 9 deletions

View File

@@ -7,11 +7,10 @@ include("includes/graphs/common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/fdb_count.rrd";
$rrd_options .= " DEF:value=$rrd_filename:value:AVERAGE";
$rrd_options .= " CDEF:cvalue=value,86400,/";
$rrd_options .= " COMMENT:'MACs Current Minimum Maximum Average\\n'";
$rrd_options .= " AREA:cvalue#EEEEEE:value";
$rrd_options .= " LINE1.25:cvalue#36393D:";
$rrd_options .= " GPRINT:cvalue:LAST:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\ ";
$rrd_options .= " GPRINT:cvalue:MAX:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\\\\n";
$rrd_options .= " AREA:value#EEEEEE:value";
$rrd_options .= " LINE1.25:value#36393D:";
$rrd_options .= " GPRINT:value:LAST:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\ ";
$rrd_options .= " GPRINT:value:MAX:%6.2lf\ GPRINT:cvalue:AVERAGE:%6.2lf\\\\n";
?>

View File

@@ -33,6 +33,11 @@ if(is_array($oids[$device['device_id']]))
$current = $entry['entPhySensorValue'];
#ENTITY-SENSOR-MIB::entPhySensorUnitsDisplay.11 = STRING: "C"
$descr = snmp_get($device, "entPhysicalName.".$index, "-Oqv", "ENTITY-MIB");
if(!$descr) { snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB"); }
$valid = TRUE
$type = $entitysensor[$entry['entPhySensorType']];
$descr = str_replace("temperature", "", $descr);
@@ -49,12 +54,12 @@ if(is_array($oids[$device['device_id']]))
if($entry['entPhySensorScale'] == "mega") { $divisor = "1"; $multiplier = "1000000"; }
if($entry['entPhySensorScale'] == "giga") { $divisor = "1"; $multiplier = "1000000000"; }
if(is_numeric($entry['entPhySensorPrecision']) && $entry['entPhySensorPrecision'] > "0") { $multiplier = $multiplier . str_pad('', $entry['entPhySensorPrecision'], "0"); }
#echo("|".$entry['entPhySensorScale']."|".$entry['entPhySensorPrecision']."|".$divisor."|".$multiplier."|");
$current = $current * $multiplier / $divisor;
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0")
if($type == "temperature") { if($current > "200"){ $valid = FALISE; } }
if($valid && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0")
## Check to make sure we've not already seen this sensor via cisco's entity sensor mib
{
discover_sensor($valid_sensor, $type, $device, $oid, $index, 'entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current);