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

@@ -12,7 +12,7 @@ if ($device['os'] == "apc")
if ($oids) echo("APC ");
$type = "apc";
$precision = "10";
foreach(explode("\n", $oids) as $data)
foreach (explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
@@ -44,24 +44,24 @@ if ($device['os'] == "apc")
}
}
# ATS
# ATS
$atsCurrent = snmp_get($device, "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1", "-OsqnU", "");
if ($atsCurrent)
{
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1";
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1";
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1";
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1";
$index = 1;
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1";
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1";
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1";
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1";
$index = 1;
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$descr = "Output Feed";
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current));
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, 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

@@ -2,9 +2,9 @@
global $valid_sensor;
if ($device['os'] == "gamatronicups")
if ($device['os'] == "gamatronicups")
{
for ($i = 1; $i <= 3; $i++)
for ($i = 1; $i <= 3; $i++)
{
$current_oid = "GAMATRONIC-MIB::gamatronicLTD.5.4.1.1.3.$i";
$descr = "Input Phase $i";
@@ -19,7 +19,7 @@ if ($device['os'] == "gamatronicups")
echo(discover_sensor($valid_sensor, 'current', $device, $current_oid, $index, $type, $descr, '1', '1', $lowlimit, NULL, NULL, NULL, $current));
}
for ($i = 1; $i <= 3; $i++)
for ($i = 1; $i <= 3; $i++)
{
$current_oid = "GAMATRONIC-MIB::gamatronicLTD.5.5.1.1.3.$i";
$descr = "Output Phase $i";
@@ -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

@@ -7,8 +7,8 @@ if ($device['os'] == "ipoman")
{
echo(" IPOMANII-MIB ");
if(!is_array($cache['ipoman']))
{
if (!is_array($cache['ipoman']))
{
echo("outletConfigDesc ");
$cache['ipoman']['out'] = snmpwalk_cache_multi_oid($device, "outletConfigDesc", $cache['ipoman']['out'], "IPOMANII-MIB");
echo("outletConfigLocation ");
@@ -31,9 +31,9 @@ if ($device['os'] == "ipoman")
$oids_out = snmpwalk_cache_multi_oid($device, "outletStatusCurrent", $oids_out, "IPOMANII-MIB");
// $oids_out = snmpwalk_cache_multi_oid($device, "outletStatusKwatt", $oids_out, "IPOMANII-MIB"); // See above
if(is_array($oids_in))
if (is_array($oids_in))
{
foreach($oids_in as $index => $entry)
foreach ($oids_in as $index => $entry)
{
$cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.' . $index;
$divisor = 1000;
@@ -45,9 +45,9 @@ if ($device['os'] == "ipoman")
}
}
if(is_array($oids_out))
if (is_array($oids_out))
{
foreach($oids_out as $index => $entry)
foreach ($oids_out as $index => $entry)
{
$cur_oid = '.1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.' . $index;
$divisor = 1000;
@@ -58,4 +58,5 @@ if ($device['os'] == "ipoman")
}
}
}
?>

View File

@@ -3,7 +3,7 @@
global $valid_sensor;
## MGE UPS
if ($device['os'] == "mgeups")
if ($device['os'] == "mgeups")
{
echo("MGE ");
$oids = trim(snmp_walk($device, "1.3.6.1.4.1.705.1.7.1", "-OsqnU"));
@@ -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

@@ -3,17 +3,17 @@
global $valid_sensor;
## RFC1628 UPS
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
if ($device['os'] == "netmanplus" || $device['os'] == "deltaups")
{
echo("RFC1628 ");
$oids = snmp_walk($device, "1.3.6.1.2.1.33.1.2.6", "-Osqn", "UPS-MIB");
if ($debug) { echo($oids."\n"); }
$oids = trim($oids);
foreach(explode("\n", $oids) as $data)
foreach (explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
if ($data)
{
list($oid,$descr) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
@@ -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,8 +70,9 @@ 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

@@ -6,14 +6,14 @@ global $valid_sensor;
if ($device['os'] == "powerware")
{
echo("XUPS-MIB ");
$oids = snmp_walk($device, "xupsBatCurrent", "-Osqn", "XUPS-MIB");
if ($debug) { echo($oids."\n"); }
$oids = trim($oids);
foreach(explode("\n", $oids) as $data)
foreach (explode("\n", $oids) as $data)
{
$data = trim($data);
if ($data)
if ($data)
{
list($oid,$descr) = explode(" ", $data,2);
$split_oid = explode('.',$oid);
@@ -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,8 +55,9 @@ 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,26 +2,29 @@
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") {
list($entPhysicalIndex) = explode(".", $index);
$entPhysicalName = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
$descr = $entPhysicalDescr." - ".$entry['cempMemPoolName'];
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'];
$descr = str_replace("Cisco ", "", $descr);
$descr = str_replace("Network Processing Engine", "", $descr);
$descr = str_replace("Cisco ", "", $descr);
$descr = str_replace("Network Processing Engine", "", $descr);
discover_mempool($valid_mempool, $device, $index, "cemp", $descr, "1", $entPhysicalIndex, NULL);
discover_mempool($valid_mempool, $device, $index, "cemp", $descr, "1", $entPhysicalIndex, NULL);
}
}
}
}
?>
?>

View File

@@ -6,19 +6,19 @@ 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");
if(is_array($cmp_array)) {
foreach($cmp_array as $index => $cmp) {
if(is_numeric($cmp['ciscoMemoryPoolUsed']) && is_numeric($index)) {
if (is_array($cmp_array)) {
foreach ($cmp_array as $index => $cmp) {
if (is_numeric($cmp['ciscoMemoryPoolUsed']) && is_numeric($index)) {
discover_mempool($valid_mempool, $device, $index, "cmp", $cmp['ciscoMemoryPoolName'], "1", NULL, NULL);
}
}
}
}
?>
?>

View File

@@ -2,38 +2,43 @@
global $valid_mempool;
#NETSWITCH-MIB::hpLocalMemSlotIndex.1 = INTEGER: 1
#NETSWITCH-MIB::hpLocalMemSlabCnt.1 = Counter32: 3966
#NETSWITCH-MIB::hpLocalMemFreeSegCnt.1 = Counter32: 166
#NETSWITCH-MIB::hpLocalMemAllocSegCnt.1 = Counter32: 3803
#NETSWITCH-MIB::hpLocalMemTotalBytes.1 = INTEGER: 11337704
#NETSWITCH-MIB::hpLocalMemFreeBytes.1 = INTEGER: 9669100
#NETSWITCH-MIB::hpLocalMemAllocBytes.1 = INTEGER: 1668732
#NETSWITCH-MIB::hpLocalMemSlotIndex.1 = INTEGER: 1
#NETSWITCH-MIB::hpLocalMemSlabCnt.1 = Counter32: 3966
#NETSWITCH-MIB::hpLocalMemFreeSegCnt.1 = Counter32: 166
#NETSWITCH-MIB::hpLocalMemAllocSegCnt.1 = Counter32: 3803
#NETSWITCH-MIB::hpLocalMemTotalBytes.1 = INTEGER: 11337704
#NETSWITCH-MIB::hpLocalMemFreeBytes.1 = INTEGER: 9669100
#NETSWITCH-MIB::hpLocalMemAllocBytes.1 = INTEGER: 1668732
#NETSWITCH-MIB::hpGlobalMemSlotIndex.1 = INTEGER: 1
#NETSWITCH-MIB::hpGlobalMemSlabCnt.1 = Counter32: 3966
#NETSWITCH-MIB::hpGlobalMemFreeSegCnt.1 = Counter32: 166
#NETSWITCH-MIB::hpGlobalMemAllocSegCnt.1 = Counter32: 3803
#NETSWITCH-MIB::hpGlobalMemTotalBytes.1 = INTEGER: 11337704
#NETSWITCH-MIB::hpGlobalMemFreeBytes.1 = INTEGER: 9669104
#NETSWITCH-MIB::hpGlobalMemAllocBytes.1 = INTEGER: 1668728
#NETSWITCH-MIB::hpGlobalMemSlotIndex.1 = INTEGER: 1
#NETSWITCH-MIB::hpGlobalMemSlabCnt.1 = Counter32: 3966
#NETSWITCH-MIB::hpGlobalMemFreeSegCnt.1 = Counter32: 166
#NETSWITCH-MIB::hpGlobalMemAllocSegCnt.1 = Counter32: 3803
#NETSWITCH-MIB::hpGlobalMemTotalBytes.1 = INTEGER: 11337704
#NETSWITCH-MIB::hpGlobalMemFreeBytes.1 = INTEGER: 9669104
#NETSWITCH-MIB::hpGlobalMemAllocBytes.1 = INTEGER: 1668728
$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");
$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 : ");
foreach($array as $index => $mempool)
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,9 +4,10 @@ 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)
foreach ($storage_array as $index => $storage)
{
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
@@ -18,16 +19,19 @@ if(is_array($storage_array)) {
if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam") { $deny = 0; }
if ($device['os'] == "routeros" && $descr == "main memory") { $deny = 0; }
if(strstr($descr, "MALLOC") || strstr($descr, "UMA")) { $deny = 1; } ## Ignore FreeBSD INSANITY
if(strstr($descr, "procfs") || strstr($descr, "/proc")) { $deny = 1; } ## Ignore ProcFS
if (strstr($descr, "MALLOC") || strstr($descr, "UMA")) { $deny = 1; } ## Ignore FreeBSD INSANITY
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

@@ -3,22 +3,26 @@
global $valid_mempool;
## JUNOS mempools
if($device['os'] == "junos")
if ($device['os'] == "junos")
{
echo("JUNOS : ");
$mempools_array = snmpwalk_cache_multi_oid($device, "jnxOperatingBuffer", $mempools_array, "JUNIPER-MIB" , $config['install_dir']."/mibs/junos");
$mempools_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $mempools_array, "JUNIPER-MIB" , $config['install_dir']."/mibs/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 ($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
@@ -26,6 +30,6 @@ if($device['os'] == "junos")
} ## End if array
} ## End JUNOS mempools
unset ($mempools_array);
unset ($mempools_array);
?>
?>

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