diff --git a/includes/html/graphs/device/sla.inc.php b/includes/html/graphs/device/sla.inc.php
index 2f2b2cbc15..a6a9470e30 100644
--- a/includes/html/graphs/device/sla.inc.php
+++ b/includes/html/graphs/device/sla.inc.php
@@ -10,6 +10,8 @@ if ($sla['owner']) {
$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr']));
+$rrd_options .= " -l 0 ";
+
$rrd_options .= " COMMENT:'Round Trip Time Cur Min Max\\n'";
$rrd_options .= " DEF:rtt=$rrd_filename:rtt:AVERAGE ";
$rrd_options .= ' VDEF:avg=rtt,AVERAGE ';
diff --git a/includes/html/graphs/device/sla_jitter-loss.inc.php b/includes/html/graphs/device/sla_jitter-loss.inc.php
index 568adff5b3..8c6654b105 100644
--- a/includes/html/graphs/device/sla_jitter-loss.inc.php
+++ b/includes/html/graphs/device/sla_jitter-loss.inc.php
@@ -14,21 +14,21 @@
$sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', array($vars['id']));
require 'includes/html/graphs/common.inc.php';
-$rrd_options .= ' -l 0 -E ';
+$rrd_options .= ' -l 0 ';
$rrd_filename = rrd_name($device['hostname'], array('sla', $sla['sla_nr'], 'jitter'));
if (rrdtool_check_rrd_exists($rrd_filename)) {
$rrd_options .= " COMMENT:' Cur Min Max Avg\\n'";
$rrd_options .= " DEF:SD=" . $rrd_filename . ":PacketLossSD:AVERAGE ";
- $rrd_options .= " LINE1.25:SD#0000ee:'Src to Dst (ms) ' ";
+ $rrd_options .= " LINE1.25:SD#FF3300:'Src to Dst (pkts) ' ";
$rrd_options .= " GPRINT:SD:LAST:'%5.2lf' ";
$rrd_options .= " GPRINT:SD:MIN:'%5.2lf' ";
$rrd_options .= " GPRINT:SD:MAX:'%5.2lf' ";
$rrd_options .= " GPRINT:SD:AVERAGE:'%5.2lf'\\\l ";
$rrd_options .= " DEF:DS=" . $rrd_filename . ":PacketLossDS:AVERAGE ";
- $rrd_options .= " LINE1.25:DS#008C00:'Dst to Src (ms) ' ";
+ $rrd_options .= " LINE1.25:DS#FF6633:'Dst to Src (pkts) ' ";
$rrd_options .= " GPRINT:DS:LAST:'%5.2lf' ";
$rrd_options .= " GPRINT:DS:MIN:'%5.2lf' ";
$rrd_options .= " GPRINT:DS:MAX:'%5.2lf' ";
diff --git a/includes/html/pages/device/sla.inc.php b/includes/html/pages/device/sla.inc.php
deleted file mode 100644
index 9ed63d9cd1..0000000000
--- a/includes/html/pages/device/sla.inc.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- *
- * 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']));
-
-?>
-
';
-echo "
Status » ";
-$sep = '';
-foreach ($status_options as $option => $text) {
- if (empty($vars['opstatus'])) {
- $vars['opstatus'] = $option;
- }
- echo $sep;
- if ($vars['opstatus'] == $option) {
- echo "';
- }
- $sep = ' | ';
-}
-unset($sep);
-
-print_optionbar_end();
-
-foreach ($slas as $sla) {
- if ($vars['view'] != 'all' && $vars['view'] != $sla['rtt_type']) {
- continue;
- }
-
- $opstatus = ($sla['opstatus'] === 0) ? 'up' : 'down';
- d_echo("
Opstatus :: var: ".$vars['opstatus'].", db: ".$sla['opstatus'].", name: ".$opstatus."
");
- if ($vars['opstatus'] != 'all' && $vars['opstatus'] != $opstatus) {
- continue;
- }
-
- $name = 'SLA #'.$sla['sla_nr'].' - '.$sla_types[$sla['rtt_type']];
+if ($vars['id']) {
+ $sla = dbFetchRow('SELECT `tag`, `sla_nr`,`rtt_type` FROM `slas` WHERE `sla_id` = ?', array($vars['id']));
+ $name = 'SLA #' . $sla['sla_nr'] . ' - ' . \LibreNMS\Config::get("sla_type_labels.{$sla['rtt_type']}", ucfirst($sla['rtt_type']));
if ($sla['tag']) {
- $name .= ': '.$sla['tag'];
+ $name .= ': ' . $sla['tag'];
}
if ($sla['owner']) {
- $name .= ' (Owner: '.$sla['owner'].')';
+ $name .= ' (Owner: ' . $sla['owner'] . ')';
}
- // These Types have more graphs. Display a sub-page
- if (($sla['rtt_type'] == 'jitter') || ($sla['rtt_type'] == 'icmpjitter')) {
- $name = '
$sla['sla_id'])).'">'.$name.'';
- } 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'] = \LibreNMS\Config::get('time.now');
- $graph_array['type'] = 'device_sla';
- $graph_array['id'] = $sla['sla_id'];
- echo '
+ echo "
$name
";
+
+ echo '
';
+
+ // All SLA's support the RTT metric
+ include 'sla/rtt.inc.php';
+
+ // Load the per-type SLA metrics
+ $rtt_type = basename($sla['rtt_type']);
+ if (file_exists("includes/html/pages/device/sla/$rtt_type.inc.php")) {
+ include "includes/html/pages/device/sla/$rtt_type.inc.php";
+ }
+
+ echo '
';
+} else {
+ print_optionbar_start();
+
+ $slas = dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 ORDER BY `sla_nr`', array($device['device_id']));
+
+ // Collect types
+ $sla_types = array('all' => 'All');
+ foreach ($slas as $sla) {
+ $sla_type = $sla['rtt_type'];
+
+ $sla_types[$sla_type] = !in_array($sla_type, $sla_types) ? \LibreNMS\Config::get("sla_type_labels.$sla_type", 'Unknown') : ucfirst($sla_type);
+ }
+ asort($sla_types);
+
+ $status_options = array(
+ 'all' => 'All',
+ 'up' => 'Up',
+ 'down' => 'Down',
+ );
+
+ echo "
SLA » ";
+
+ // SLA Types, on the left.
+ $sep = '';
+ foreach ($sla_types as $sla_type => $text) {
+ if (!$vars['view']) {
+ $vars['view'] = $sla_type;
+ }
+
+ echo $sep;
+ if ($vars['view'] == $sla_type) {
+ echo "';
+ }
+
+ $sep = ' | ';
+ }
+ unset($sep);
+
+ // The status option - on the right
+ echo '
';
+ echo "
Status » ";
+ $sep = '';
+ foreach ($status_options as $option => $text) {
+ if (empty($vars['opstatus'])) {
+ $vars['opstatus'] = $option;
+ }
+ echo $sep;
+ if ($vars['opstatus'] == $option) {
+ echo "';
+ }
+ $sep = ' | ';
+ }
+ unset($sep);
+
+ print_optionbar_end();
+
+ foreach ($slas as $sla) {
+ if ($vars['view'] != 'all' && $vars['view'] != $sla['rtt_type']) {
+ continue;
+ }
+
+ $opstatus = ($sla['opstatus'] === 0) ? 'up' : 'down';
+ d_echo("
Opstatus :: var: " . $vars['opstatus'] . ", db: " . $sla['opstatus'] . ", name: " . $opstatus . "
");
+ if ($vars['opstatus'] != 'all' && $vars['opstatus'] != $opstatus) {
+ continue;
+ }
+
+ $name = 'SLA #' . $sla['sla_nr'] . ' - ' . $sla_types[$sla['rtt_type']];
+ if ($sla['tag']) {
+ $name .= ': ' . $sla['tag'];
+ }
+
+ if ($sla['owner']) {
+ $name .= ' (Owner: ' . $sla['owner'] . ')';
+ }
+
+ // These Types have more graphs. Display a sub-page
+ if (($sla['rtt_type'] == 'jitter') || ($sla['rtt_type'] == 'icmpjitter')) {
+ $name = '
$sla['sla_id'])) . '">' . $name . '';
+ } 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'] = \LibreNMS\Config::get('time.now');
+ $graph_array['type'] = 'device_sla';
+ $graph_array['id'] = $sla['sla_id'];
+ echo '
-
'.$name.'
+ ' . $name . '
';
- echo "
";
- include 'includes/html/print-graphrow.inc.php';
- echo '
';
- echo '
';
- echo '
';
+ echo "
";
+ include 'includes/html/print-graphrow.inc.php';
+ echo '
';
+ echo '
';
+ echo '
';
+ }
}
$pagetitle[] = 'SLAs';