mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- Change the IPSLA feature to allow different metrics to be collected per type.
- UDP Jitter metrics collected. - Added opstatus code and DB field - Discovery sets opstatus - Added Status selector to SLA page - Merged master and moved SQL
This commit is contained in:
34
html/pages/device/sla.inc.php
Normal file
34
html/pages/device/sla.inc.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
$sla = dbFetchRow('SELECT `sla_nr`,`rtt_type` FROM `slas` WHERE `sla_id` = ?', array($vars['id']));
|
||||
|
||||
?>
|
||||
<div class="well well-sm">
|
||||
<!-- Need some kind of header here to represent the SLA -->
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" id="ipsla">
|
||||
<?php
|
||||
|
||||
// All SLA's support the RTT metric
|
||||
include 'sla/rtt.inc.php';
|
||||
|
||||
// Load the per-type SLA metrics
|
||||
if (file_exists('pages/device/sla/'.$sla['rtt_type'].'.inc.php')) {
|
||||
include 'sla/'.$sla['rtt_type'].'.inc.php';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
95
html/pages/device/sla/jitter.inc.php
Normal file
95
html/pages/device/sla/jitter.inc.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Average Latency One Way</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_sla_jitter-latency';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Average Jitter</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_sla_jitter';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Packet Loss</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_sla_jitter-loss';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Lost Packets (Out Of Sequence, Tail Drop, Late Arrival)</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_sla_jitter-lost';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Mean Opinion Score</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_sla_jitter-mos';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Impairment / Calculated Planning Impairment Factor</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_sla_jitter-icpif';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
15
html/pages/device/sla/rtt.inc.php
Normal file
15
html/pages/device/sla/rtt.inc.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Round Trip Time</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_sla';
|
||||
$graph_array['id'] = $vars['id'];
|
||||
require 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
@@ -2,8 +2,6 @@
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<span style='font-weight: bold;'>SLA</span> » ";
|
||||
|
||||
$slas = dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 ORDER BY `sla_nr`', array($device['device_id']));
|
||||
|
||||
// Collect types
|
||||
@@ -18,16 +16,23 @@ foreach ($slas as $sla) {
|
||||
if (isset($config['sla_type_labels'][$sla_type])) {
|
||||
$text = $config['sla_type_labels'][$sla_type];
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$text = ucfirst($sla_type);
|
||||
}
|
||||
|
||||
$sla_types[$sla_type] = $text;
|
||||
}
|
||||
|
||||
asort($sla_types);
|
||||
|
||||
$status_options = array(
|
||||
'all' => 'All',
|
||||
'up' => 'Up',
|
||||
'down' => 'Down',
|
||||
);
|
||||
|
||||
echo "<span style='font-weight: bold;'>SLA</span> » ";
|
||||
|
||||
// SLA Types, on the left.
|
||||
$sep = '';
|
||||
foreach ($sla_types as $sla_type => $text) {
|
||||
if (!$vars['view']) {
|
||||
@@ -46,7 +51,27 @@ foreach ($sla_types as $sla_type => $text) {
|
||||
|
||||
$sep = ' | ';
|
||||
}
|
||||
unset($sep);
|
||||
|
||||
// The status option - on the right
|
||||
echo '<div class="pull-right">';
|
||||
echo "<span style='font-weight: bold;'>Status</span> » ";
|
||||
$sep = '';
|
||||
foreach ($status_options as $option => $text) {
|
||||
if (empty($vars['opstatus'])) {
|
||||
$vars['opstatus'] = $option;
|
||||
}
|
||||
echo $sep;
|
||||
if ($vars['opstatus'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
}
|
||||
|
||||
echo generate_link($text, $vars, array('opstatus' => $option));
|
||||
if ($vars['opstatus'] == $option) {
|
||||
echo '</span>';
|
||||
}
|
||||
$sep = ' | ';
|
||||
}
|
||||
unset($sep);
|
||||
|
||||
print_optionbar_end();
|
||||
@@ -56,6 +81,12 @@ foreach ($slas as $sla) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$opstatus = ($sla['opstatus'] === '0') ? 'up' : 'down';
|
||||
d_echo("<br>Opstatus :: var: ".$vars['opstatus'].", db: ".$sla['opstatus'].", name: ".$opstatus."<br>");
|
||||
if ($vars['opstatus'] != 'all' && $vars['opstatus'] != $opstatus) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = 'SLA #'.$sla['sla_nr'].' - '.$sla_types[$sla['rtt_type']];
|
||||
if ($sla['tag']) {
|
||||
$name .= ': '.$sla['tag'];
|
||||
@@ -65,11 +96,30 @@ foreach ($slas as $sla) {
|
||||
$name .= ' (Owner: '.$sla['owner'].')';
|
||||
}
|
||||
|
||||
$graph_array['type'] = 'device_sla';
|
||||
$graph_array['id'] = $sla['sla_id'];
|
||||
echo '<div class="panel panel-default">
|
||||
// Jitter has more graphs. Display a sub-page
|
||||
if ($sla['rtt_type'] == 'jitter') {
|
||||
$name = '<a href="'.generate_url($vars, array('tab' => "sla", 'id' => $sla['sla_id'])).'">'.$name.'</a>';
|
||||
} else {
|
||||
$name = htmlentities($name);
|
||||
}
|
||||
|
||||
// If we have an error highlight the row.
|
||||
if ($sla['opstatus'] == 2) {
|
||||
$danger = "panel-danger";
|
||||
} else {
|
||||
$danger = '';
|
||||
}
|
||||
|
||||
$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_sla';
|
||||
$graph_array['id'] = $sla['sla_id'];
|
||||
echo '<div class="panel panel-default '.$danger.'">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.htmlentities($name).'</h3>
|
||||
<h3 class="panel-title">'.$name.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">';
|
||||
echo "<div class='row'>";
|
||||
@@ -79,4 +129,4 @@ foreach ($slas as $sla) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$pagetitle[] = 'SLAs';
|
||||
$pagetitle[] = 'SLAs';
|
Reference in New Issue
Block a user