mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add CISCO-IF-EXTENSION port stats for IOS/IOS-XE (#10644)
* Add CISCO-IF-EXTENSION polling and graph * Added test data * Code style * Move CISCO-IF-EXTENSION-MIB to cisco mib dir * Test data? * Recollect test data again * ios-xe variant 'ports' with ports test data * Removed unnecessary test data
This commit is contained in:
committed by
Tony Murray
parent
38febff1ec
commit
7f32af4f7b
44
includes/html/graphs/port/cie.inc.php
Normal file
44
includes/html/graphs/port/cie.inc.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2019 LibreNMS
|
||||
* @author Pavle Obradovic <pobradovic08@gmail.com>
|
||||
*/
|
||||
|
||||
$cisco_if_extension_ds = array(
|
||||
'InRuntsErrs' => 'In Runts',
|
||||
'InGiantsErrs' => 'In Giants',
|
||||
'InFramingErrs' => 'In Framing err',
|
||||
'InOverrunErrs' => 'In Overruns',
|
||||
'InIgnored' => 'In Ignored',
|
||||
'InAbortErrs' => 'In Aborts',
|
||||
'InputQueueDrops' => 'In Queue drops',
|
||||
'OutputQueueDrops' => 'Out Queue drops'
|
||||
);
|
||||
|
||||
$i = 0;
|
||||
$rrd_filename = get_port_rrdfile_path($device['hostname'], $port['port_id'], 'cie');
|
||||
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
foreach ($cisco_if_extension_ds as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$colours = 'mixed';
|
||||
$nototal = 1;
|
||||
$unit_text = 'Errors/sec';
|
||||
$simple_rrd = 1;
|
||||
|
||||
require 'includes/html/graphs/generic_multi_simplex_seperated.inc.php';
|
@@ -49,7 +49,7 @@ if (rrdtool_check_rrd_exists(get_port_rrdfile_path($device['hostname'], $port['p
|
||||
<h3 class="panel-title">PoE</h3>
|
||||
</div>';
|
||||
$graph_type = 'port_poe';
|
||||
|
||||
|
||||
echo '<div class="panel-body">';
|
||||
include 'includes/html/print-interface-graphs.inc.php';
|
||||
echo '</div></div>';
|
||||
@@ -61,9 +61,25 @@ if (rrdtool_check_rrd_exists(get_port_rrdfile_path($device['hostname'], $port['p
|
||||
<h3 class="panel-title">Ethernet Errors</h3>
|
||||
</div>';
|
||||
$graph_type = 'port_etherlike';
|
||||
|
||||
|
||||
echo '<div class="panel-body">';
|
||||
include 'includes/html/print-interface-graphs.inc.php';
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* CISCO-IF-EXTENSION MIB statistics
|
||||
* Additional information about input and output errors as seen in `show interface` output.
|
||||
*/
|
||||
if (rrdtool_check_rrd_exists(get_port_rrdfile_path($device['hostname'], $port['port_id'], 'cie'))) {
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Detailed interface errors</h3>
|
||||
</div>';
|
||||
$graph_type = 'port_cie';
|
||||
|
||||
echo '<div class="panel-body">';
|
||||
include 'includes/html/print-interface-graphs.inc.php';
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
@@ -81,6 +81,20 @@ $cisco_oids = array(
|
||||
'locIfOutputQueueDrops',
|
||||
);
|
||||
|
||||
/*
|
||||
* CISCO-IF-EXTENSION MIB
|
||||
*/
|
||||
$cisco_if_extension_oids = array(
|
||||
'cieIfInRuntsErrs',
|
||||
'cieIfInGiantsErrs',
|
||||
'cieIfInFramingErrs',
|
||||
'cieIfInOverrunErrs',
|
||||
'cieIfInIgnored',
|
||||
'cieIfInAbortErrs',
|
||||
'cieIfInputQueueDrops',
|
||||
'cieIfOutputQueueDrops'
|
||||
);
|
||||
|
||||
$pagp_oids = array(
|
||||
'pagpOperationMode',
|
||||
);
|
||||
@@ -417,6 +431,16 @@ if ($device['os_group'] == 'cisco' && $device['os'] != 'asa') {
|
||||
$port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortNativeVlan', $port_stats, 'CISCO-VTP-MIB');
|
||||
}//end if
|
||||
|
||||
/*
|
||||
* Most (all) of the IOS/IOS-XE devices support CISCO-IF-EXTENSION MIB that provides
|
||||
* additional informationa bout input and output errors as seen in `show interface` output.
|
||||
*/
|
||||
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
foreach ($cisco_if_extension_oids as $oid) {
|
||||
$port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-IF-EXTENSION-MIB');
|
||||
}
|
||||
}
|
||||
|
||||
$polled = time();
|
||||
|
||||
// End Building SNMP Cache Array
|
||||
@@ -864,7 +888,7 @@ foreach ($ports as $port) {
|
||||
// Add delta rate between current poll and last poll.
|
||||
$fields['ifInBits_rate'] = $port['stats']['ifInBits_rate'];
|
||||
$fields['ifOutBits_rate'] = $port['stats']['ifOutBits_rate'];
|
||||
|
||||
|
||||
prometheus_push($device, 'ports', rrd_array_filter($tags), $fields);
|
||||
influx_update($device, 'ports', rrd_array_filter($tags), $fields);
|
||||
graphite_update($device, 'ports|' . $ifName, $tags, $fields);
|
||||
@@ -898,6 +922,10 @@ foreach ($ports as $port) {
|
||||
if (Config::get('enable_ports_poe')) {
|
||||
include 'ports/port-poe.inc.php';
|
||||
}
|
||||
|
||||
if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
|
||||
include 'ports/cisco-if-extension.inc.php';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($port['update'] as $key => $val_check) {
|
||||
|
53
includes/polling/ports/cisco-if-extension.inc.php
Normal file
53
includes/polling/ports/cisco-if-extension.inc.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage polling
|
||||
* @link http://librenms.org
|
||||
* @copyright 2019 LibreNMS
|
||||
* @author Pavle Obradovic <pobradovic08@gmail.com>
|
||||
*/
|
||||
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
/*
|
||||
* Check if port has one of the counters ('cieIfInRuntsErrs') from CISCO-IF-EXTENSION MIB
|
||||
*/
|
||||
if (isset($this_port['cieIfInRuntsErrs'])) {
|
||||
/*
|
||||
* Build interface RRD with filename in format of:
|
||||
* port-id<ifIndex>-cie.rrd
|
||||
*/
|
||||
$rrd_name = getPortRrdName($port_id, 'cie');
|
||||
$rrdfile = rrd_name($device['hostname'], $rrd_name);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('InRuntsErrs', 'DERIVE', 0)
|
||||
->addDataset('InGiantsErrs', 'DERIVE', 0)
|
||||
->addDataset('InFramingErrs', 'DERIVE', 0)
|
||||
->addDataset('InOverrunErrs', 'DERIVE', 0)
|
||||
->addDataset('InIgnored', 'DERIVE', 0)
|
||||
->addDataset('InAbortErrs', 'DERIVE', 0)
|
||||
->addDataset('InputQueueDrops', 'DERIVE', 0)
|
||||
->addDataset('OutputQueueDrops', 'DERIVE', 0);
|
||||
|
||||
/*
|
||||
* Populate data for RRD
|
||||
*/
|
||||
$rrd_data = array();
|
||||
foreach ($cisco_if_extension_oids as $oid) {
|
||||
$ds_name = str_replace('cieIf', '', $oid);
|
||||
$rrd_data[$ds_name] = $this_port[$oid];
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate/update RRD
|
||||
*/
|
||||
$ifName = $port['ifName'];
|
||||
$tags = compact('ifName', 'rrd_name', 'rrd_def');
|
||||
rrdtool_data_update($device, 'drops', $tags, $rrd_data);
|
||||
}
|
Reference in New Issue
Block a user