mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Cisco CBQOS
Implements the CISCO-CLASS-BASED-QOS-MIB to retrieve QOS counters from Cisco devices. Policy and Class-map details are collected and stored in the database. Details are presented on a new "CBQoS" tab of the interface that the policy is applied to. Includes a policy selector that allows you to select which policy-map to show graphs for. Each class-map has its own rrd file, in which 3 metrics are stored: Bytes, QoS Drops, Buffer Drops. This can produce a LOT of rrd files. As an example: A Cisco 4500 series switch, running MQC on 200 ports. Each port has a common 5 class queueing policy applied, this creates 1000 (5 x 200) RRD's. Because of this I have currently set: ``` $config['discovery_modules']['cisco-cbqos'] = 0; ``` Includes function snmpwalk_array_num, which performs a numeric SNMPWalk and returns an array containing $count indexes One Index: From: 1.3.6.1.4.1.9.9.166.1.15.1.1.27.18.655360 = 0 To: $array['1.3.6.1.4.1.9.9.166.1.15.1.1.27.18']['655360'] = 0 Two Indexes: From: 1.3.6.1.4.1.9.9.166.1.15.1.1.27.18.655360 = 0 To: $array['1.3.6.1.4.1.9.9.166.1.15.1.1.27']['18']['655360'] = 0 And so on...
This commit is contained in:
72
includes/polling/cisco-cbqos.inc.php
Normal file
72
includes/polling/cisco-cbqos.inc.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to capture Cisco Class-Based QoS Details
|
||||
*
|
||||
* Copyright (c) 2015 Aaron Daniels <aaron@daniels.id.au>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
if ($device['os_group'] == "cisco") {
|
||||
|
||||
$MODULE = 'Cisco-CBQOS';
|
||||
|
||||
require_once 'includes/component.php';
|
||||
$COMPONENT = new component();
|
||||
$options['filter']['type'] = array('=',$MODULE);
|
||||
$options['filter']['disabled'] = array('=',0);
|
||||
$options['filter']['ignore'] = array('=',0);
|
||||
$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$COMPONENTS = $COMPONENTS[$device['device_id']];
|
||||
|
||||
// Only collect SNMP data if we have enabled components
|
||||
if (count($COMPONENTS > 0)) {
|
||||
// Let's gather the stats..
|
||||
$tblcbQosClassMapStats = snmpwalk_array_num($device, '.1.3.6.1.4.1.9.9.166.1.15.1.1', 2);
|
||||
|
||||
// Loop through the components and extract the data.
|
||||
foreach ($COMPONENTS as $KEY => $ARRAY) {
|
||||
$TYPE = $ARRAY['qos-type'];
|
||||
|
||||
// Get data from the class table.
|
||||
if ($TYPE == 2) {
|
||||
// Let's make sure the RRD is setup for this class.
|
||||
$filename = "port-".$ARRAY['ifindex']."-cbqos-".$ARRAY['sp-id']."-".$ARRAY['sp-obj'].".rrd";
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename ($filename);
|
||||
|
||||
if (!file_exists ($rrd_filename)) {
|
||||
rrdtool_create ($rrd_filename, " DS:postbits:COUNTER:600:0:U DS:bufferdrops:COUNTER:600:0:U DS:qosdrops:COUNTER:600:0:U" . $config['rrd_rra']);
|
||||
}
|
||||
|
||||
// Let's print some debugging info.
|
||||
d_echo("\n\nComponent: ".$KEY."\n");
|
||||
d_echo(" Class-Map: ".$ARRAY['label']."\n");
|
||||
d_echo(" SPID.SPOBJ: ".$ARRAY['sp-id'].".".$ARRAY['sp-obj']."\n");
|
||||
d_echo(" PostBytes: 1.3.6.1.4.1.9.9.166.1.15.1.1.10.".$ARRAY['sp-id'].".".$ARRAY['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$ARRAY['sp-id']][$ARRAY['sp-obj']]."\n");
|
||||
d_echo(" BufferDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.21.".$ARRAY['sp-id'].".".$ARRAY['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$ARRAY['sp-id']][$ARRAY['sp-obj']]."\n");
|
||||
d_echo(" QOSDrops: 1.3.6.1.4.1.9.9.166.1.15.1.1.17.".$ARRAY['sp-id'].".".$ARRAY['sp-obj']." = ".$tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$ARRAY['sp-id']][$ARRAY['sp-obj']]."\n");
|
||||
|
||||
$RRD['postbytes'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.10'][$ARRAY['sp-id']][$ARRAY['sp-obj']];
|
||||
$RRD['bufferdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.21'][$ARRAY['sp-id']][$ARRAY['sp-obj']];
|
||||
$RRD['qosdrops'] = $tblcbQosClassMapStats['1.3.6.1.4.1.9.9.166.1.15.1.1.17'][$ARRAY['sp-id']][$ARRAY['sp-obj']];
|
||||
|
||||
// Update RRD
|
||||
rrdtool_update ($rrd_filename, $RRD);
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($filename, $rrd_filename);
|
||||
}
|
||||
} // End foreach components
|
||||
|
||||
echo $MODULE." ";
|
||||
} // end if count components
|
||||
|
||||
// Clean-up after yourself!
|
||||
unset($TYPE, $COMPONENTS, $COMPONENT, $options, $MODULE);
|
||||
}
|
Reference in New Issue
Block a user