mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: added support for f5 custom interface mib (#4842)
This commit is contained in:
committed by
Tony Murray
parent
e318b58d3f
commit
61b461503c
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
53
includes/polling/ports/f5.inc.php
Normal file
53
includes/polling/ports/f5.inc.php
Normal 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];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user