mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
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...
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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:'VLANs Now Min Max\\n'";
|
||||
$rrd_additions = "";
|
||||
|
||||
$COUNT = 0;
|
||||
foreach ($COMPONENTS as $ID => $ARRAY) {
|
||||
if ($ARRAY['otvtype'] == 'overlay') {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$ARRAY['label']."-vlan.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]['label'],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;
|
||||
}
|
||||
@@ -420,7 +420,13 @@ $routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_
|
||||
$routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`");
|
||||
$routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`");
|
||||
|
||||
if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf']+$routing_count['cef']+$routing_count['vrf']) > "0") {
|
||||
require_once "../includes/component.php";
|
||||
$COMPONENT = new component();
|
||||
$options['type'] = 'Cisco-OTV';
|
||||
$OTV = $COMPONENT->getComponents(null,$options);
|
||||
$routing_count['cisco-otv'] = count($OTV);
|
||||
|
||||
if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf']+$routing_count['cef']+$routing_count['vrf']+$routing_count['cisco-otv']) > "0") {
|
||||
|
||||
?>
|
||||
<li class="dropdown">
|
||||
@@ -443,6 +449,16 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
|
||||
$separator++;
|
||||
}
|
||||
|
||||
// Cisco OTV Links
|
||||
if ($_SESSION['userlevel'] >= '5' && $routing_count['cisco-otv']) {
|
||||
if ($separator) {
|
||||
echo(' <li role="presentation" class="divider"></li>');
|
||||
$separator = 0;
|
||||
}
|
||||
echo('<li><a href="routing/protocol=cisco-otv/"><i class="fa fa-exchange fa-fw fa-lg"></i> Cisco OTV </a></li>');
|
||||
$separator++;
|
||||
}
|
||||
|
||||
// BGP Sessions
|
||||
if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp']) {
|
||||
if ($separator) {
|
||||
|
||||
@@ -210,6 +210,16 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
|
||||
$routing_tabs[] = 'vrf';
|
||||
}
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$COMPONENT = new component();
|
||||
$options['type'] = 'Cisco-OTV';
|
||||
$options['filter']['device_id'] = array('=',$device['device_id']);
|
||||
$OTV = $COMPONENT->getComponents(null,$options);
|
||||
$device_routing_count['cisco-otv'] = count($OTV);
|
||||
if ($device_routing_count['cisco-otv'] > 0) {
|
||||
$routing_tabs[] = 'cisco-otv';
|
||||
}
|
||||
|
||||
if (is_array($routing_tabs)) {
|
||||
echo '<li class="'.$select['routing'].'">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'routing')).'">
|
||||
|
||||
@@ -20,6 +20,7 @@ $type_text['bgp'] = 'BGP';
|
||||
$type_text['cef'] = 'CEF';
|
||||
$type_text['ospf'] = 'OSPF';
|
||||
$type_text['vrf'] = 'VRFs';
|
||||
$type_text['cisco-otv'] = 'OTV';
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$COMPONENT = new component();
|
||||
$options = array();
|
||||
$options['filter']['ignore'] = array('=',0);
|
||||
$options['type'] = 'Cisco-OTV';
|
||||
$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options);
|
||||
$COMPONENTS = $COMPONENTS[$device['device_id']];
|
||||
|
||||
global $config;
|
||||
?>
|
||||
<div class="panel panel-default" id="overlays">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Overlay's & Adjacencies</h3>
|
||||
</div>
|
||||
<div class="panel list-group">
|
||||
<?php
|
||||
// Loop over each component, pulling out the Overlays.
|
||||
foreach ($COMPONENTS as $OID => $OVERLAY) {
|
||||
if ($OVERLAY['otvtype'] == 'overlay') {
|
||||
if ($OVERLAY['status'] == 1) {
|
||||
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
else {
|
||||
$OVERLAY_STATUS = "<span class='pull-right'>".$OVERLAY['error']." - <span class='red'>Alert</span></span>";
|
||||
$GLI = "list-group-item-danger";
|
||||
}
|
||||
?>
|
||||
<a class="list-group-item <?=$GLI?>" data-toggle="collapse" data-target="#<?=$OVERLAY['index']?>" data-parent="#overlays"><?=$OVERLAY['label']?> - <?=$OVERLAY['transport']?> <?=$OVERLAY_STATUS?></a>
|
||||
<div id="<?=$OVERLAY['index']?>" class="sublinks collapse">
|
||||
<?php
|
||||
foreach ($COMPONENTS as $AID => $ADJACENCY) {
|
||||
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
|
||||
if ($ADJACENCY['status'] == 1) {
|
||||
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
else {
|
||||
$ADJ_STATUS = "<span class='pull-right'>".$ADJACENCY['error']." - <span class='red'>Alert</span></span>";
|
||||
$GLI = "list-group-item-danger";
|
||||
}
|
||||
?>
|
||||
<a class="list-group-item <?=$GLI?> small"><span class="glyphicon glyphicon-chevron-right"></span> <?=$ADJACENCY['label']?> - <?=$ADJACENCY['endpoint']?> <?=$ADJ_STATUS?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" id="vlanperoverlay">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">AED Enabled VLAN's</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
|
||||
$graph_array = array();
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['type'] = 'device_cisco-otv-vlan';
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" id="macperendpoint">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">MAC Addresses</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
|
||||
$graph_array = array();
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['type'] = 'device_cisco-otv-mac';
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,6 +16,7 @@ $type_text['bgp'] = 'BGP';
|
||||
$type_text['cef'] = 'CEF';
|
||||
$type_text['ospf'] = 'OSPF';
|
||||
$type_text['vrf'] = 'VRFs';
|
||||
$type_text['cisco-otv'] = 'OTV';
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
@@ -53,6 +54,7 @@ switch ($vars['protocol']) {
|
||||
case 'vrf':
|
||||
case 'cef':
|
||||
case 'ospf':
|
||||
case 'cisco-otv':
|
||||
include 'pages/routing/'.$vars['protocol'].'.inc.php';
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
require_once "../includes/component.php";
|
||||
$COMPONENT = new component();
|
||||
$options = array();
|
||||
$options['filter']['ignore'] = array('=',0);
|
||||
$options['type'] = 'Cisco-OTV';
|
||||
$COMPONENTS = $COMPONENT->getComponents(null,$options);
|
||||
|
||||
foreach ($COMPONENTS as $DEVICE_ID => $COMP) {
|
||||
$LINK = generate_url(array('page' => 'device', 'device' => $DEVICE_ID, 'tab' => 'routing', 'proto' => 'cisco-otv'));
|
||||
?>
|
||||
<div class="panel panel-default" id="overlays-<?=$DEVICE_ID?>">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><a href="<?=$LINK?>"><?=gethostbyid($DEVICE_ID)?> - Overlay's & Adjacencies</a></h3>
|
||||
</div>
|
||||
<div class="panel list-group">
|
||||
<?php
|
||||
// Loop over each component, pulling out the Overlays.
|
||||
foreach ($COMP as $OID => $OVERLAY) {
|
||||
if ($OVERLAY['otvtype'] == 'overlay') {
|
||||
if ($OVERLAY['status'] == 1) {
|
||||
$OVERLAY_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
else {
|
||||
$OVERLAY_STATUS = "<span class='pull-right'>".$OVERLAY['error']." - <span class='red'>Alert</span></span>";
|
||||
$GLI = "list-group-item-danger";
|
||||
}
|
||||
?>
|
||||
<a class="list-group-item <?=$GLI?>" data-toggle="collapse" data-target="#<?=$OVERLAY['index']?>" data-parent="#overlays-<?=$DEVICE_ID?>"><?=$OVERLAY['label']?> - <?=$OVERLAY['transport']?> <?=$OVERLAY_STATUS?></a>
|
||||
<div id="<?=$OVERLAY['index']?>" class="sublinks collapse">
|
||||
<?php
|
||||
foreach ($COMP as $AID => $ADJACENCY) {
|
||||
if (($ADJACENCY['otvtype'] == 'adjacency') && ($ADJACENCY['index'] == $OVERLAY['index'])) {
|
||||
if ($ADJACENCY['status'] == 1) {
|
||||
$ADJ_STATUS = "<span class='green pull-right'>Normal</span>";
|
||||
$GLI = "";
|
||||
}
|
||||
else {
|
||||
$ADJ_STATUS = "<span class='pull-right'>".$ADJACENCY['error']." - <span class='red'>Alert</span></span>";
|
||||
$GLI = "list-group-item-danger";
|
||||
}
|
||||
?>
|
||||
<a class="list-group-item <?=$GLI?> small"><span class="glyphicon glyphicon-chevron-right"></span> <?=$ADJACENCY['label']?> - <?=$ADJACENCY['endpoint']?> <?=$ADJ_STATUS?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
Reference in New Issue
Block a user