mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add CISCO-ENHANCED-MEMPOOL-MIB support to new mempool discovery/poller
git-svn-id: http://www.observium.org/svn/observer/trunk@1002 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -92,7 +92,7 @@ while ($device = mysql_fetch_array($device_query))
|
||||
#include("includes/discovery/os.inc.php");
|
||||
|
||||
include("includes/discovery/ports.inc.php");
|
||||
# include("includes/discovery/entity-physical.inc.php");
|
||||
include("includes/discovery/entity-physical.inc.php");
|
||||
include("includes/discovery/processors.inc.php");
|
||||
include("includes/discovery/mempools.inc.php");
|
||||
include("includes/discovery/ipv4-addresses.inc.php");
|
||||
|
@@ -91,7 +91,9 @@ function discover_processor(&$valid_processor, $device, $oid, $index, $type, $de
|
||||
function discover_mempool(&$valid_mempool, $device, $index, $type, $descr, $precision = "1", $entPhysicalIndex = NULL, $hrDeviceIndex = NULL) {
|
||||
|
||||
global $config; global $debug;
|
||||
if($debug) { echo("$device, $oid, $index, $type, $descr, $precision, $current, $entPhysicalIndex, $hrDeviceIndex\n"); }
|
||||
if($debug) {
|
||||
echo("$device, $oid, $index, $type, $descr, $precision, $current, $entPhysicalIndex, $hrDeviceIndex\n");
|
||||
}
|
||||
if($descr) {
|
||||
if(mysql_result(mysql_query("SELECT count(mempool_id) FROM `mempools` WHERE `mempool_index` = '$index' AND `device_id` = '".$device['device_id']."' AND `mempool_type` = '$type'"),0) == '0') {
|
||||
$query = "INSERT INTO mempools (`entPhysicalIndex`, `hrDeviceIndex`, `device_id`, `mempool_descr`, `mempool_index`, `mempool_type`, `mempool_precision`)
|
||||
@@ -101,8 +103,11 @@ function discover_mempool(&$valid_mempool, $device, $index, $type, $descr, $prec
|
||||
echo("+");
|
||||
} else {
|
||||
echo(".");
|
||||
$query = "UPDATE `mempools` SET `mempool_descr` = '".$descr."' WHERE `device_id` = '".$device['device_id']."' AND `mempool_index` = '".$index."' AND `mempool_type` = '".$type."'";
|
||||
mysql_query($query);
|
||||
# entry = mysql_fetch_assoc(mysql_query());
|
||||
|
||||
$query = "UPDATE `mempools` SET `mempool_descr` = '".$descr."', `entPhysicalIndex` = '$entPhysicalIndex', `hrDeviceIndex` = '$hrDeviceIndex' WHERE `device_id` = '".$device['device_id']."' AND `mempool_index` = '".$index."' AND `mempool_type` = '".$type."'";
|
||||
echo("$query");
|
||||
mysql_query($query);
|
||||
if($debug) { print $query . "\n"; }
|
||||
}
|
||||
$valid_mempool[$type][$index] = 1;
|
||||
|
21
includes/discovery/mempools-cemp.inc.php
Executable file
21
includes/discovery/mempools-cemp.inc.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "ios" || $device['os_type'] == "ios") {
|
||||
|
||||
echo("CISCO-ENHANCED-MEMORY-POOL: ");
|
||||
|
||||
$array = snmpwalk_cache_multi_oid($device, "cempMemPoolEntry", array(), "CISCO-ENHANCED-MEMPOOL-MIB");
|
||||
|
||||
if(is_array($array)) {
|
||||
foreach($array[$device[device_id]] as $index => $entry) {
|
||||
if(is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == "true") {
|
||||
list($entPhysicalIndex) = explode(".", $index);
|
||||
$entPhysicalDescr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
|
||||
$descr = $entPhysicalDescr." - ".$entry['cempMemPoolName'];
|
||||
discover_mempool($valid_mempool, $device, $index, "cemp", $descr, "1", $entPhysicalIndex, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "ios" || $device['os_type'] == "ios") {
|
||||
## Ignore this discovery module if we have already discovered things in CISCO-ENHANCED-MEMPOOL-MIB. Dirty duplication.
|
||||
|
||||
$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_type'] == "ios") && $cemp_count == "0") {
|
||||
|
||||
echo("OLD-CISCO-MEMORY-POOL: ");
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
echo("Memory : ");
|
||||
|
||||
include("mempools-cemp.inc.php");
|
||||
include("mempools-cmp.inc.php");
|
||||
include("mempools-junos.inc.php");
|
||||
include("mempools-ironware-dyn.inc.php");
|
||||
|
@@ -92,8 +92,8 @@
|
||||
rrdtool_update ($memrrd, "N:$memfreeio:$memusedio:$memfreeproc:$memusedproc:$memtotal");
|
||||
|
||||
# include("includes/polling/cisco-processors.inc.php");
|
||||
include("includes/polling/cisco-enhanced-mempool.inc.php");
|
||||
include("includes/polling/cisco-mempool.inc.php");
|
||||
include("includes/polling/cisco-entity-sensors.inc.php");
|
||||
# include("includes/polling/cisco-enhanced-mempool.inc.php");
|
||||
# include("includes/polling/cisco-mempool.inc.php");
|
||||
# include("includes/polling/cisco-entity-sensors.inc.php");
|
||||
|
||||
?>
|
||||
|
16
includes/polling/mempools-cemp.inc.php
Executable file
16
includes/polling/mempools-cemp.inc.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$oid = $mempool['mempool_index'];
|
||||
|
||||
$pool_cmd = $config['snmpget'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$pool_cmd .= " cempMemPoolUsed.$oid cempMemPoolFree.$oid cempMemPoolLargestFree.$oid";
|
||||
$pool_cmd .= " | cut -f 1 -d ' '";
|
||||
|
||||
echo("$pool_cmd");
|
||||
|
||||
$pool = shell_exec($pool_cmd);
|
||||
|
||||
list($mempool['used'], $mempool['free'], $mempool['largestfree']) = explode("\n", $pool);
|
||||
$mempool['total'] = $mempool['used'] + $mempool['free'];
|
||||
|
||||
?>
|
@@ -32,7 +32,7 @@ while($mempool = mysql_fetch_array($mempool_data)) {
|
||||
if(is_file($file)) {
|
||||
include($file);
|
||||
} else {
|
||||
### FIXME GENERIC
|
||||
### Do we need a generic mempool poller?
|
||||
}
|
||||
|
||||
$percent = round($mempool['used'] * $mempool['total'] * 100);
|
||||
|
Reference in New Issue
Block a user