mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Ability to edit default alert template (#7121)
* newfeature: ability to edit default alert template * Fix style errors * Added missing db query * Removed unnecessary code, and added faq section * Minor documentation about default alert template. And put back wrongly removed lines * Fixing the silly old mistakes... again
This commit is contained in:
committed by
Neil Lathwood
parent
0ebf436d47
commit
34d0fc3199
@@ -446,6 +446,9 @@ function DescribeAlert($alert)
|
||||
$i = 0;
|
||||
$device = dbFetchRow('SELECT hostname, sysName, sysDescr, hardware, version, location, purpose, notes, uptime FROM devices WHERE device_id = ?', array($alert['device_id']));
|
||||
$tpl = dbFetchRow('SELECT `template`,`title`,`title_rec` FROM `alert_templates` JOIN `alert_template_map` ON `alert_template_map`.`alert_templates_id`=`alert_templates`.`id` WHERE `alert_template_map`.`alert_rule_id`=?', array($alert['rule_id']));
|
||||
if (!$tpl) {
|
||||
$tpl = dbFetchRow("SELECT `template`,`title`,`title_rec` FROM `alert_templates` WHERE `name`='Default Alert Template'");
|
||||
}
|
||||
$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}";
|
||||
$obj['hostname'] = $device['hostname'];
|
||||
$obj['sysName'] = $device['sysName'];
|
||||
|
Reference in New Issue
Block a user