reformat mempool and current discovery

git-svn-id: http://www.observium.org/svn/observer/trunk@1834 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-14 19:24:23 +00:00
parent c00959e44b
commit 0a2371cfc7
13 changed files with 129 additions and 104 deletions

View File

@@ -61,7 +61,7 @@ if ($device['os'] == "apc")
$descr = "Output Feed";
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current));
}
}
}
}
?>

View File

@@ -34,4 +34,5 @@ if ($device['os'] == "gamatronicups")
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current));
}
}
?>

View File

@@ -58,4 +58,5 @@ if ($device['os'] == "ipoman")
}
}
}
?>

View File

@@ -28,9 +28,10 @@ if ($device['os'] == "mgeups")
$lowlimit = 0;
$limit = NULL;
$lowwarnlimit = NULL;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current));
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current));
}
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.6.1", "-OsqnU"));
if ($debug) { echo($oids."\n"); }
$numPhase = count(explode("\n",$oids));
@@ -53,7 +54,9 @@ if ($device['os'] == "mgeups")
$lowlimit = 0;
$limit = NULL;
$lowwarnlimit = NULL;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, $lowwarnlimit, $warnlimit, $limit, $current));
}
}
?>

View File

@@ -24,6 +24,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
$type = "rfc1628";
$index = 500+$current_id;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', NULL, NULL, NULL, NULL, $current));
}
}
@@ -39,6 +40,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = $i;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
@@ -53,6 +55,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = 100+$i;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
@@ -67,6 +70,7 @@ if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
$type = "rfc1628";
$precision = 1;
$index = 200+$i;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', NULL, NULL, NULL, NULL, $current));
}
}

View File

@@ -24,6 +24,7 @@ if ($device['os'] == "powerware")
$descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1));
$type = "xups";
$index = "1.2.3.".$current_id;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}
@@ -39,6 +40,7 @@ if ($device['os'] == "powerware")
$type = "xups";
$divisor = 1;
$index = "4.4.1.3.".$i;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
@@ -53,6 +55,7 @@ if ($device['os'] == "powerware")
$type = "xups";
$divisor = 1;
$index = "3.4.1.3.".$i;
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current));
}
}

View File

@@ -2,15 +2,18 @@
global $valid_mempool;
if($device['os'] == "ios" || $device['os_group'] == "ios") {
if ($device['os'] == "ios" || $device['os_group'] == "ios")
{
echo("CISCO-ENHANCED-MEMORY-POOL: ");
$array = snmpwalk_cache_multi_oid($device, "cempMemPoolEntry", NULL, "CISCO-ENHANCED-MEMPOOL-MIB");
if(is_array($array)) {
foreach($array as $index => $entry) {
if(is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == "true") {
if (is_array($array))
{
foreach ($array as $index => $entry)
{
if (is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == "true")
{
list($entPhysicalIndex) = explode(".", $index);
$entPhysicalName = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
$descr = $entPhysicalDescr." - ".$entry['cempMemPoolName'];

View File

@@ -6,8 +6,8 @@ global $valid_mempool;
$cemp_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `mempools` WHERE `device_id` = '".$device['device_id']."' AND `mempool_type` = 'cemp'"),0);
if(($device['os'] == "ios" || $device['os_group'] == "ios") && $cemp_count == "0") {
if (($device['os'] == "ios" || $device['os_group'] == "ios") && $cemp_count == "0")
{
echo("OLD-CISCO-MEMORY-POOL: ");
$cmp_array = snmpwalk_cache_oid($device, 'ciscoMemoryPool', NULL, "CISCO-MEMORY-POOL-MIB");

View File

@@ -21,16 +21,21 @@ global $valid_mempool;
$array = snmpwalk_cache_oid($device, "hpLocal", NULL, "NETSWITCH-MIB", $config['mibdir'].":".$config['mibdir']."/hp");
$array = snmpwalk_cache_oid($device, "hpGlobal", $array, "NETSWITCH-MIB", $config['mibdir'].":".$config['mibdir']."/hp");
if(is_array($array)) {
echo("procurve : ");
if (is_array($array))
{
echo("Procurve : ");
foreach ($array as $index => $mempool)
{
if(is_numeric($index) && is_numeric($mempool['hpLocalMemTotalBytes'])) {
if (is_numeric($index) && is_numeric($mempool['hpLocalMemTotalBytes']))
{
discover_mempool($valid_mempool, $device, $index, "hpLocal", "Local Memory ".$index, NULL, NULL, NULL);
}
if(is_numeric($index) && is_numeric($mempool['hpGlobalMemTotalBytes'])) {
if (is_numeric($index) && is_numeric($mempool['hpGlobalMemTotalBytes']))
{
discover_mempool($valid_mempool, $device, $index, "hpGlobal", "Global Memory ".$index, NULL, NULL, NULL);
}
unset($deny, $fstype, $descr, $size, $used, $units);
}
unset($array);

View File

@@ -4,7 +4,8 @@ global $valid_mempool;
$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if(is_array($storage_array)) {
if (is_array($storage_array))
{
echo("hrStorage : ");
foreach ($storage_array as $index => $storage)
{
@@ -22,11 +23,14 @@ if(is_array($storage_array)) {
if (strstr($descr, "procfs") || strstr($descr, "/proc")) { $deny = 1; } ## Ignore ProcFS
if(!$deny && is_numeric($index)) {
if (!$deny && is_numeric($index))
{
discover_mempool($valid_mempool, $device, $index, "hrstorage", $descr, $units, NULL, NULL);
}
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd);
}
unset($storage_array);
}

View File

@@ -2,17 +2,15 @@
global $valid_mempool;
if($device['os'] == "ironware" || $device['os_type'] == "ironware") {
if ($device['os'] == "ironware" || $device['os_type'] == "ironware")
{
echo("Ironware Dynamic: ");
$percent = snmp_get($device, "snAgGblDynMemUtil.0", "-OvQ", "FOUNDRY-SN-AGENT-MIB");
if(is_numeric($percent)) {
if (is_numeric($percent))
{
discover_mempool($valid_mempool, $device, 0, "ironware-dyn", "Dynamic Memory", "1", NULL, NULL);
}
}
?>

View File

@@ -11,14 +11,18 @@ if($device['os'] == "junos")
$mempools_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $mempools_array, "JUNIPER-MIB" , $config['install_dir']."/mibs/junos");
if ($debug) { print_r($mempools_array); }
if(is_array($mempools_array)) {
foreach($mempools_array as $index => $entry) {
if($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) {
if (is_array($mempools_array))
{
foreach ($mempools_array as $index => $entry)
{
if ($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan"))
{
if ($debug) { echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingBuffer'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n"); }
$usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
$descr = $entry['jnxOperatingDescr'];
$usage = $entry['jnxOperatingBuffer'];
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) {
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" )
{
discover_mempool($valid_mempool, $device, $index, "junos", $descr, "1", NULL, NULL);
}
} ## End if checks

View File

@@ -2,8 +2,8 @@
global $valid_mempool;
if($device['os'] == "screenos") {
if ($device['os'] == "screenos")
{
echo("ScreenOS: ");
$used = snmp_get($device, ".1.3.6.1.4.1.3224.16.2.1.0", "-OvQ");
@@ -12,10 +12,9 @@ if($device['os'] == "screenos") {
$percent = $used / $total * 100;
if(is_numeric($total) && is_numeric($used)) {
if (is_numeric($total) && is_numeric($used))
{
discover_mempool($valid_mempool, $device, 0, "screenos", "Memory", "1", NULL, NULL);
}
}
?>