mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 02:48:37 +00:00
junos mempools
git-svn-id: http://www.observium.org/svn/observer/trunk@949 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
db6a452970
commit
1c70cab047
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
?>
|
||||
|
29
includes/discovery/mempools-junos.inc.php
Executable file
29
includes/discovery/mempools-junos.inc.php
Executable 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);
|
||||
|
||||
?>
|
@ -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
|
||||
|
19
includes/polling/mempools-junos.inc.php
Executable file
19
includes/polling/mempools-junos.inc.php
Executable 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'];
|
||||
|
||||
?>
|
@ -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 \
|
||||
|
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user