mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add config-option to exclude SysContact from alerts
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'];
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user