junos mempools

git-svn-id: http://www.observium.org/svn/observer/trunk@949 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-02-25 01:30:07 +00:00
parent db6a452970
commit 1c70cab047
8 changed files with 67 additions and 5 deletions

View File

@ -115,3 +115,5 @@ ALTER TABLE `storage` CHANGE `storage_id` `storage_id` INT( 11 ) NOT NULL AUTO_I
ALTER TABLE `storage` ADD `storage_mib` VARCHAR( 16 ) NOT NULL AFTER `device_id`;
ALTER TABLE `storage` ADD `storage_free` INT NOT NULL AFTER `storage_used`;
ALTER TABLE `storage` CHANGE `storage_size` `storage_size` BIGINT NOT NULL ,CHANGE `storage_used` `storage_used` BIGINT NOT NULL ,CHANGE `storage_free` `storage_free` BIGINT NOT NULL;
ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 20 ) NOT NULL ,
CHANGE `mempool_free` `mempool_free` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 20 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 20 ) NULL DEFAULT NULL;

View File

@ -207,7 +207,15 @@ echo("</td>");
echo("</td></tr>");
// If we're showing graphs, generate the graph and print the img tags
if($graph_type && is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/". safename($interface['ifIndex'] . ".rrd"))) {
if($graph_type == "etherlike")
{
$graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-". safename($interface['ifIndex']) . ".rrd";
} else {
$graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/". safename($interface['ifIndex']) . ".rrd";
}
if($graph_type && is_file($graph_file)) {
$type = $graph_type;

View File

@ -96,4 +96,8 @@ $config['ignore_mount_removable'] = 1; # Ignore removable disk storage
$config['ignore_mount_network'] = 1; # Ignore network mounted storage
$config['ignore_junos_os_drives'] = array("/on: \/packages/", "/on: \/dev/", "/on: \/proc/"); # Ignore JunOS partitions who are always 100%
# Ports
$config['enable_ports_etherlike'] = 0; # Enable EtherLike-MIB
?>

View File

@ -0,0 +1,29 @@
<?php
## JUNOS mempools
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(is_array($mempools_array[$device['device_id']])) {
foreach($mempools_array[$device['device_id']] 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 != "" ) {
discover_mempool($valid_mempool, $device, $index, "junos", $descr, "1", NULL, NULL);
}
} ## End if checks
} ## End Foreach
} ## End if array
} ## End JUNOS mempools
unset ($mempools_array);
?>

View File

@ -3,6 +3,7 @@
echo("Memory : ");
include("mempools-cmp.inc.php");
include("mempools-junos.inc.php");
include("mempools-ironware-dyn.inc.php");
### Remove memory pools which weren't redetected here

View File

@ -0,0 +1,19 @@
<?php
$oid = $mempool['mempool_index'];
if(!is_array($mempool_cache['junos'])) {
$mempool_cache['junos'] = array();
$mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingBuffer", $mempool_cache['junos'], "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
$mempool_cache['junos'] = snmpwalk_cache_multi_oid($device, "jnxOperatingDRAMSize", $mempool_cache['junos'], "JUNIPER-MIB" , "+".$config['install_dir']."/mibs/junos");
if($debug) {print_r($mempool_cache);}
}
$entry = $mempool_cache['junos'][$device[device_id]][$mempool[mempool_index]];
$perc = $entry['jnxOperatingBuffer'];
$mempool['total'] = $entry['jnxOperatingDRAMSize'];
$mempool['used'] = $entry['jnxOperatingDRAMSize'] / 100 * $perc;
$mempool['free'] = $entry['jnxOperatingDRAMSize'] - $mempool['used'];
?>

View File

@ -1,5 +1,7 @@
<?php
echo("Memory: ");
$query = "SELECT * FROM mempools WHERE device_id = '" . $device['device_id'] . "'";
$mempool_data = mysql_query($query);
while($mempool = mysql_fetch_array($mempool_data)) {
@ -9,8 +11,7 @@ while($mempool = mysql_fetch_array($mempool_data)) {
$mempoolrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("mempool-" . $mempool['mempool_type'] . "-" . $mempool['mempool_index'] . ".rrd");
if (!is_file($mempoolrrd)) {
shell_exec("rrdtool create $mempoolrrd \
--step 300 \
rrdtool_create($mempoolrrd, "--step 300 \
DS:used:GAUGE:600:-273:100000000000 \
DS:free:GAUGE:600:-273:100000000000 \
RRA:AVERAGE:0.5:1:600 \

View File

@ -9,8 +9,6 @@ if(!is_array($storage_cache['hrstorage'])) {
$entry = $storage_cache['hrstorage'][$device[device_id]][$storage[storage_index]];
print_r($entry);
$storage['units'] = $entry['hrStorageAllocationUnits'];
$storage['used'] = $entry['hrStorageUsed'] * $storage['units'];
$storage['size'] = $entry['hrStorageSize'] * $storage['units'];