Files
librenms/html/includes/graphs/device/cisco-otv-mac.inc.php
T
Aaron Daniels 8f4dbb5338 Cisco OTV
Implements the CISCO-OTV-MIB to retrieve OTV counters from Cisco devices.
This collects information on the configured Overlays and Adjacencies

Statistics are collected for the amount of VLAN's on each overlay and the amount of MAC addresses available over each OTV endpoint.
OTV alerts are collected and generated if the appropriate alerting rules exist.

Data is displayed under routing at both the global and device level.

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...
2016-01-21 22:04:20 +10:00

63 lines
2.2 KiB
PHP

<?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-OTV');
$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options);
// We only care about our device id.
$COMPONENTS = $COMPONENTS[$device['device_id']];
include "includes/graphs/common.inc.php";
$rrd_options .= " -l 0 -E ";
$rrd_options .= " COMMENT:'MAC Addresses Now Min Max\\n'";
$rrd_additions = "";
$COUNT = 0;
foreach ($COMPONENTS as $ID => $ARRAY) {
if ($ARRAY['otvtype'] == 'endpoint') {
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$ARRAY['endpoint']."-mac.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 . ":count:AVERAGE ";
$rrd_additions .= " AREA:DS" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['endpoint'],0,15),15) . "'" . $STACK;
$rrd_additions .= " GPRINT:DS" . $COUNT . ":LAST:%4.0lf%s ";
$rrd_additions .= " GPRINT:DS" . $COUNT . ":MIN:%4.0lf%s ";
$rrd_additions .= " GPRINT:DS" . $COUNT . ":MAX:%4.0lf%s\\\l ";
$COUNT++;
}
}
}
if ($rrd_additions == "") {
// We didn't add any data points.
}
else {
$rrd_options .= $rrd_additions;
}