mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 18:38:25 +00:00
webui: device page refresh (#7963)
* various device page style fixes and alignments with new look * blank line fix
This commit is contained in:
parent
20865b0ca4
commit
b63c2ac3bf
@ -2162,3 +2162,15 @@ label {
|
||||
width: 7px;
|
||||
min-height: 27px;
|
||||
}
|
||||
|
||||
.device-services-page {
|
||||
font-weight: bold;
|
||||
margin-left: 20px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.device-services-page-no-service {
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
padding: 15px;
|
||||
}
|
@ -1,25 +1,33 @@
|
||||
<?php
|
||||
|
||||
if ($bg == $list_colour_a) {
|
||||
$bg = $list_colour_b;
|
||||
} else {
|
||||
$bg = $list_colour_a;
|
||||
}
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
unset($icon);
|
||||
$severity_colour = eventlog_severity($entry['severity']);
|
||||
$icon = '<span class="alert-status ' . $severity_colour . '"></span>';
|
||||
|
||||
$icon = "<i class='fa fa-bookmark fa-lg $severity_colour' aria-hidden='true'></i>";
|
||||
|
||||
echo '<tr">
|
||||
<td>'.$icon.'
|
||||
'.$entry['humandate'].'
|
||||
</td>
|
||||
<td>';
|
||||
echo '<tr>';
|
||||
echo '<td>' . $icon . '</td>';
|
||||
echo '<td>' . $entry['humandate'] . '</td>';
|
||||
|
||||
if ($entry['type'] == 'interface') {
|
||||
$entry['link'] = '<b>'.generate_port_link(cleanPort(getifbyid($entry['reference']))).'</b>';
|
||||
$entry['link'] = '<b>' . generate_port_link(cleanPort(getifbyid($entry['reference']))) . '</b>';
|
||||
}
|
||||
|
||||
echo $entry['link'].' '.htmlspecialchars($entry['message']).'</td>
|
||||
</tr>';
|
||||
echo '<td>'.$entry['link'].'</td>';
|
||||
echo '<td>' . htmlspecialchars($entry['message']) . '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
@ -1,22 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$hostname = gethostbyid($entry['host']);
|
||||
|
||||
unset($icon);
|
||||
|
||||
$severity_colour = eventlog_severity($entry['severity']);
|
||||
$icon = '<span class="alert-status '.$severity_colour.'"></span>';
|
||||
|
||||
$icon = "<i class='fa fa-bookmark fa-lg $severity_colour' aria-hidden='true'></i>";
|
||||
|
||||
echo '<tr>
|
||||
<td>'.$icon.'
|
||||
'.$entry['datetime'].'
|
||||
</td>';
|
||||
echo '<tr>';
|
||||
echo '<td>'.$icon .'</td>';
|
||||
echo '<td style="vertical-align: middle;">'.$entry['datetime'].'</td>';
|
||||
|
||||
if (!isset($vars['device'])) {
|
||||
$dev = device_by_id_cache($entry['host']);
|
||||
echo '<td>
|
||||
'.generate_device_link($dev, shorthost($dev['hostname'])).'
|
||||
</td>';
|
||||
echo '<td style="vertical-align: middle;">'.generate_device_link($dev, shorthost($dev['hostname'])).'</td>';
|
||||
}
|
||||
|
||||
if ($entry['type'] == 'interface') {
|
||||
@ -26,7 +38,7 @@ if ($entry['type'] == 'interface') {
|
||||
$entry['link'] = 'System';
|
||||
}
|
||||
|
||||
echo '<td>'.$entry['link'].'</td>';
|
||||
echo '<td style="vertical-align: middle;">'.$entry['link'].'</td>';
|
||||
|
||||
echo '<td>'.htmlspecialchars($entry['message']).'</td>
|
||||
</tr>';
|
||||
echo '<td style="vertical-align: middle;">'.htmlspecialchars($entry['message']).'</td>';
|
||||
echo '</tr>';
|
||||
|
@ -2,13 +2,20 @@
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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.
|
||||
*/
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$pagetitle[] = "Alert Stats";
|
||||
|
||||
@ -29,8 +36,16 @@ if ($_SESSION['userlevel'] < '5') {
|
||||
}
|
||||
|
||||
?>
|
||||
<br>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Device alerts
|
||||
</div>
|
||||
<br>
|
||||
<div style="margin:0 auto;width:99%;">
|
||||
|
||||
<script src="js/vis.min.js"></script>
|
||||
<div id="visualization"></div>
|
||||
<div id="visualization" style="margin-bottom: -120px;"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
var container = document.getElementById('visualization');
|
||||
|
@ -1,11 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
if (!isset($vars['section'])) {
|
||||
$vars['section'] = 'eventlog';
|
||||
}
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo '<br>';
|
||||
echo '<div class="panel panel-default">';
|
||||
echo '<div class="panel-heading">';
|
||||
echo '<strong>Logging</strong> » ';
|
||||
|
||||
if ($vars['section'] == 'eventlog') {
|
||||
@ -41,9 +57,11 @@ if (isset($config['graylog']['server']) && isset($config['graylog']['port'])) {
|
||||
}
|
||||
}
|
||||
|
||||
echo '</div><br>';
|
||||
echo '<div style="width:99%;margin:0 auto;">';
|
||||
|
||||
switch ($vars['section']) {
|
||||
case 'syslog':
|
||||
print_optionbar_end();
|
||||
include 'pages/syslog.inc.php';
|
||||
break;
|
||||
case 'eventlog':
|
||||
@ -52,7 +70,9 @@ switch ($vars['section']) {
|
||||
break;
|
||||
|
||||
default:
|
||||
print_optionbar_end();
|
||||
echo '</div>';
|
||||
echo report_this('Unknown section '.$vars['section']);
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
@ -1,4 +1,23 @@
|
||||
<hr />
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$pagetitle[] = 'Events';
|
||||
?>
|
||||
|
||||
<form method="post" action="">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
@ -23,9 +42,9 @@
|
||||
<div class="col-md-4"><input class="btn btn-default" type="submit" value="Search"></div>
|
||||
</div>
|
||||
</form>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
print_optionbar_end();
|
||||
|
||||
$sql = '';
|
||||
if (!empty($_POST['string'])) {
|
||||
@ -46,5 +65,3 @@ foreach ($entries as $entry) {
|
||||
|
||||
echo ' </table>
|
||||
</div>';
|
||||
|
||||
$pagetitle[] = 'Events';
|
||||
|
@ -1,26 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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.
|
||||
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* 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.
|
||||
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
|
||||
if (!isset($vars['section'])) {
|
||||
$vars['section'] = "performance";
|
||||
}
|
||||
@ -34,100 +31,104 @@ if (empty($vars['dtpickerto'])) {
|
||||
|
||||
?>
|
||||
|
||||
<hr />
|
||||
<center>
|
||||
<form method="post" role="form" id="map" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="dtpickerfrom">From</label>
|
||||
<input type="text" class="form-control" id="dtpickerfrom" name="dtpickerfrom" maxlength="16" value="<?php echo $vars['dtpickerfrom']; ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||
<br>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<form method="post" role="form" id="map" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="dtpickerfrom">From</label>
|
||||
<input type="text" class="form-control" id="dtpickerfrom" name="dtpickerfrom" maxlength="16"
|
||||
value="<?php echo $vars['dtpickerfrom']; ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="dtpickerto">To</label>
|
||||
<input type="text" class="form-control" id="dtpickerto" name="dtpickerto" maxlength=16
|
||||
value="<?php echo $vars['dtpickerto']; ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-default" id="submit" value="Update">
|
||||
</form>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="dtpickerto">To</label>
|
||||
<input type="text" class="form-control" id="dtpickerto" name="dtpickerto" maxlength=16 value="<?php echo $vars['dtpickerto']; ?>" data-date-format="YYYY-MM-DD HH:mm">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-default" id="submit" value="Update">
|
||||
</form>
|
||||
</center>
|
||||
<hr />
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#dtpickerfrom").datetimepicker({
|
||||
useCurrent: true,
|
||||
sideBySide: true,
|
||||
useStrict: false,
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-calendar-check-o',
|
||||
clear: 'fa fa-trash-o',
|
||||
close: 'fa fa-close'
|
||||
}
|
||||
<br>
|
||||
<div style="margin:0 auto;width:99%;">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#dtpickerfrom").datetimepicker({
|
||||
useCurrent: true,
|
||||
sideBySide: true,
|
||||
useStrict: false,
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-calendar-check-o',
|
||||
clear: 'fa fa-trash-o',
|
||||
close: 'fa fa-close'
|
||||
}
|
||||
});
|
||||
$("#dtpickerto").datetimepicker({
|
||||
useCurrent: true,
|
||||
sideBySide: true,
|
||||
useStrict: false,
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-calendar-check-o',
|
||||
clear: 'fa fa-trash-o',
|
||||
close: 'fa fa-close'
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#dtpickerto").datetimepicker({
|
||||
useCurrent: true,
|
||||
sideBySide: true,
|
||||
useStrict: false,
|
||||
icons: {
|
||||
time: 'fa fa-clock-o',
|
||||
date: 'fa fa-calendar',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
previous: 'fa fa-chevron-left',
|
||||
next: 'fa fa-chevron-right',
|
||||
today: 'fa fa-calendar-check-o',
|
||||
clear: 'fa fa-trash-o',
|
||||
close: 'fa fa-close'
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
<?php
|
||||
if (is_admin() === true || is_read() === true) {
|
||||
$query = "SELECT DATE_FORMAT(timestamp, '".$config['alert_graph_date_format']."') Date, xmt,rcv,loss,min,max,avg FROM `device_perf` WHERE `device_id` = ? AND `timestamp` >= ? AND `timestamp` <= ?";
|
||||
$param = array($device['device_id'], $vars['dtpickerfrom'], $vars['dtpickerto']);
|
||||
} else {
|
||||
$query = "SELECT DATE_FORMAT(timestamp, '".$config['alert_graph_date_format']."') Date, xmt,rcv,loss,min,max,avg FROM `device_perf`,`devices_perms` WHERE `device_id` = ? AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = ? AND `timestamp` >= ? AND `timestamp` <= ?";
|
||||
$param = array($device['device_id'], $_SESSION['user_id'], $vars['dtpickerfrom'], $vars['dtpickerto']);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script src="js/vis.min.js"></script>
|
||||
<div id="visualization"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
var container = document.getElementById('visualization');
|
||||
<?php
|
||||
$groups = array();
|
||||
$max_val = 0;
|
||||
if (is_admin() === true || is_read() === true) {
|
||||
$query = "SELECT DATE_FORMAT(timestamp, '" . $config['alert_graph_date_format'] . "') Date, xmt,rcv,loss,min,max,avg FROM `device_perf` WHERE `device_id` = ? AND `timestamp` >= ? AND `timestamp` <= ?";
|
||||
$param = array($device['device_id'], $vars['dtpickerfrom'], $vars['dtpickerto']);
|
||||
} else {
|
||||
$query = "SELECT DATE_FORMAT(timestamp, '" . $config['alert_graph_date_format'] . "') Date, xmt,rcv,loss,min,max,avg FROM `device_perf`,`devices_perms` WHERE `device_id` = ? AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = ? AND `timestamp` >= ? AND `timestamp` <= ?";
|
||||
$param = array($device['device_id'], $_SESSION['user_id'], $vars['dtpickerfrom'], $vars['dtpickerto']);
|
||||
}
|
||||
?>
|
||||
|
||||
foreach (dbFetchRows($query, $param) as $return_value) {
|
||||
$date = $return_value['Date'];
|
||||
$loss = $return_value['loss'];
|
||||
$min = $return_value['min'];
|
||||
$max = $return_value['max'];
|
||||
$avg = $return_value['avg'];
|
||||
<script src="js/vis.min.js"></script>
|
||||
<div id="visualization" style="margin-bottom:-120px;"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
if ($max > $max_val) {
|
||||
$max_val = $max;
|
||||
var container = document.getElementById('visualization');
|
||||
<?php
|
||||
$groups = array();
|
||||
$max_val = 0;
|
||||
|
||||
foreach (dbFetchRows($query, $param) as $return_value) {
|
||||
$date = $return_value['Date'];
|
||||
$loss = $return_value['loss'];
|
||||
$min = $return_value['min'];
|
||||
$max = $return_value['max'];
|
||||
$avg = $return_value['avg'];
|
||||
|
||||
if ($max > $max_val) {
|
||||
$max_val = $max;
|
||||
}
|
||||
|
||||
$data[] = array('x' => $date, 'y' => $loss, 'group' => 0);
|
||||
$data[] = array('x' => $date, 'y' => $min, 'group' => 1);
|
||||
$data[] = array('x' => $date, 'y' => $max, 'group' => 2);
|
||||
$data[] = array('x' => $date, 'y' => $avg, 'group' => 3);
|
||||
}
|
||||
|
||||
$data[] = array('x' => $date,'y' => $loss,'group' => 0);
|
||||
$data[] = array('x' => $date,'y' => $min,'group' => 1);
|
||||
$data[] = array('x' => $date,'y' => $max,'group' => 2);
|
||||
$data[] = array('x' => $date,'y' => $avg,'group' => 3);
|
||||
}
|
||||
|
||||
$graph_data = _json_encode($data);
|
||||
?>
|
||||
var names = ['Loss','Min latency','Max latency','Avg latency'];
|
||||
var groups = new vis.DataSet();
|
||||
$graph_data = _json_encode($data);
|
||||
?>
|
||||
var names = ['Loss', 'Min latency', 'Max latency', 'Avg latency'];
|
||||
var groups = new vis.DataSet();
|
||||
groups.add({
|
||||
id: 0,
|
||||
content: names[0],
|
||||
@ -179,33 +180,33 @@ if (is_admin() === true || is_read() === true) {
|
||||
}
|
||||
}
|
||||
});
|
||||
<?php
|
||||
|
||||
?>
|
||||
|
||||
var items =
|
||||
<?php
|
||||
echo $graph_data; ?>
|
||||
;
|
||||
var dataset = new vis.DataSet(items);
|
||||
var options = {
|
||||
barChart: {width:50, align:'right'}, // align: left, center, right
|
||||
drawPoints: false,
|
||||
legend: {left:{position:"bottom-left"}},
|
||||
dataAxis: {
|
||||
icons:true,
|
||||
showMajorLabels: true,
|
||||
showMinorLabels: true,
|
||||
},
|
||||
zoomMin: 86400, //24hrs
|
||||
zoomMax: <?php
|
||||
$first_date = reset($data);
|
||||
$last_date = end($data);
|
||||
$milisec_diff = abs(strtotime($first_date[x]) - strtotime($last_date[x])) * 1000;
|
||||
echo $milisec_diff;
|
||||
?>,
|
||||
orientation:'top'
|
||||
};
|
||||
var graph2d = new vis.Graph2d(container, dataset, groups, options);
|
||||
|
||||
</script>
|
||||
?>
|
||||
|
||||
var items =
|
||||
<?php
|
||||
echo $graph_data; ?>
|
||||
;
|
||||
var dataset = new vis.DataSet(items);
|
||||
var options = {
|
||||
barChart: {width: 50, align: 'right'}, // align: left, center, right
|
||||
drawPoints: false,
|
||||
legend: {left: {position: "bottom-left"}},
|
||||
dataAxis: {
|
||||
icons: true,
|
||||
showMajorLabels: true,
|
||||
showMinorLabels: true,
|
||||
},
|
||||
zoomMin: 86400, //24hrs
|
||||
zoomMax: <?php
|
||||
$first_date = reset($data);
|
||||
$last_date = end($data);
|
||||
$milisec_diff = abs(strtotime($first_date[x]) - strtotime($last_date[x])) * 1000;
|
||||
echo $milisec_diff;
|
||||
?>,
|
||||
orientation: 'top'
|
||||
};
|
||||
var graph2d = new vis.Graph2d(container, dataset, groups, options);
|
||||
|
||||
</script>
|
||||
|
@ -1,4 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @subpackage webui
|
||||
* @link http://librenms.org
|
||||
* @copyright 2017 LibreNMS
|
||||
* @author LibreNMS Contributors
|
||||
*/
|
||||
|
||||
$pagetitle[] = 'Services';
|
||||
|
||||
@ -8,18 +23,20 @@ $services = service_get($device['device_id']);
|
||||
require_once 'includes/modal/new_service.inc.php';
|
||||
require_once 'includes/modal/delete_service.inc.php';
|
||||
|
||||
print_optionbar_start();
|
||||
echo "<span style='font-weight: bold;'>Services</span> » ";
|
||||
|
||||
$menu_options = array(
|
||||
'basic' => 'Basic',
|
||||
'details' => 'Details',
|
||||
);
|
||||
|
||||
if (!$vars['view']) {
|
||||
$vars['view'] = 'basic';
|
||||
}
|
||||
|
||||
$menu_options = array(
|
||||
'basic' => 'Basic',
|
||||
'details' => 'Details',
|
||||
);
|
||||
|
||||
echo '<br>';
|
||||
echo '<div class="panel panel-default">';
|
||||
echo '<div class="panel-heading">';
|
||||
echo '<span style="font-weight: bold;">Services</span> » ';
|
||||
|
||||
$sep = '';
|
||||
foreach ($menu_options as $option => $text) {
|
||||
if (empty($vars['view'])) {
|
||||
@ -28,7 +45,7 @@ foreach ($menu_options as $option => $text) {
|
||||
|
||||
echo $sep;
|
||||
if ($vars['view'] == $option) {
|
||||
echo "<span class='pagemenu-selected'>";
|
||||
echo '<span class="pagemenu-selected">';
|
||||
}
|
||||
|
||||
echo generate_link($text, $vars, array('view' => $option));
|
||||
@ -39,83 +56,77 @@ foreach ($menu_options as $option => $text) {
|
||||
$sep = ' | ';
|
||||
}
|
||||
unset($sep);
|
||||
|
||||
if (is_admin() === true) {
|
||||
echo '<div class="pull-right"><a data-toggle="modal" href="#create-service"><i class="fa fa-cog" style="color:green" aria-hidden="true"></i> Add Service</a></div>';
|
||||
}
|
||||
print_optionbar_end();
|
||||
?>
|
||||
<div class="row col-sm-12"><span id="message"></span></div>
|
||||
<?php
|
||||
|
||||
echo '</div><div>';
|
||||
|
||||
if (count($services) > '0') {
|
||||
// Loop over each service, pulling out the details.
|
||||
?>
|
||||
<table class="table table-hover table-condensed table-striped">
|
||||
<?php
|
||||
foreach ($services as $service) {
|
||||
$service['service_ds'] = htmlspecialchars_decode($service['service_ds']);
|
||||
if ($service['service_status'] == '2') {
|
||||
$status = "<span class='col-sm-12 label label-danger label-border'><b>".$service['service_type']."</b></span>";
|
||||
} elseif ($service['service_status'] == '1') {
|
||||
$status = "<span class='col-sm-12 label label-warning label-border'><b>".$service['service_type']."</b></span>";
|
||||
} elseif ($service['service_status'] == '0') {
|
||||
$status = "<span class='col-sm-12 label label-success label-border'><b>".$service['service_type']."</b></span>";
|
||||
} else {
|
||||
$status = "<span class='col-sm-12 label label-info label-border'><b>".$service['service_type']."</b></span>";
|
||||
}
|
||||
?>
|
||||
<tr id="row_<?php echo $service['service_id']?>">
|
||||
<td class="col-sm-12">
|
||||
<div class="col-sm-1"><?php echo $status?></div>
|
||||
<div class="col-sm-2 text-muted"><?php echo formatUptime(time() - $service['service_changed'])?></div>
|
||||
<div class="col-sm-2 text-muted"><?php echo $service['service_desc']?></div>
|
||||
<div class="col-sm-5"><?php echo nl2br(trim($service['service_message']))?></div>
|
||||
<div class="col-sm-2">
|
||||
<div class="pull-right">
|
||||
<?php
|
||||
if (is_admin() === true) {
|
||||
echo "<button type='button' class='btn btn-primary btn-sm' aria-label='Edit' data-toggle='modal' data-target='#create-service' data-service_id='{$service['service_id']}' name='edit-service'><i class='fa fa-pencil' aria-hidden='true'></i></button>
|
||||
<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-service_id='{$service['service_id']}' name='delete-service'><i class='fa fa-trash' aria-hidden='true'></i></button";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($vars['view'] == 'details') {
|
||||
// if we have a script for this check, use it.
|
||||
$check_script = $config['install_dir'].'/includes/services/check_'.strtolower($service['service_type']).'.inc.php';
|
||||
if (is_file($check_script)) {
|
||||
include $check_script;
|
||||
|
||||
// If we have a replacement DS use it.
|
||||
if (isset($check_ds)) {
|
||||
$service['service_ds'] = $check_ds;
|
||||
echo '<table class="table table-hover table-condensed">';
|
||||
|
||||
foreach ($services as $service) {
|
||||
$service['service_ds'] = htmlspecialchars_decode($service['service_ds']);
|
||||
if ($service['service_status'] == '2') {
|
||||
$status = '<span class="alert-status label-danger"><span class="device-services-page">' . $service['service_type'] . '</span></span>';
|
||||
} elseif ($service['service_status'] == '1') {
|
||||
$status = '<span class="alert-status label-warning"><span class="device-services-page">' . $service['service_type'] . '</span></span>';
|
||||
} elseif ($service['service_status'] == '0') {
|
||||
$status = '<span class="alert-status label-success"><span class="device-services-page">' . $service['service_type'] . '</span></span>';
|
||||
} else {
|
||||
$status = '<span class="alert-status label-info"><span class="device-services-page">' . $service['service_type'] . '</span></span>';
|
||||
}
|
||||
|
||||
echo '<tr id="row_' . $service['service_id'] . '">';
|
||||
echo '<td class="col-sm-12">';
|
||||
echo '<div class="col-sm-1">' . $status . '</div>';
|
||||
echo '<div class="col-sm-2 text-muted">' . formatUptime(time() - $service['service_changed']) . '</div>';
|
||||
echo '<div class="col-sm-2 text-muted">' . $service['service_desc'] . '</div>';
|
||||
echo '<div class="col-sm-5">' . nl2br(trim($service['service_message'])) . '</div>';
|
||||
echo '<div class="col-sm-2">';
|
||||
echo '<div class="pull-right">';
|
||||
if (is_admin() === true) {
|
||||
echo "<button type='button' class='btn btn-primary btn-sm' aria-label='Edit' data-toggle='modal' data-target='#create-service' data-service_id='{$service['service_id']}' name='edit-service'><i class='fa fa-pencil' aria-hidden='true'></i></button>
|
||||
<button type='button' class='btn btn-danger btn-sm' aria-label='Delete' data-toggle='modal' data-target='#confirm-delete' data-service_id='{$service['service_id']}' name='delete-service'><i class='fa fa-trash' aria-hidden='true'></i></button";
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($vars['view'] == 'details') {
|
||||
// if we have a script for this check, use it.
|
||||
$check_script = $config['install_dir'] . '/includes/services/check_' . strtolower($service['service_type']) . '.inc.php';
|
||||
if (is_file($check_script)) {
|
||||
include $check_script;
|
||||
|
||||
// If we have a replacement DS use it.
|
||||
if (isset($check_ds)) {
|
||||
$service['service_ds'] = $check_ds;
|
||||
}
|
||||
}
|
||||
|
||||
$graphs = json_decode($service['service_ds'], true);
|
||||
foreach ($graphs as $k => $v) {
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['type'] = 'device_service';
|
||||
$graph_array['service'] = $service['service_id'];
|
||||
$graph_array['ds'] = $k;
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="5"><div class="col-sm-12">';
|
||||
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
|
||||
echo '</div></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$graphs = json_decode($service['service_ds'], true);
|
||||
foreach ($graphs as $k => $v) {
|
||||
$graph_array['device'] = $device['device_id'];
|
||||
$graph_array['type'] = 'device_service';
|
||||
$graph_array['service'] = $service['service_id'];
|
||||
$graph_array['ds'] = $k;
|
||||
?>
|
||||
<tr><td colspan="5">
|
||||
<div class="col-sm-12">
|
||||
<?php
|
||||
include 'includes/print-graphrow.inc.php';
|
||||
?>
|
||||
</div>
|
||||
</td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
echo '</table>';
|
||||
} else {
|
||||
?>
|
||||
<div class='row col-sm-12'>No Services</div>
|
||||
<?php
|
||||
echo '<div class="device-services-page-no-service">No Services</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
echo '</div>';
|
||||
|
Loading…
Reference in New Issue
Block a user