Introduce config-switch to regather contacts before dispatch

This commit is contained in:
f0o
2015-05-22 10:26:19 +00:00
parent d1af636b9e
commit e242924fd8
3 changed files with 6 additions and 0 deletions

View File

@@ -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'].',%"');

View File

@@ -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:

View File

@@ -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