From cf8c6699ad8c650a4e4420bfb53f9c5d288f384e Mon Sep 17 00:00:00 2001 From: Christoph Alt <typ@ohnebild.com> Date: Thu, 13 Oct 2022 17:35:27 +0200 Subject: [PATCH] added thresholds for stat panels --- dashboards/dashboard_base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dashboards/dashboard_base.py b/dashboards/dashboard_base.py index c22dc0d..887e8da 100644 --- a/dashboards/dashboard_base.py +++ b/dashboards/dashboard_base.py @@ -3,7 +3,7 @@ from typing import List, Union from grafanalib.core import (Annotations, Dashboard, GridPos, Panel, Repeat, RowPanel, Stat, Template, Templating, Time, - TimeSeries) + TimeSeries, Threshold) from grafanalib.influxdb import InfluxDBTarget from dashboards.annotations import Annotation @@ -137,5 +137,7 @@ def get_stat_panel(title: str, title=title, dataSource=dataSource, targets=[get_influx_target(str(stat_query), alias=alias)], - **new_kwargs, + thresholdType='percentage', + thresholds=[Threshold('green', 0, 0.0), Threshold('yellow', 1, 50.0), Threshold('red', 2, 80.0)], + ** new_kwargs, ) -- GitLab