mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Change Default Page View
- Add print-alerts code - Change the view of the lower part of the front page from 12 columns to 2 x 6 columns - Add alertlog entries to the new column
This commit is contained in:
22
html/includes/print-alerts.inc.php
Normal file
22
html/includes/print-alerts.inc.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$hostname = gethostbyid($alert_entry['device_id']);
|
||||
|
||||
echo('<tr>
|
||||
<td>
|
||||
' . $alert_entry['time_logged'] . '
|
||||
</td>');
|
||||
|
||||
if (!isset($alert_entry['device'])) {
|
||||
$dev = device_by_id_cache($alert_entry['device_id']);
|
||||
echo("<td>
|
||||
" . generate_device_link($dev, shorthost($dev['hostname'])) . "
|
||||
</td>");
|
||||
}
|
||||
|
||||
echo("<td>".$alert_entry['link']."</td>");
|
||||
echo("<td>".htmlspecialchars($alert_entry['name']) . "</td>
|
||||
|
||||
</tr>");
|
||||
|
||||
?>
|
@@ -199,21 +199,37 @@ if ($config['enable_syslog'])
|
||||
if ($_SESSION['userlevel'] >= '10')
|
||||
{
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
$alertquery = "SELECT devices.device_id,name,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15";
|
||||
} else {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
|
||||
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
$alertquery = "SELECT devices.device_id,name,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " ORDER BY `time_logged` DESC LIMIT 0,15";
|
||||
}
|
||||
|
||||
$data = mysql_query($query);
|
||||
$alertdata = mysql_query($alertquery);
|
||||
|
||||
echo('<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6 column">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Alertlog entries</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">');
|
||||
|
||||
foreach (dbFetchRows($alertquery) as $alert_entry)
|
||||
{
|
||||
include("includes/print-alerts.inc.php");
|
||||
}
|
||||
echo('</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 column">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<strong>Eventlog entries</strong>
|
||||
|
Reference in New Issue
Block a user