mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add Sla jitter packet loss percent graph (#13600)
* Add sla packet loss percent rrd graph * Add packet loss percent div * Add OID for NumPackets * Fixed CDEF typo * Rename graph file to include .inc * Flipped axis for Src and Dst to match key * Create new rrd file for loss percent * Remove duplicate rrd data and rename rrd to reflect * Amend to use second rrd file for NumPackets * Removed spaces * dbFetchRow be gone * insert if statement check * white space cleanup * New line at end of file Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
11
LibreNMS/OS/Shared/Cisco.php
Normal file → Executable file
11
LibreNMS/OS/Shared/Cisco.php
Normal file → Executable file
@@ -411,6 +411,7 @@ class Cisco extends OS implements OSDiscovery, SlaDiscovery, ProcessorDiscovery,
|
||||
|
||||
$data = snmpwalk_group($device, 'rttMonLatestRttOperTable', 'CISCO-RTTMON-MIB');
|
||||
$data = snmpwalk_group($device, 'rttMonLatestOper', 'CISCO-RTTMON-MIB', 1, $data);
|
||||
$data = snmpwalk_group($device, 'rttMonEchoAdminNumPackets', 'CISCO-RTTMON-MIB', 1, $data);
|
||||
|
||||
$time_offset = time() - $this->getDevice()->uptime;
|
||||
|
||||
@@ -472,6 +473,16 @@ class Cisco extends OS implements OSDiscovery, SlaDiscovery, ProcessorDiscovery,
|
||||
$tags = compact('rrd_name', 'rrd_def', 'sla_nr', 'rtt_type');
|
||||
data_update($device, 'sla', $tags, $jitter);
|
||||
$fields = array_merge($fields, $jitter);
|
||||
// Additional rrd for total number packet in sla
|
||||
$numPackets = [
|
||||
'NumPackets' => $data[$sla_nr]['rttMonEchoAdminNumPackets'],
|
||||
];
|
||||
$rrd_name = ['sla', $sla_nr, 'NumPackets'];
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('NumPackets', 'GAUGE', 0);
|
||||
$tags = compact('rrd_name', 'rrd_def', 'sla_nr', 'rtt_type');
|
||||
data_update($device, 'sla', $tags, $numPackets);
|
||||
$fields = array_merge($fields, $numPackets);
|
||||
break;
|
||||
case 'icmpjitter':
|
||||
$icmpjitter = [
|
||||
|
44
includes/html/graphs/device/sla_jitter-loss-percent.inc.php
Executable file
44
includes/html/graphs/device/sla_jitter-loss-percent.inc.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS module to Graph Cisco IPSLA UDP Jitter metrics
|
||||
*
|
||||
* Copyright (c) 2016 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.
|
||||
*/
|
||||
use App\Models\Sla;
|
||||
|
||||
$sla_nr = Sla::where('sla_id', $vars['id'])->value('sla_nr');
|
||||
|
||||
if ($sla_nr) {
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
$rrd_options .= ' -l -100 -u 100 -E -r';
|
||||
$rrd_filename_1 = Rrd::name($device['hostname'], ['sla', $sla_nr, 'jitter']);
|
||||
$rrd_filename_2 = Rrd::name($device['hostname'], ['sla', $sla_nr, 'NumPackets']);
|
||||
|
||||
if (Rrd::checkRrdExists($rrd_filename)) {
|
||||
$rrd_options .= " COMMENT:' Cur Min Max Avg\\n'";
|
||||
|
||||
$rrd_options .= ' DEF:PacketLossSD=' . $rrd_filename_1 . ':PacketLossSD:AVERAGE ';
|
||||
$rrd_options .= ' DEF:PacketLossDS=' . $rrd_filename_1 . ':PacketLossDS:AVERAGE ';
|
||||
$rrd_options .= ' DEF:NumPackets=' . $rrd_filename_2 . ':NumPackets:AVERAGE ';
|
||||
|
||||
$rrd_options .= ' CDEF:PktLossOut=PacketLossSD,NumPackets,/,100,* ';
|
||||
$rrd_options .= " LINE1.25:PktLossOut#0000ee:'Src to Dst (%) ' ";
|
||||
$rrd_options .= " GPRINT:PktLossOut:LAST:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossOut:MIN:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossOut:MAX:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossOut:AVERAGE:'%5.2lf'\\\l ";
|
||||
|
||||
$rrd_options .= ' CDEF:PktLossIn=PacketLossDS,NumPackets,/,100,*,-1,* ';
|
||||
$rrd_options .= " LINE1.25:PktLossIn#008C00:'Dst to Src (%) ' ";
|
||||
$rrd_options .= " GPRINT:PktLossIn:LAST:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossIn:MIN:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossIn:MAX:'%5.2lf' ";
|
||||
$rrd_options .= " GPRINT:PktLossIn:AVERAGE:'%5.2lf'\\\l ";
|
||||
}
|
||||
}
|
@@ -31,7 +31,23 @@
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Packet Loss</h3>
|
||||
<h3 class="panel-title">Packet Loss (Percent)</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
$graph_array = [];
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = \LibreNMS\Config::get('time.now');
|
||||
$graph_array['type'] = 'device_sla_jitter-loss-percent';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/html/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Packet Loss (Count)</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
|
Reference in New Issue
Block a user