diff --git a/alerts.php b/alerts.php index 56fd4ffdd7..6af7370b3d 100755 --- a/alerts.php +++ b/alerts.php @@ -88,6 +88,9 @@ function IssueAlert($alert) { return true; } $default_tpl = "%title\r\nSeverity: %severity\r\n{if %state == 0}Time elapsed: %elapsed\r\n{/if}Timestamp: %timestamp\r\nUnique-ID: %uid\r\nRule: {if %name}%name{else}%rule{/if}\r\n{if %faults}Faults:\r\n{foreach %faults} #%key: %value.string\r\n{/foreach}{/if}Alert sent to: {foreach %contacts}%value <%key> {/foreach}"; //FIXME: Put somewhere else? + if( $config['alert']['fixed-contacts'] == false ) { + $alert['details']['contacts'] = GetContacts($alert['details']['rule']); + } $obj = DescribeAlert($alert); if( is_array($obj) ) { $tpl = dbFetchRow('SELECT template FROM alert_templates WHERE rule_id LIKE "%,'.$alert['rule_id'].',%"'); diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index f27fce6c1c..59fb295f93 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -122,6 +122,8 @@ Alert sent to: {foreach %contacts}%value <%key> {/foreach} Transports are located within `$config['install_dir']/includes/alerts/transports.*.php` and defined as well as configured via `$config['alert']['transports']['Example'] = 'Some Options'`. Contacts will be gathered automatically and passed to the configured transports. +By default the Contacts will be only gathered when the alert triggers and will ignore future changes in contacts for the incident. If you want contacts to be re-gathered before each dispatch, please set `$config['alert']['fixed-contacts'] = false;` in your config.php. + The contacts will always include the `SysContact` defined in the Device's SNMP configuration and also every LibreNMS-User that has at least `read`-permissions on the entity that is to be alerted. At the moment LibreNMS only supports Port or Device permissions. You can exclude the `SysContact` by setting: diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 9710868d7c..fc56cb2aa2 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -239,6 +239,7 @@ $config['alert'] = array( 'default_only' => false, //Only issue to default 'default_mail' => '', //Default email 'tolerance-window' => 10, //Allow +/-10s tolerance to delay values to counter cron-irregularities + 'fixed-contacts' => true, //If true any changes in user-permissions,user-mail,syscontact,default-mail will not be honoured until the next alert triggers. ); //Legacy options