Add time/times to alarm def creation

Change-Id: I66affefab3f8a95452a4fb724da3870e5928d3ce
This commit is contained in:
Adrian Czarnecki 2021-10-29 06:45:29 -07:00
parent 99591546cf
commit 1ce80db6e0
8 changed files with 86 additions and 26 deletions

View File

@ -4,12 +4,15 @@
<div class="clearfix"> <div class="clearfix">
<p class="text-info"> <p class="text-info">
{% blocktrans %} {% blocktrans %}
Each alarm definition is defined by its expression composed out of: Each alarm definition is defined by its expression composed out of
mathematical function, metric, threshold and comparator for metric's mathematical function, metric, time, times ,threshold and comparator for
value and the threshold. Additionally it is possible to narrow metric's value and the threshold. Time is the number of seconds for the measurement
evaluation of the alarm to certain entities by choosing their to be done. They can only be in a multiple of 60. Times is how many times in a row
dimensions. The deterministic alarms never enter UNDETERMINED state. that expression must be true before triggering the alarm. Both time and times are
Use them for metrics that are received sporadically. optional and default to 60 and 1 respectively. Additionally it is possible to narrow
evaluation of the alarm to certain entities by choosing their
dimensions. The deterministic alarms never enter UNDETERMINED state.
Use them for metrics that are received sporadically.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
</div> </div>

View File

@ -29,9 +29,11 @@ msgstr ""
msgid "" msgid ""
"\n" "\n"
" Each alarm definition is defined by its expression composed out of:\n" " Each alarm definition is defined by its expression composed out of:\n"
" mathematical function, metric, threshold and comparator for " " mathematical function, metric, time, times ,threshold and comparator for \n"
"metric's\n" " metric's value and the threshold. Time is the number of seconds for the measurement \n"
" value and the threshold. Additionally it is possible to narrow\n" " to be done. They can only be in a multiple of 60. Times is how many times in a row \n"
" that expression must be true before triggering the alarm. Both time and times are
" optional and default to 60 and 1 respectively. Additionally it is possible to narrow\n"
" evaluation of the alarm to certain entities by choosing their\n" " evaluation of the alarm to certain entities by choosing their\n"
" dimensions. The deterministic alarms never enter UNDETERMINED " " dimensions. The deterministic alarms never enter UNDETERMINED "
"state.\n" "state.\n"
@ -40,9 +42,11 @@ msgid ""
msgstr "" msgstr ""
"\n" "\n"
" Each alarm definition is defined by its expression composed out of:\n" " Each alarm definition is defined by its expression composed out of:\n"
" mathematical function, metric, threshold and comparator for " " mathematical function, metric, time, times ,threshold and comparator for \n"
"metric's\n" " metric's value and the threshold. Time is the number of seconds for the measurement \n"
" value and the threshold. Additionally it is possible to narrow\n" " to be done. They can only be in a multiple of 60. Times is how many times in a row \n"
" that expression must be true before triggering the alarm. Both time and times are
" optional and default to 60 and 1 respectively. Additionally it is possible to narrow\n"
" evaluation of the alarm to certain entities by choosing their\n" " evaluation of the alarm to certain entities by choosing their\n"
" dimensions. The deterministic alarms never enter UNDETERMINED " " dimensions. The deterministic alarms never enter UNDETERMINED "
"state.\n" "state.\n"

View File

@ -56,6 +56,12 @@ msgstr "Submit"
msgid "Threshold" msgid "Threshold"
msgstr "Threshold" msgstr "Threshold"
msgid "Time"
msgstr "Time"
msgid "Times"
msgstr "Times"
msgid "Up" msgid "Up"
msgstr "Up" msgstr "Up"

View File

@ -23,16 +23,18 @@ msgstr ""
"Name field digunakan untuk mengidentifikasi definisi alarm. " "Name field digunakan untuk mengidentifikasi definisi alarm. "
msgid "" msgid ""
"\n"
" Each alarm definition is defined by its expression composed out of:\n" " Each alarm definition is defined by its expression composed out of:\n"
" mathematical function, metric, threshold and comparator for " " mathematical function, metric, time, times ,threshold and comparator for \n"
"metric's\n" " metric's value and the threshold. Time is the number of seconds for the measurement \n"
" value and the threshold. Additionally it is possible to narrow\n" " to be done. They can only be in a multiple of 60. Times is how many times in a row \n"
" that expression must be true before triggering the alarm. Both time and times are
" optional and default to 60 and 1 respectively. Additionally it is possible to narrow\n"
" evaluation of the alarm to certain entities by choosing their\n" " evaluation of the alarm to certain entities by choosing their\n"
" dimensions. The deterministic alarms never enter UNDETERMINED " " dimensions. The deterministic alarms never enter UNDETERMINED "
"state.\n" "state.\n"
" Use them for metrics that are received sporadically.\n" " Use them for metrics that are received sporadically.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
"Setiap definisi alarm didefinisikan oleh ekspresinya yang terdiri dari:\n" "Setiap definisi alarm didefinisikan oleh ekspresinya yang terdiri dari:\n"

View File

