diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index 1bfba162fd..f27fce6c1c 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -124,6 +124,10 @@ Transports are located within `$config['install_dir']/includes/alerts/transports Contacts will be gathered automatically and passed to the configured transports. 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: +```php +$config['alert']['syscontact'] = false; +``` To include users that have `Global-Read` or `Administrator` permissions it is required to add these additions to the `config.php` respectively: ```php $config['alert']['globals'] = true; //Include Global-Read into alert-contacts diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index 8392daa191..ea3bf8d499 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -299,12 +299,14 @@ function GetContacts($results) { } } if( is_numeric($result["device_id"]) ) { - if( dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_bool' AND device_id = ?",array($result["device_id"])) === "1" ) { - $tmpa = dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_string' AND device_id = ?",array($result["device_id"])); - } else { - $tmpa = dbFetchCell("SELECT sysContact FROM devices WHERE device_id = ?",array($result["device_id"])); + if( $config['alert']['syscontact'] == true ) { + if( dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_bool' AND device_id = ?",array($result["device_id"])) === "1" ) { + $tmpa = dbFetchCell("SELECT attrib_value FROM devices_attribs WHERE attrib_type = 'override_sysContact_string' AND device_id = ?",array($result["device_id"])); + } else { + $tmpa = dbFetchCell("SELECT sysContact FROM devices WHERE device_id = ?",array($result["device_id"])); + } + $contacts[$tmpa] = "NOC"; } - $contacts[$tmpa] = "NOC"; $tmpa = dbFetchRows("SELECT user_id FROM devices_perms WHERE access_level >= 0 AND device_id = ?", array($result["device_id"])); foreach( $tmpa as $tmp ) { $uids[$tmp['user_id']] = $tmp['user_id']; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index eeebfd7d1b..9710868d7c 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -233,6 +233,7 @@ $config['alert'] = array( 'mail' => false, // E-Mail alerting 'irc' => false, // IRC Alerting ), + 'syscontact' => true, //Issue to SysContact (or it's override) 'globals' => false, //Issue to global-read users 'admins' => false, //Issue to administrators 'default_only' => false, //Only issue to default