mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add option to disable the send of acknowledgement alerts. (#15208)
This commit is contained in:
@@ -59,6 +59,7 @@ $invert = isset($_POST['invert']) ? $_POST['invert'] : null;
|
||||
$name = strip_tags($_POST['name']);
|
||||
$proc = $_POST['proc'];
|
||||
$recovery = $vars['recovery'];
|
||||
$acknowledgement = $vars['acknowledgement'];
|
||||
$invert_map = isset($_POST['invert_map']) ? $_POST['invert_map'] : null;
|
||||
$severity = $_POST['severity'];
|
||||
|
||||
@@ -82,6 +83,7 @@ if ($invert == 'on') {
|
||||
}
|
||||
|
||||
$recovery = empty($recovery) ? $recovery = false : true;
|
||||
$acknowledgement = empty($acknowledgement) ? $acknowledgement = false : true;
|
||||
|
||||
if ($invert_map == 'on') {
|
||||
$invert_map = true;
|
||||
@@ -90,13 +92,14 @@ if ($invert_map == 'on') {
|
||||
}
|
||||
|
||||
$extra = [
|
||||
'mute' => $mute,
|
||||
'count' => $count,
|
||||
'delay' => $delay_sec,
|
||||
'invert' => $invert,
|
||||
'interval' => $interval_sec,
|
||||
'recovery' => $recovery,
|
||||
'options' => $options,
|
||||
'mute' => $mute,
|
||||
'count' => $count,
|
||||
'delay' => $delay_sec,
|
||||
'invert' => $invert,
|
||||
'interval' => $interval_sec,
|
||||
'recovery' => $recovery,
|
||||
'acknowledgement' => $acknowledgement,
|
||||
'options' => $options,
|
||||
];
|
||||
|
||||
$extra_json = json_encode($extra);
|
||||
|
@@ -47,6 +47,7 @@ if (is_numeric($template_id)) {
|
||||
'invert' => Config::get('alert_rule.invert_rule_match'),
|
||||
'interval' => 60 * Config::get('alert_rule.interval'),
|
||||
'recovery' => Config::get('alert_rule.recovery_alerts'),
|
||||
'acknowledgement' => Config::get('alert_rule.acknowledgement_alerts'),
|
||||
];
|
||||
$output = [
|
||||
'status' => 'ok',
|
||||
|
@@ -47,6 +47,7 @@ if (is_numeric($rule_id)) {
|
||||
'invert' => Config::get('alert_rule.invert_rule_match'),
|
||||
'interval' => 60 * Config::get('alert_rule.interval'),
|
||||
'recovery' => Config::get('alert_rule.recovery_alerts'),
|
||||
'acknowledgement' => Config::get('alert_rule.acknowledgement_alerts'),
|
||||
];
|
||||
$output = [
|
||||
'status' => 'ok',
|
||||
|
@@ -22,6 +22,7 @@ $default_interval = Config::get('alert_rule.interval') . 'm';
|
||||
$default_mute_alerts = Config::get('alert_rule.mute_alerts');
|
||||
$default_invert_rule_match = Config::get('alert_rule.invert_rule_match');
|
||||
$default_recovery_alerts = Config::get('alert_rule.recovery_alerts');
|
||||
$default_acknowledgement_alerts = Config::get('alert_rule.acknowledgement_alerts');
|
||||
$default_invert_map = Config::get('alert_rule.invert_map');
|
||||
|
||||
if (Auth::user()->hasGlobalAdmin()) {
|
||||
@@ -112,11 +113,15 @@ if (Auth::user()->hasGlobalAdmin()) {
|
||||
<input type='checkbox' name='invert' id='invert'>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" title="Issue recovery notifications.">
|
||||
<label for='recovery' class='col-sm-3 col-md-2 control-label'>Recovery alerts </label>
|
||||
<div class='col-sm-2'>
|
||||
<div class="form-group form-inline">
|
||||
<label for='recovery' class='col-sm-3 col-md-2 control-label' title="Issue recovery alerts.">Recovery alerts </label>
|
||||
<div class='col-sm-2' title="Issue recovery alerts.">
|
||||
<input type='checkbox' name='recovery' id='recovery'>
|
||||
</div>
|
||||
<label for='acknowledgement' class='col-sm-3 col-md-3 control-label' title="Issue acknowledgement alerts." style="vertical-align: top;">Acknowledgement alerts </label>
|
||||
<div class='col-sm-2' title="Issue acknowledgement alerts.">
|
||||
<input type='checkbox' name='acknowledgement' id='acknowledgement'>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label for='maps' class='col-sm-3 col-md-2 control-label' title="Restricts this alert rule to the selected devices, groups and locations.">Match devices, groups and locations list </label>
|
||||
@@ -308,6 +313,7 @@ if (Auth::user()->hasGlobalAdmin()) {
|
||||
$("#mute").bootstrapSwitch('state', <?=$default_mute_alerts?>);
|
||||
$("#invert").bootstrapSwitch('state', <?=$default_invert_rule_match?>);
|
||||
$("#recovery").bootstrapSwitch('state', <?=$default_recovery_alerts?>);
|
||||
$("#acknowledgement").bootstrapSwitch('state', <?=$default_acknowledgement_alerts?>);
|
||||
$("#override_query").bootstrapSwitch('state', false);
|
||||
$("#invert_map").bootstrapSwitch('state', <?=$default_invert_map?>);
|
||||
$(this).find("input[type=text]").val("");
|
||||
@@ -389,6 +395,9 @@ if (Auth::user()->hasGlobalAdmin()) {
|
||||
if (typeof extra.recovery == 'undefined') {
|
||||
extra.recovery = '<?=$default_recovery_alerts?>';
|
||||
}
|
||||
if (typeof extra.acknowledgement == 'undefined') {
|
||||
extra.acknowledgement = '<?=$default_acknowledgement_alerts?>';
|
||||
}
|
||||
|
||||
if (typeof extra.options == 'undefined') {
|
||||
extra.options = new Array();
|
||||
@@ -397,6 +406,7 @@ if (Auth::user()->hasGlobalAdmin()) {
|
||||
extra.options.override_query = false;
|
||||
}
|
||||
$("[name='recovery']").bootstrapSwitch('state', extra.recovery);
|
||||
$("[name='acknowledgement']").bootstrapSwitch('state', extra.acknowledgement);
|
||||
|
||||
if (rule.invert_map == 1) {
|
||||
$("[name='invert_map']").bootstrapSwitch('state', true);
|
||||
|
Reference in New Issue
Block a user