Files

56 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2016-01-21 22:04:20 +10:00
<?php
/*
* LibreNMS module to display Cisco Class-Based QoS Details
*
* Copyright (c) 2015 Aaron Daniels <[email protected]>
*
* 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.
*/
2016-08-21 08:07:14 -05:00
$component = new LibreNMS\Component();
2016-01-21 22:04:20 +10:00
$options['filter']['type'] = array('=','Cisco-OTV');
2016-08-18 20:28:22 -05:00
$components = $component->getComponents($device['device_id'], $options);
2016-01-21 22:04:20 +10:00
// We only care about our device id.
$components = $components[$device['device_id']];
2016-01-21 22:04:20 +10:00
2019-04-11 23:26:42 -05:00
include "includes/html/graphs/common.inc.php";
2016-01-21 22:04:20 +10:00
$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 = rrd_name($device['hostname'], array('cisco', 'otv', $array['label'], 'vlan'));
2016-01-21 22:04:20 +10:00
if (rrdtool_check_rrd_exists($rrd_filename)) {
2016-01-21 22:04:20 +10:00
// Stack the area on the second and subsequent DS's
$stack = "";
if ($count != 0) {
$stack = ":STACK ";
2016-01-21 22:04:20 +10:00
}
// Grab a color from the array.
2019-06-23 00:29:12 -05:00
$color = \LibreNMS\Config::get("graph_colours.mixed.$count", \LibreNMS\Config::get('graph_colours.oranges.' . ($count - 7)));
2016-01-21 22:04:20 +10:00
$rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE ";
2016-08-18 20:28:22 -05:00
$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++;
2016-01-21 22:04:20 +10:00
}
}
}
if ($rrd_additions == "") {
// We didn't add any data points.
2016-08-18 20:28:22 -05:00
} else {
2016-01-21 22:04:20 +10:00
$rrd_options .= $rrd_additions;
}