mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Eventlog table refresh (#7793)
* initial release * added copyright info * set username to System if empty * eventlog page cleanup * added copyright
This commit is contained in:
@@ -1,4 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
$common_output[] = '
|
$common_output[] = '
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@@ -6,9 +19,9 @@ $common_output[] = '
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-column-id="eventicon"></th>
|
<th data-column-id="eventicon"></th>
|
||||||
<th data-column-id="datetime" data-order="desc">Datetime</th>
|
<th data-column-id="datetime" data-order="desc">Timestamp</th>
|
||||||
<th data-column-id="hostname">Hostname</th>
|
|
||||||
<th data-column-id="type">Type</th>
|
<th data-column-id="type">Type</th>
|
||||||
|
<th data-column-id="hostname">Hostname</th>
|
||||||
<th data-column-id="message">Message</th>
|
<th data-column-id="message">Message</th>
|
||||||
<th data-column-id="username">User</th>
|
<th data-column-id="username">User</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -1441,17 +1441,17 @@ function eventlog_severity($eventlog_severity)
|
|||||||
{
|
{
|
||||||
switch ($eventlog_severity) {
|
switch ($eventlog_severity) {
|
||||||
case 1:
|
case 1:
|
||||||
return "severity-ok"; //OK
|
return "label-success"; //OK
|
||||||
case 2:
|
case 2:
|
||||||
return "severity-info"; //Informational
|
return "label-info"; //Informational
|
||||||
case 3:
|
case 3:
|
||||||
return "severity-notice"; //Notice
|
return "label-primary"; //Notice
|
||||||
case 4:
|
case 4:
|
||||||
return "severity-warning"; //Warning
|
return "label-warning"; //Warning
|
||||||
case 5:
|
case 5:
|
||||||
return "severity-critical"; //Critical
|
return "label-danger"; //Critical
|
||||||
default:
|
default:
|
||||||
return "severity-unknown"; //Unknown
|
return "label-default"; //Unknown
|
||||||
}
|
}
|
||||||
} // end eventlog_severity
|
} // end eventlog_severity
|
||||||
|
|
||||||
|
@@ -1,4 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
$where = '1';
|
$where = '1';
|
||||||
|
|
||||||
@@ -61,8 +74,12 @@ foreach (dbFetchRows($sql, $param) as $eventlog) {
|
|||||||
}
|
}
|
||||||
$severity_colour = $eventlog['severity'];
|
$severity_colour = $eventlog['severity'];
|
||||||
|
|
||||||
|
if ($eventlog['username'] == '') {
|
||||||
|
$eventlog['username'] = 'System';
|
||||||
|
}
|
||||||
|
|
||||||
$response[] = array(
|
$response[] = array(
|
||||||
'eventicon' => "<i class='fa fa-bookmark fa-lg ".eventlog_severity($severity_colour)."' aria-hidden='true'></i>",
|
'eventicon' => "<span class='alert-status ".eventlog_severity($severity_colour)."'> </span>",
|
||||||
'datetime' => $eventlog['humandate'],
|
'datetime' => $eventlog['humandate'],
|
||||||
'hostname' => generate_device_link($dev, shorthost($dev['hostname'])),
|
'hostname' => generate_device_link($dev, shorthost($dev['hostname'])),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
|
@@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
$no_refresh = true;
|
$no_refresh = true;
|
||||||
|
|
||||||
$param = array();
|
$param = array();
|
||||||
|
|
||||||
if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
||||||
@@ -10,59 +22,62 @@ if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pagetitle[] = 'Eventlog';
|
$pagetitle[] = 'Eventlog';
|
||||||
|
|
||||||
print_optionbar_start();
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form method="post" action="" class="form-inline" role="form" id="result_form">
|
<div class="panel panel-default panel-condensed">
|
||||||
<div class="form-group">
|
<div class="panel-heading">
|
||||||
<label>
|
<strong>Eventlog</strong>
|
||||||
<strong>Device</strong>
|
</div>
|
||||||
</label>
|
|
||||||
<select name="device" id="device" class="form-control input-sm">
|
<?php
|
||||||
<option value="">All Devices</option>
|
require_once 'includes/common/eventlog.inc.php';
|
||||||
|
echo implode('', $common_output);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('.actionBar').append(
|
||||||
|
'<div class="pull-left">' +
|
||||||
|
'<form method="post" action="" class="form-inline" role="form" id="result_form">' +
|
||||||
|
'<div class="form-group">' +
|
||||||
|
'<label><strong>Device </strong></label>' +
|
||||||
|
'<select name="device" id="device" class="form-control input-sm">' +
|
||||||
|
'<option value="">All Devices</option>' +
|
||||||
<?php
|
<?php
|
||||||
foreach (get_all_devices() as $data) {
|
foreach (get_all_devices() as $data) {
|
||||||
if (device_permitted($data['device_id'])) {
|
if (device_permitted($data['device_id'])) {
|
||||||
echo "<option value='".$data['device_id']."'";
|
echo "'<option value=\"" . $data['device_id'] . "\"";
|
||||||
if ($data['device_id'] == $_POST['device']) {
|
if ($data['device_id'] == $_POST['device']) {
|
||||||
echo 'selected';
|
echo ' selected';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '>'.format_hostname($data).'</option>';
|
echo ">" . format_hostname($data) . "</option>' + ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
'</select>' +
|
||||||
</div>
|
'</div> ' +
|
||||||
<div class="form-group">
|
'<div class="form-group"><label><strong>Type </strong></label>' +
|
||||||
<label>
|
'<select name="eventtype" id="eventtype" class="form-control input-sm">' +
|
||||||
<strong>Type: </strong>
|
'<option value="">All types</option>' +
|
||||||
</label>
|
<?php
|
||||||
<select name="eventtype" id="eventtype" class="form-control input-sm">
|
|
||||||
<option value="">All types</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
foreach (dbFetchColumn("SELECT `type` FROM `eventlog` GROUP BY `type`") as $type) {
|
foreach (dbFetchColumn("SELECT `type` FROM `eventlog` GROUP BY `type`") as $type) {
|
||||||
echo "<option value='$type'";
|
echo "'<option value=\"" . $type . "\"";
|
||||||
if ($type === $_POST['eventtype']) {
|
if ($type === $_POST['eventtype']) {
|
||||||
echo ' selected';
|
echo " selected";
|
||||||
}
|
}
|
||||||
echo ">$type</option>";
|
echo ">" . $type . "</option>' + ";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</select>
|
'</select>' +
|
||||||
</div>
|
'</div> ' +
|
||||||
<button type="submit" class="btn btn-default input-sm">Filter</button>
|
'<button type="submit" class="btn btn-default input-sm">Filter</button>' +
|
||||||
</form>
|
'</form>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
|
||||||
print_optionbar_end();
|
|
||||||
|
|
||||||
require_once 'includes/common/eventlog.inc.php';
|
|
||||||
echo implode('', $common_output);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user