Merge branch 'feature-text_metrics' into grafana-3.0
Conflicts: zabbix/partials/query.editor.html
This commit is contained in:
@@ -225,7 +225,22 @@ function (angular, _, dateMath) {
|
|||||||
return {
|
return {
|
||||||
target: target.item.name,
|
target: target.item.name,
|
||||||
datapoints: _.map(history, function (p) {
|
datapoints: _.map(history, function (p) {
|
||||||
return [p.value, p.clock * 1000];
|
var value = p.value;
|
||||||
|
if (target.textFilter) {
|
||||||
|
var text_extract_pattern = new RegExp(templateSrv.replace(target.textFilter, options.scopedVars));
|
||||||
|
//var text_extract_pattern = new RegExp(target.textFilter);
|
||||||
|
var result = text_extract_pattern.exec(value);
|
||||||
|
if (result) {
|
||||||
|
if (target.useCaptureGroups) {
|
||||||
|
value = result[1];
|
||||||
|
} else {
|
||||||
|
value = result[0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
value = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [value, p.clock * 1000];
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
<ul class="tight-form-list" role="menu" ng-hide="target.mode == 1">
|
<ul class="tight-form-list" role="menu" ng-hide="target.mode == 1">
|
||||||
<!-- Alias -->
|
<!-- Alias -->
|
||||||
<li>
|
<li ng-hide="target.mode == 2">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="tight-form-input input-medium"
|
class="tight-form-input input-medium"
|
||||||
ng-model="target.alias"
|
ng-model="target.alias"
|
||||||
@@ -154,11 +154,7 @@
|
|||||||
|
|
||||||
<div class="tight-form" ng-hide="target.mode == 1">
|
<div class="tight-form" ng-hide="target.mode == 1">
|
||||||
<ul class="tight-form-list" role="menu">
|
<ul class="tight-form-list" role="menu">
|
||||||
<li class="tight-form-item" style="min-width: 15px; text-align: center"> </li>
|
<li class="tight-form-item" style="width: 44px"> </li>
|
||||||
<li class="tight-form-item">
|
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
<li class="tight-form-item" style="width: 135px"> </li>
|
|
||||||
|
|
||||||
<!-- Select Application -->
|
<!-- Select Application -->
|
||||||
<li class="tight-form-item input-small" style="width: 5em">Application</li>
|
<li class="tight-form-item input-small" style="width: 5em">Application</li>
|
||||||
@@ -224,4 +220,31 @@
|
|||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tight-form" ng-hide="target.mode == 1">
|
||||||
|
<ul class="tight-form-list" role="menu">
|
||||||
|
<li class="tight-form-item" style="width: 44px"> </li>
|
||||||
|
<!-- Text metric regex -->
|
||||||
|
<li class="tight-form-item" ng-show="target.mode == 2">
|
||||||
|
Text filter
|
||||||
|
</li>
|
||||||
|
<li ng-show="target.mode == 2">
|
||||||
|
<input type="text"
|
||||||
|
class="tight-form-input input-large" style="width: 20em"
|
||||||
|
ng-model="target.textFilter"
|
||||||
|
spellcheck='false'
|
||||||
|
placeholder="Text filter (regex)"
|
||||||
|
ng-blur="targetBlur()">
|
||||||
|
</li>
|
||||||
|
<li class="tight-form-item" ng-show="target.mode == 2">
|
||||||
|
Use capture groups
|
||||||
|
<input class="cr1" id="target.useCaptureGroups" type="checkbox"
|
||||||
|
ng-model="target.useCaptureGroups"
|
||||||
|
ng-checked="target.useCaptureGroups"
|
||||||
|
ng-change="targetBlur()">
|
||||||
|
<label for="target.useCaptureGroups" class="cr1"></label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,11 @@
|
|||||||
IT service property
|
IT service property
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="tight-form-item">
|
||||||
|
<a ng-click="toggleEditorHelp(4)" bs-tooltip="'click to show helpful info'" data-placement="bottom">
|
||||||
|
Text filter
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,5 +85,12 @@
|
|||||||
<li>Down time - time the service was in scheduled downtime, in seconds</li>
|
<li>Down time - time the service was in scheduled downtime, in seconds</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="grafana-info-box span8" ng-if="editorHelpIndex === 4">
|
||||||
|
<h5>Text filter</h5>
|
||||||
|
<ul>
|
||||||
|
<li>Use regex to extract a part of the returned value.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user