librenms-librenms/html/includes/print-alerts.inc.php

50 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2015-07-13 20:10:26 +02:00
$hostname = gethostbyid($alert_entry['device_id']);
$alert_state = $alert_entry['state'];
2015-07-13 20:10:26 +02:00
echo '<tr>
<td>
'.$alert_entry['time_logged'].'
</td>';
if (!isset($alert_entry['device'])) {
2015-07-13 20:10:26 +02:00
$dev = device_by_id_cache($alert_entry['device_id']);
echo '<td>
'.generate_device_link($dev, shorthost($dev['hostname'])).'
</td>';
}
2015-07-13 20:10:26 +02:00
echo '<td>'.htmlspecialchars($alert_entry['name']).'</td>';
2015-07-13 20:10:26 +02:00
if ($alert_state != '') {
if ($alert_state == '0') {
$glyph_icon = 'ok';
$glyph_color = 'green';
2015-07-13 20:10:26 +02:00
$text = 'Ok';
}
2015-07-13 20:10:26 +02:00
else if ($alert_state == '1') {
$glyph_icon = 'remove';
$glyph_color = 'red';
2015-07-13 20:10:26 +02:00
$text = 'Alert';
}
2015-07-13 20:10:26 +02:00
else if ($alert_state == '2') {
$glyph_icon = 'info-sign';
$glyph_color = 'lightgrey';
2015-07-13 20:10:26 +02:00
$text = 'Ack';
}
2015-07-13 20:10:26 +02:00
else if ($alert_state == '3') {
$glyph_icon = 'arrow-down';
$glyph_color = 'orange';
2015-07-13 20:10:26 +02:00
$text = 'Worse';
}
2015-07-13 20:10:26 +02:00
else if ($alert_state == '4') {
$glyph_icon = 'arrow-up';
$glyph_color = 'khaki';
2015-07-13 20:10:26 +02:00
$text = 'Better';
}//end if
echo "<td><b><span class='glyphicon glyphicon-".$glyph_icon."' style='color:".$glyph_color."'></span> $text</b></td>";
}//end if
2015-07-13 20:10:26 +02:00
echo '</tr>';