mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): add functionallity for converting tresholds to alerts
This commit is contained in:
parent
f167ce19ab
commit
8ca7ccae38
@ -103,6 +103,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
|||||||
aliasColors: {},
|
aliasColors: {},
|
||||||
// other style overrides
|
// other style overrides
|
||||||
seriesOverrides: [],
|
seriesOverrides: [],
|
||||||
|
alerting: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
@ -310,6 +311,16 @@ class GraphCtrl extends MetricsPanelCtrl {
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertThresholdsToAlerts() {
|
||||||
|
if (this.panel.grid && this.panel.grid.thresholds1) {
|
||||||
|
this.panel.alerting.warn_level = '< ' + this.panel.grid.threshold1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.panel.grid && this.panel.grid.thresholds2) {
|
||||||
|
this.panel.alerting.crit_level = '< ' + this.panel.grid.threshold2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
legendValuesOptionChanged() {
|
legendValuesOptionChanged() {
|
||||||
var legend = this.panel.legend;
|
var legend = this.panel.legend;
|
||||||
legend.values = legend.min || legend.max || legend.avg || legend.current || legend.total;
|
legend.values = legend.min || legend.max || legend.avg || legend.current || legend.total;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5 class="section-heading">Thresholds</h5>
|
<h5 class="section-heading">Thresholds</h5>
|
||||||
|
<p ng-show="ctrl.panel.grid.threshold1 || ctrl.panel.grid.threshold2">We noticed you have existing threshholds.<a href="#" ng-click="ctrl.convertThresholdsToAlert()">Convert them</a></p>
|
||||||
<div class="gf-form">
|
<div class="gf-form">
|
||||||
<span class="gf-form-label width-7">Warn level</span>
|
<span class="gf-form-label width-7">Warn level</span>
|
||||||
<input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.warn_level"></input>
|
<input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.warn_level"></input>
|
||||||
|
Loading…
Reference in New Issue
Block a user