Add filter for delayed alerts

my work place is used to zenoss’ way to display warning and critical in different colors and events only turn critical after retries and delayed. when I introduce librenms, they feel strongly against the alert widget and alerts panel due to librenms has different concept of warning and different ways of alert.

Since my colleagues are used to watch display screen instead of email or other transporter, it is big concern for them if false/non-confirmed alerts keep showing on the dashboard. Although I have gone through the librenms performance tips and followed the procedures, we are still getting false alerts for Device up/down. Therefore, I decided to customize the display and only show delayed alerts, which is confirmed and sure.

I have made the changes on alert widget and it is working as expected so far. I thought someone else may want this feature as well. hereby, I provide my changes below and please import into code.

[[email protected] ~]# diff original/common_alerts.inc.php /opt/librenms/html/includes/common/alerts.inc.php
41a42
>     $current_delayed =  isset($widget_settings['delayed']) ? $widget_settings['delayed'] : '';
65a67,80
>       <label for="delayed" class="control-label">Show only delayed alerts: </label>
>     </div>
>     <div class="col-sm-8">
>       <select class="form-control" name="delayed">';
>
>     $common_output[] = '<option value=""' . ($current_delayed == '' ? ' selected' : ' ') . '>not filtered</option>';
>     $common_output[] = '<option value="1"' . ($current_delayed == '1' ? ' selected' : ' ') . '>show only delayed alerts</option>';
>
>     $common_output[] = '
>       </select>
>     </div>
>   </div>
>   <div class="form-group row">
>     <div class="col-sm-4">
138a154
>     $delayed = $widget_settings['delayed'];
160a177,180
>
>     if (is_numeric($delayed)) {
>        $title = "Delayed $title";
>     }
218a239,241
>     }
>     if (is_numeric($delayed)) {
>         $common_output[] = "delayed: '$delayed',\n";
[[email protected] ~]# diff original/table_alerts.inc.php /opt/librenms/html/includes/table/alerts.inc.php
51a52,55
> if (is_numeric($vars['delayed'])) {
>    $where .= " AND `alerts`.`alerted`=" . $alert_states['alerted'];
> }
>

Thanks and regards,
Roger

If you would like to share with others, please create a “pull request” on github.

Here is some documentation:
https://docs.librenms.org/Developing/#how-to-contribute

You should read the using git section at least.

Hi, I have made pull request accordingly. Please have a look.
Cheers,
Roger

Hello,

It seems that this patch has not been applied. We also need to filter delayed alerts on alert history.