mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Honour 'Disable all alerting for this host'
Fixes some redundancy in macros (parentesis)
This commit is contained in:
@@ -84,6 +84,9 @@ function IsRuleValid($device,$rule) {
|
||||
*/
|
||||
function IssueAlert($alert) {
|
||||
global $config;
|
||||
if( dbFetchCell('SELECT attrib_value FROM devices_attribs WHERE attrib_type = "disable_notify" && device_id = ?',array($alert['device_id'])) == "1" ) {
|
||||
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?
|
||||
$obj = DescribeAlert($alert);
|
||||
if( is_array($obj) ) {
|
||||
@@ -101,6 +104,7 @@ function IssueAlert($alert) {
|
||||
}
|
||||
echo "\r\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,6 +316,7 @@ function DescribeAlert($alert) {
|
||||
$i = 0;
|
||||
$device = dbFetchRow("SELECT hostname FROM devices WHERE device_id = ?",array($alert['device_id']));
|
||||
$obj['hostname'] = $device['hostname'];
|
||||
$obj['device_id'] = $alert['device_id'];
|
||||
$extra = $alert['details'];
|
||||
if( $alert['state'] >= 1 ) {
|
||||
$obj['title'] = 'Alert for device '.$device['hostname'].' Alert-ID #'.$alert['id'];
|
||||
|
||||
Reference in New Issue
Block a user