@ -32,14 +32,17 @@ msgstr ""
msgid "" msgid ""
"\n" "\n"
" Each alarm definition is defined by its expression composed out of:\n" " Each alarm definition is defined by its expression composed out of:\n"
" mathematical function, metric, threshold and comparator for " " mathematical function, metric, time, times ,threshold and comparator for \n"
"metric's\n" " metric's value and the threshold. Time is the number of seconds for the measurement \n"
" value and the threshold. Additionally it is possible to narrow\n" " to be done. They can only be in a multiple of 60. Times is how many times in a row \n"
" that expression must be true before triggering the alarm. Both time and times are
" optional and default to 60 and 1 respectively. Additionally it is possible to narrow\n"
" evaluation of the alarm to certain entities by choosing their\n" " evaluation of the alarm to certain entities by choosing their\n"
" dimensions. The deterministic alarms never enter UNDETERMINED " " dimensions. The deterministic alarms never enter UNDETERMINED "
"state.\n" "state.\n"
" Use them for metrics that are received sporadically.\n" " Use them for metrics that are received sporadically.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" アラーム定義は数学関数、メトリック、閾値、比較演算子によって定義され" " アラーム定義は数学関数、メトリック、閾値、比較演算子によって定義され"

View File

@ -28,9 +28,11 @@ msgstr ""
msgid "" msgid ""
"\n" "\n"
" Each alarm definition is defined by its expression composed out of:\n" " Each alarm definition is defined by its expression composed out of:\n"
" mathematical function, metric, threshold and comparator for " " mathematical function, metric, time, times ,threshold and comparator for \n"
"metric's\n" " metric's value and the threshold. Time is the number of seconds for the measurement \n"
" value and the threshold. Additionally it is possible to narrow\n" " to be done. They can only be in a multiple of 60. Times is how many times in a row \n"
" that expression must be true before triggering the alarm. Both time and times are
" optional and default to 60 and 1 respectively. Additionally it is possible to narrow\n"
" evaluation of the alarm to certain entities by choosing their\n" " evaluation of the alarm to certain entities by choosing their\n"
" dimensions. The deterministic alarms never enter UNDETERMINED " " dimensions. The deterministic alarms never enter UNDETERMINED "
"state.\n" "state.\n"

View File

@ -18,6 +18,7 @@ angular
.module('monitoring.services', []) .module('monitoring.services', [])
.factory('monExpressionBuilder', expressionBuilder); .factory('monExpressionBuilder', expressionBuilder);
function expressionBuilder() { function expressionBuilder() {
return { return {
@ -28,7 +29,6 @@ function expressionBuilder() {
function subExpressionToString(subExpressions, withOp) { function subExpressionToString(subExpressions, withOp) {
var tmp = [], var tmp = [],
exprAsStr; exprAsStr;
angular.forEach(subExpressions, function(expr) { angular.forEach(subExpressions, function(expr) {
exprAsStr = [ exprAsStr = [
withOp ? renderOp(expr) : '', withOp ? renderOp(expr) : '',
@ -36,9 +36,13 @@ function expressionBuilder() {
expr.fun && '(', expr.fun && '(',
expr.metric ? expr.metric.name : '', renderDimensions(expr), expr.metric ? expr.metric.name : '', renderDimensions(expr),
(expr.deterministic ? ',deterministic': ''), (expr.deterministic ? ',deterministic': ''),
expr.time && ',',
expr.time || ',60',
expr.fun && ')', expr.fun && ')',
expr.cmp || '', expr.cmp || '',
expr.threshold === 0 ? 0 : expr.threshold || '' expr.threshold === 0 ? 0 : expr.threshold || '',
expr.times && ' times ',
expr.times || ' times 1',
].join(''); ].join('');
tmp.push(exprAsStr); tmp.push(exprAsStr);
}); });

View File

@ -3,7 +3,6 @@
</div> </div>
<form name="subExpressionForm" ng-if="!vm.preview" novalidate> <form name="subExpressionForm" ng-if="!vm.preview" novalidate>
<div class="row expression-details" ng-if="vm.connectable"> <div class="row expression-details" ng-if="vm.connectable">
<div class="col-md-2 col-xs-6"> <div class="col-md-2 col-xs-6">
<label class="control-label" for="expressionOperator"> <label class="control-label" for="expressionOperator">
@ -98,8 +97,45 @@
ng-class="{'has-error': subExpressionForm.threshold.$invalid && !subExpressionForm.$pristine}" ng-class="{'has-error': subExpressionForm.threshold.$invalid && !subExpressionForm.$pristine}"
aria-describedby="helpBlock"/> aria-describedby="helpBlock"/>
</div> </div>
<div class="col-md-2 col-xs-6">
<label class="control-label" for="expressionFunction">
<span class="field-label">{{ 'Time'|translate }}</span>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input id="expressionTime"
name="expressionTime"
type="number"
step="any"
class="form-control input-sm"
aria-label="{$ 'Time'|translate $}"
title="{$ 'Time'|translate $}"
placeholder="60"
min="60"
ng-change="vm.updateExpression()"
ng-model="vm.model.time"
ng-class="{'has-error': subExpressionForm.time.$invalid && !subExpressionForm.$pristine}"
aria-describedby="helpBlock"/>
</div>
<div class="col-md-2 col-xs-6">
<label class="control-label" for="expressionFunction">
<span class="field-label">{{ 'Times'|translate }}</span>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<input id="expressionTimes"
name="expressionTimes"
type="number"
step="any"
class="form-control input-sm"
aria-label="{$ 'Times'|translate $}"
title="{$ 'Times'|translate $}"
placeholder="1"
min="1"
ng-change="vm.updateExpression()"
ng-model="vm.model.times"
ng-class="{'has-error': subExpressionForm.times.$invalid && !subExpressionForm.$pristine}"
aria-describedby="helpBlock"/>
</div>
</div> </div>
<div class="row expression-details"> <div class="row expression-details">
<div class="col-md-9 col-xs-9"> <div class="col-md-9 col-xs-9">
<tags-input id="dimension-chooser" <tags-input id="dimension-chooser"