mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 08:02:23 +02:00
add VRP. break some layout.
git-svn-id: http://www.observium.org/svn/observer/trunk@2567 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
## Huawei VRP mempools
|
||||
if($device['os'] == "vrp")
|
||||
{
|
||||
echo("VRP : ");
|
||||
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs");
|
||||
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs");
|
||||
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityBomEnDesc", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs");
|
||||
if($debug) { print_r($mempools_array); }
|
||||
|
||||
if(is_array($mempools_array)) {
|
||||
foreach($mempools_array as $index => $entry) {
|
||||
|
||||
if($entry['hwEntityMemSize'] != 0 ) {
|
||||
if ($debug) { echo($index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityMemUsage'] . " -> " . $entry['hwEntityMemSize'] . "\n"); }
|
||||
echo($index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityMemUsage'] . " -> " . $entry['hwEntityMemSize'] . "\n");
|
||||
$usage_oid = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7." . $index;
|
||||
$descr = $entry['hwEntityBomEnDesc'];
|
||||
$usage = $entry['hwEntityMemUsage'];
|
||||
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) {
|
||||
discover_mempool($valid_mempool, $device, $index, "vrp", $descr, "1", NULL, NULL);
|
||||
}
|
||||
} ## End if checks
|
||||
} ## End Foreach
|
||||
} ## End if array
|
||||
} ## End VRP mempools
|
||||
|
||||
unset ($mempools_array);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
## Huawei VRP Processors
|
||||
if($device['os'] == "vrp")
|
||||
{
|
||||
echo("Huawei VRP ");
|
||||
$processors_array = snmpwalk_cache_multi_oid($device, "hwEntityCpuUsage", $processors_array, "HUAWEI-ENTITY-EXTENT-MIB" , '+'.$config['install_dir']."/mibs");
|
||||
$processors_array = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $processors_array, "HUAWEI-ENTITY-EXTENT-MIB" , '+'.$config['install_dir']."/mibs");
|
||||
$processors_array = snmpwalk_cache_multi_oid($device, "hwEntityBomEnDesc", $processors_array, "HUAWEI-ENTITY-EXTENT-MIB" , '+'.$config['install_dir']."/mibs");
|
||||
if ($debug) { print_r($processors_array); }
|
||||
|
||||
if (is_array($processors_array))
|
||||
{
|
||||
foreach ($processors_array as $index => $entry)
|
||||
{
|
||||
if ( $entry['hwEntityMemSize'] != 0 )
|
||||
{
|
||||
if ($debug) { echo($index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityCpuUsage'] . " -> " . $entry['hwEntityMemSize']. "\n"); }
|
||||
$usage_oid = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.5." . $index;
|
||||
$descr = $entry['hwEntityBomEnDesc'];
|
||||
$usage = $entry['hwEntityCpuUsage'];
|
||||
if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" )
|
||||
{
|
||||
discover_processor($valid['processor'], $device, $usage_oid, $index, "vrp", $descr, "1", $usage, NULL, NULL);
|
||||
}
|
||||
} ## End if checks
|
||||
} ## End Foreach
|
||||
} ## End if array
|
||||
} ## End VRP Processors
|
||||
|
||||
unset ($processors_array);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$oid = $mempool['mempool_index'];
|
||||
|
||||
if($debug) {echo("Huawei VRP Mempool");}
|
||||
|
||||
if(!is_array($mempool_cache['vrp'])) {
|
||||
if($debug) {echo("caching");}
|
||||
$mempool_cache['vrp'] = array();
|
||||
$mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempool_cache['vrp'], "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs");
|
||||
$mempool_cache['vrp'] = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", $mempool_cache['vrp'], "HUAWEI-ENTITY-EXTENT-MIB" , $config['install_dir']."/mibs");
|
||||
if($debug) {print_r($mempool_cache);}
|
||||
}
|
||||
|
||||
$entry = $mempool_cache['vrp'][$mempool[mempool_index]];
|
||||
|
||||
if ( $entry['hwEntityMemSize'] < 0 ) {
|
||||
$entry['hwEntityMemSize'] = $entry['hwEntityMemSize'] * -1;
|
||||
}
|
||||
|
||||
$perc = $entry['hwEntityMemUsage'];
|
||||
$mempool['total'] = $entry['hwEntityMemSize'];
|
||||
$mempool['used'] = $entry['hwEntityMemSize'] / 100 * $perc;
|
||||
$mempool['free'] = $entry['hwEntityMemSize'] - $mempool['used'];
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user