Change the default alert delay to 1m (#8462)

Add regex type for numbers
Tooltips for all alert rule dialog items
This commit is contained in:
Tony Murray
2018-03-28 22:10:54 -05:00
committed by GitHub
parent 7ea189745d
commit d91fe84fc3

View File

@@ -36,7 +36,7 @@ if (is_admin()) {
<input type="hidden" name="type" id="type" value="alert-rules">
<input type="hidden" name="template_id" id="template_id" value="">
<input type="hidden" name="builder_json" id="builder_json" value="">
<div class='form-group'>
<div class='form-group' title="The description of this alert rule.">
<label for='name' class='col-sm-3 control-label'>Rule name: </label>
<div class='col-sm-9'>
<input type='text' id='name' name='name' class='form-control validation' maxlength='200' required>
@@ -52,14 +52,10 @@ if (is_admin()) {
Import from
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="import-from"
id="import-dropdown">
<li><a href="#" name="import-query" id="import-query">SQL Query</a>
</li>
<li><a href="#" name="import-old-format" id="import-old-format">Old
Format</a></li>
<li><a href="#" name="import-collection" id="import-collection">Collection</a>
</li>
<ul class="dropdown-menu" aria-labelledby="import-from" id="import-dropdown">
<li><a href="#" name="import-query" id="import-query">SQL Query</a></li>
<li><a href="#" name="import-old-format" id="import-old-format">Old Format</a></li>
<li><a href="#" name="import-collection" id="import-collection">Collection</a></li>
</ul>
</div>
</div>
@@ -68,7 +64,7 @@ if (is_admin()) {
<div id="builder"></div>
</div>
</div>
<div class="form-group">
<div class="form-group" title="How to display the alert. OK: green, Warning: yellow, Critical: red">
<label for='severity' class='col-sm-3 control-label'>Severity: </label>
<div class="col-sm-2">
<select name='severity' id='severity' class='form-control'>
@@ -79,42 +75,42 @@ if (is_admin()) {
</div>
</div>
<div class="form-group form-inline">
<label for='count' class='col-sm-3 control-label'>Max alerts: </label>
<div class="col-sm-2">
<label for='count' class='col-sm-3 control-label' title="How many notifications to issue while active before stopping. -1 means no limit. If interval is 0, this has no effect.">Max alerts: </label>
<div class="col-sm-2" title="How many notifications to issue while active before stopping. -1 means no limit. If interval is 0, this has no effect.">
<input type='text' id='count' name='count' class='form-control' size="4" value="123">
</div>
<div class="col-sm-3">
<div class="col-sm-3" title="How log to wait before issuing a notification. If the alert clears before the delay, no notification will be issued. (s,m,h,d)">
<label for='delay' class='control-label' style="vertical-align: top;">Delay: </label>
<input type='text' id='delay' name='delay' class='form-control' size="4">
</div>
<div class="col-sm-4">
<div class="col-sm-4" title="How often to re-issue notifications while this alert is active. 0 means notify once. This is affected by the poller interval. (s,m,h,d)">
<label for='interval' class='control-label align-top' style="vertical-align: top;">Interval: </label>
<input type='text' id='interval' name='interval' class='form-control' size="4">
</div>
</div>
<div class='form-group'>
<label for='mute' class='col-sm-3 control-label'>Mute alerts: </label>
<div class='col-sm-2'>
<label for='mute' class='col-sm-3 control-label' title="Show alert status in the webui, but do not issue notifications.">Mute alerts: </label>
<div class='col-sm-2'title="Show alert status in the webui, but do not issue notifications.">
<input type="checkbox" name="mute" id="mute">
</div>
<label for='invert' class='col-sm-2 control-label'>Invert match: </label>
<div class='col-sm-2'>
<label for='invert' class='col-sm-2 control-label' title="Alert when this rule doesn't match.">Invert match: </label>
<div class='col-sm-2' title="Alert when this rule doesn't match.">
<input type='checkbox' name='invert' id='invert'>
</div>
</div>
<div class="form-group">
<div class="form-group" title="Issue recovery notifications.">
<label for='recovery' class='col-sm-3 control-label'>Recovery alerts: </label>
<div class='col-sm-2'>
<input type='checkbox' name='recovery' id='recovery'>
</div>
</div>
<div class="form-group">
<label for='maps' class='col-sm-3 control-label'data-toggle="tooltip" title="Restricts this alert rule to the selected devices or groups.">Map To: </label>
<div class="form-group" title="Restricts this alert rule to the selected devices or groups.">
<label for='maps' class='col-sm-3 control-label'>Map To: </label>
<div class="col-sm-9">
<select id="maps" name="maps[]" class="form-control" multiple="multiple"></select>
</div>
</div>
<div class='form-group'>
<div class='form-group' title="A link to some documentation on how to handle this alert. This will be included in notifications.">
<label for='proc' class='col-sm-3 control-label'>Procedure URL: </label>
<div class='col-sm-9'>
<input type='text' id='proc' name='proc' class='form-control validation' pattern='(http|https)://.*' maxlength='80'>
@@ -164,8 +160,8 @@ if (is_admin()) {
{type: 'less_or_equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime']},
{type: 'greater', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime']},
{type: 'greater_or_equal', nb_inputs: 1, multiple: false, apply_to: ['string', 'number', 'datetime']},
{type: 'regex', nb_inputs: 1, multiple: false, apply_to: ['string']},
{type: 'not_regex', nb_inputs: 1, multiple: false, apply_to: ['string']}
{type: 'regex', nb_inputs: 1, multiple: false, apply_to: ['string', 'number']},
{type: 'not_regex', nb_inputs: 1, multiple: false, apply_to: ['string', 'number']}
],
lang: {
operators: {
@@ -272,8 +268,8 @@ if (is_admin()) {
$("#recovery").bootstrapSwitch('state', true);
$(this).find("input[type=text]").val("");
$('#count').val('-1');
$('#delay').val('5 m');
$('#interval').val('5 m');
$('#delay').val('1m');
$('#interval').val('5m');
var $maps = $('#maps');
$maps.empty();
@@ -305,21 +301,21 @@ if (is_admin()) {
var extra = rule.extra;
$('#count').val(extra.count);
if ((extra.delay / 86400) >= 1) {
$('#delay').val(extra.delay / 86400 + ' d');
$('#delay').val(extra.delay / 86400 + 'd');
} else if ((extra.delay / 3600) >= 1) {
$('#delay').val( extra.delay / 3600 + ' h');
$('#delay').val( extra.delay / 3600 + 'h');
} else if ((extra.delay / 60) >= 1) {
$('#delay').val( extra.delay / 60 + ' m');
$('#delay').val( extra.delay / 60 + 'm');
} else {
$('#delay').val(extra.delay);
}
if ((extra.interval / 86400) >= 1) {
$('#interval').val(extra.interval / 86400 + ' d');
$('#interval').val(extra.interval / 86400 + 'd');
} else if ((extra.interval / 3600) >= 1) {
$('#interval').val(extra.interval / 3600 + ' h');
$('#interval').val(extra.interval / 3600 + 'h');
} else if ((extra.interval / 60) >= 1) {
$('#interval').val(extra.interval / 60 + ' m');
$('#interval').val(extra.interval / 60 + 'm');
} else {
$('#interval').val(extra.interval);
}