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:
75
html/includes/graphs/port/cbqos_bufferdrops.inc.php
Normal file
75
html/includes/graphs/port/cbqos_bufferdrops.inc.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to display 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.
|
||||
*/
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$COMPONENT = new component();
|
||||
$options['filter']['type'] = array('=','Cisco-CBQOS');
|
||||
$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options);
|
||||
|
||||
// We only care about our device id.
|
||||
$COMPONENTS = $COMPONENTS[$device['device_id']];
|
||||
|
||||
// Determine a policy to show.
|
||||
if (!isset($vars['policy'])) {
|
||||
foreach ($COMPONENTS as $ID => $ARRAY) {
|
||||
if ( ($ARRAY['qos-type'] == 1) && ($ARRAY['ifindex'] == $port['ifIndex']) && ($ARRAY['parent'] == 0) ) {
|
||||
// Found the first policy
|
||||
$vars['policy'] = $ID;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include "includes/graphs/common.inc.php";
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
$rrd_options .= " COMMENT:'Class-Map Now Avg Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$COUNT = 0;
|
||||
foreach ($COMPONENTS as $ID => $ARRAY) {
|
||||
if ( ($ARRAY['qos-type'] == 2) && ($ARRAY['parent'] == $COMPONENTS[$vars['policy']]['sp-obj']) && ($ARRAY['sp-id'] == $COMPONENTS[$vars['policy']]['sp-id'])) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("port-".$ARRAY['ifindex']."-cbqos-".$ARRAY['sp-id']."-".$ARRAY['sp-obj'].".rrd");
|
||||
|
||||
if (file_exists($rrd_filename)) {
|
||||
// Stack the area on the second and subsequent DS's
|
||||
$STACK = "";
|
||||
if ($COUNT != 0) {
|
||||
$STACK = ":STACK ";
|
||||
}
|
||||
|
||||
// Grab a color from the array.
|
||||
if ( isset($config['graph_colours']['mixed'][$COUNT]) ) {
|
||||
$COLOR = $config['graph_colours']['mixed'][$COUNT];
|
||||
}
|
||||
else {
|
||||
$COLOR = $config['graph_colours']['oranges'][$COUNT-7];
|
||||
}
|
||||
|
||||
$rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":bufferdrops:AVERAGE ";
|
||||
$rrd_additions .= " CDEF:MOD" . $COUNT . "=DS" . $COUNT . ",8,* ";
|
||||
$rrd_additions .= " AREA:MOD" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['label'],0,15),15) . "'" . $STACK;
|
||||
$rrd_additions .= " GPRINT:MOD" . $COUNT . ":LAST:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $COUNT . ":AVERAGE:%6.2lf%s ";
|
||||
$rrd_additions .= " GPRINT:MOD" . $COUNT . ":MAX:%6.2lf%s\\\l ";
|
||||
|
||||
$COUNT++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rrd_additions == "") {
|
||||
// We didn't add any data points.
|
||||
}
|
||||
else {
|
||||
$rrd_options .= $rrd_additions;
|
||||
}
|
Reference in New Issue
Block a user