mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 08:01:38 +02:00
Merge pull request #541 from Rosiak/master
Print alert state and a matching glyphic
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$hostname = gethostbyid($alert_entry['device_id']);
|
$hostname = gethostbyid($alert_entry['device_id']);
|
||||||
|
$alert_state = $alert_entry['state'];
|
||||||
|
|
||||||
echo('<tr>
|
echo('<tr>
|
||||||
<td>
|
<td>
|
||||||
@@ -14,8 +15,37 @@ if (!isset($alert_entry['device'])) {
|
|||||||
</td>");
|
</td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("<td>".htmlspecialchars($alert_entry['name']) . "</td>
|
echo("<td>".htmlspecialchars($alert_entry['name']) . "</td>");
|
||||||
|
|
||||||
</tr>");
|
if ($alert_state!='') {
|
||||||
|
if ($alert_state=='0') {
|
||||||
|
$glyph_icon = 'ok';
|
||||||
|
$glyph_color = 'green';
|
||||||
|
$text = 'Ok';
|
||||||
|
}
|
||||||
|
elseif ($alert_state=='1') {
|
||||||
|
$glyph_icon = 'remove';
|
||||||
|
$glyph_color = 'red';
|
||||||
|
$text = 'Alert';
|
||||||
|
}
|
||||||
|
elseif ($alert_state=='2') {
|
||||||
|
$glyph_icon = 'info-sign';
|
||||||
|
$glyph_color = 'lightgrey';
|
||||||
|
$text = 'Ack';
|
||||||
|
}
|
||||||
|
elseif ($alert_state=='3') {
|
||||||
|
$glyph_icon = 'arrow-down';
|
||||||
|
$glyph_color = 'orange';
|
||||||
|
$text = 'Worse';
|
||||||
|
}
|
||||||
|
elseif ($alert_state=='4') {
|
||||||
|
$glyph_icon = 'arrow-up';
|
||||||
|
$glyph_color = 'khaki';
|
||||||
|
$text = 'Better';
|
||||||
|
}
|
||||||
|
echo("<td><b><span class='glyphicon glyphicon-".$glyph_icon."' style='color:".$glyph_color."'></span> $text</b></td>");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo("</tr>");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ if ($_SESSION['userlevel'] >= '5')
|
|||||||
}
|
}
|
||||||
$count_query = "SELECT COUNT(time_logged) $query";
|
$count_query = "SELECT COUNT(time_logged) $query";
|
||||||
$count = dbFetchCell($count_query,$param);
|
$count = dbFetchCell($count_query,$param);
|
||||||
$full_query = "SELECT D.device_id,name,time_logged,DATE_FORMAT(time_logged, '%D %b %Y %T') as humandate $query LIMIT $start,$numresults";
|
$full_query = "SELECT D.device_id,name,state,time_logged,DATE_FORMAT(time_logged, '%D %b %Y %T') as humandate $query LIMIT $start,$numresults";
|
||||||
echo('<div class="panel panel-default panel-condensed">
|
echo('<div class="panel panel-default panel-condensed">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -199,10 +199,10 @@ if ($config['enable_syslog'])
|
|||||||
if ($_SESSION['userlevel'] >= '10')
|
if ($_SESSION['userlevel'] >= '10')
|
||||||
{
|
{
|
||||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
$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";
|
$alertquery = "SELECT devices.device_id,name,state,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 {
|
} 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";
|
$alertquery = "SELECT devices.device_id,name,state,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);
|
$data = mysql_query($query);
|
||||||
|
|||||||
Reference in New Issue
Block a user