feature: added support for f5 custom interface mib (#4842)

This commit is contained in:
Neil Lathwood
2016-10-21 16:13:32 +01:00
committed by Tony Murray
parent e318b58d3f
commit 61b461503c
2 changed files with 66 additions and 10 deletions

View File

@@ -124,17 +124,20 @@ $ifmib_oids = array(
echo 'Caching Oids: ';
if (!in_array($device['hardware'], $config['os'][$device['os']]['bad_ifXEntry'])) {
$port_stats = snmpwalk_cache_oid($device, 'ifXEntry', $port_stats, 'IF-MIB');
}
$hc_test = array_slice($port_stats, 0, 1);
if (!isset($hc_test[0]['ifHCInOctets']) && !is_numeric($hc_test[0]['ifHCInOctets'])) {
$port_stats = snmpwalk_cache_oid($device, 'ifEntry', $port_stats, 'IF-MIB', null, '-OQUst');
if ($device['os'] === 'f5' && (version_compare($device['version'], '11.2.0', '>=') && version_compare($device['version'], '11.7', '<'))) {
require_once 'ports/f5.inc.php';
} else {
foreach ($ifmib_oids as $oid) {
echo "$oid ";
$port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'IF-MIB', null, '-OQUst');
if (!in_array($device['hardware'], $config['os'][$device['os']]['bad_ifXEntry'])) {
$port_stats = snmpwalk_cache_oid($device, 'ifXEntry', $port_stats, 'IF-MIB');
}
$hc_test = array_slice($port_stats, 0, 1);
if (!isset($hc_test[0]['ifHCInOctets']) && !is_numeric($hc_test[0]['ifHCInOctets'])) {
$port_stats = snmpwalk_cache_oid($device, 'ifEntry', $port_stats, 'IF-MIB', null, '-OQUst');
} else {
foreach ($ifmib_oids as $oid) {
echo "$oid ";
$port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'IF-MIB', null, '-OQUst');
}
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* f5.inc.php
*
* LibreNMS F5 Ports include
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
$f5_stats = snmpwalk_cache_oid($device, 'sysIfxStat', array(), 'F5-BIGIP-SYSTEM-MIB');
unset($f5_stats[0]);
$tmp_port_stats = snmpwalk_cache_oid($device, 'ifEntry', array(), 'IF-MIB', null, '-OQUst');
$tmp_port_stats = snmpwalk_cache_oid($device, 'ifXEntry', $tmp_port_stats, 'IF-MIB', null, '-OQUst');
$required = array(
'ifName' => 'sysIfxStatName',
'ifHighSpeed' => 'sysIfxStatHighSpeed',
'ifHCInOctets' => 'sysIfxStatHcInOctets',
'ifHCOutOctets' => 'sysIfxStatHcOutOctets',
'ifHCInUcastPkts' => 'sysIfxStatHcInUcastPkts',
'ifHCOutUcastPkts' => 'sysIfxStatHcOutUcastPkts',
'ifHCInMulticastPkts' => 'sysIfxStatHcInMulticastPkts',
'ifHCOutMulticastPkts' => 'sysIfxStatHcOutMulticastPkts',
'ifHCInBroadcastPkts' => 'sysIfxStatHcInBroadcastPkts',
'ifHCOutBroadcastPkts' => 'sysIfxStatHcOutBroadcastPkts',
'ifConnectorPresent' => 'sysIfxStatConnectorPresent',
'ifAlias' => 'sysIfxStatAlias',
);
foreach ($tmp_port_stats as $index => $tmp_stats) {
$descr = $tmp_port_stats[$index]['ifDescr'];
$port_stats[$index] = $tmp_stats;
$port_stats[$index]['ifDescr'] = $tmp_stats['ifDescr'];
foreach ($required as $ifEntry => $IfxStat) {
$port_stats[$index][$ifEntry] = $f5_stats[$descr][$IfxStat];
}
}