Merge pull request #3991 from vitalisator/pbn2

move pbn mibs to subdirectory
This commit is contained in:
Neil Lathwood
2016-08-10 19:22:45 +01:00
committed by GitHub
15 changed files with 25 additions and 12 deletions

View File

@@ -96,7 +96,8 @@ unset($lldp_array);
if ($device['os'] == 'pbn' && $config['autodiscovery']['xdp'] === true) {
echo ' NMS-LLDP-MIB: ';
$lldp_array = snmpwalk_cache_oid($device, 'lldpRemoteSystemsData', array(), 'NMS-LLDP-MIB');
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
$lldp_array = snmpwalk_cache_oid($device, 'lldpRemoteSystemsData', array(), 'NMS-LLDP-MIB', $mibdir);
d_echo($lldp_array);
if ($lldp_array) {
unset($lldp_links);

View File

@@ -10,7 +10,8 @@ if ($device['os'] == 'pbn') {
// specified MIB supported since build 16607
if ($version[build] >= 16607) {
$usage = snmp_get($device, 'NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0', '-OUvQ');
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
$usage = snmp_get($device, 'nmsMemoryPoolUtilization.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', $mibdir);
if (is_numeric($usage)) {
discover_mempool($valid_mempool, $device, 0, 'pbn-mem', 'Main Memory', '100', null, null);

View File

@@ -11,7 +11,8 @@ if ($device['os'] == 'pbn') {
echo 'PBN : ';
$descr = 'Processor';
$usage = snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min.1', '-OUvQ');
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
$usage = snmp_get($device, 'nmspmCPUTotal5min.1', '-OUvQ', 'NMS-PROCESS-MIB', $mibdir);
if (is_numeric($usage)) {
discover_processor($valid['processor'], $device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min', '0', 'pbn-cpu', $descr, '100', $usage, null, null);

View File

@@ -10,6 +10,13 @@ function poll_sensor($device, $class, $unit) {
$sensor_value = '';
if ($sensor['poller_type'] == 'snmp') {
if ($device['os'] == 'pbn') {
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
}
else {
$mibdir = $config['mibdir'];
}
if ($device['os'] == 'siklu') {
$mib = ':RADIO-BRIDGE-MIB';
}
@@ -29,7 +36,7 @@ function poll_sensor($device, $class, $unit) {
for ($i = 0; $i < 5; $i++) {
d_echo("Attempt $i ");
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib", $mibdir)));
preg_match('/[\d\.]+/', $sensor_value, $temp_response);
if (!empty($temp_response[0])) {
$sensor_value = $temp_response[0];
@@ -44,7 +51,7 @@ function poll_sensor($device, $class, $unit) {
}//end if
}
else if ($class == 'state') {
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-Oevq', 'SNMPv2-MIB')));
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-Oevq', 'SNMPv2-MIB', $mibdir)));
if (!is_numeric($sensor_value)) {
$state_value = dbFetchCell('SELECT `state_value` FROM `state_translations` LEFT JOIN `sensors_to_state_indexes` ON `state_translations`.`state_index_id` = `sensors_to_state_indexes`.`state_index_id` WHERE `sensors_to_state_indexes`.`sensor_id` = ? AND `state_translations`.`state_descr` LIKE ?', array($sensor['sensor_id'], $sensor_value));
d_echo('State value of ' . $sensor_value . ' is ' . $state_value . "\n");
@@ -56,10 +63,10 @@ function poll_sensor($device, $class, $unit) {
else if ($class == 'signal') {
$currentOS = $device['os'];
include "includes/polling/signal/$currentOS.inc.php";
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib", $mibdir)));
}
else if ($class == 'dbm') {
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib", $mibdir)));
//iosxr does not expose dbm values through SNMP so we convert Watts to dbm to have a nice graph to show
if ($device['os'] == "iosxr") {
$sensor_value = round(10*log10($sensor_value/1000),3);
@@ -67,13 +74,14 @@ function poll_sensor($device, $class, $unit) {
}
else {
if ($sensor['sensor_type'] == 'apc') {
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB:PowerNet-MIB$mib")));
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB:PowerNet-MIB$mib", $mibdir)));
}
else {
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib", $mibdir)));
}
}//end if
unset($mib);
unset($mibdir);
}
else if ($sensor['poller_type'] == 'agent') {
if (isset($agent_sensors)) {

View File

@@ -10,8 +10,9 @@ if ($device['os'] == 'pbn') {
// specified MIB supported since build 16607
if ($version[build] >= 16607) {
$perc = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0", '-OUvQ');
$memory_available = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolTotalMemorySize.0", '-OUvQ');
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
$perc = snmp_get($device, 'nmsMemoryPoolUtilization.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', $mibdir);
$memory_available = snmp_get($device, 'nmsMemoryPoolTotalMemorySize.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', $mibdir);
$mempool['total'] = $memory_available;
if (is_numeric($perc)) {

View File

@@ -11,7 +11,8 @@ if ($device['os'] == 'pbn') {
// specified MIB supported since build 16607
if ($version[build] >= 16607) {
$usage = snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min.1', '-OUvQ');
$mibdir = $config['mibdir'].'/pbn'.':'.$config['mibdir'];
$usage = snmp_get($device, 'nmspmCPUTotal5min.1', '-OUvQ', 'NMS-PROCESS-MIB', $mibdir);
if (is_numeric($usage)) {
$proc = ($usage * 100);