[英]Make table visualization in Grafana using Prometheus's InfoMetricFamily
I have following code:我有以下代码:
c = InfoMetricFamily("health", "Health Monitoring")
c.add_metric(labels=name, value={"name": name, "status": status, "value": value})
that supply Prometheus with following metric:为 Prometheus 提供以下指标:
# HELP health_info Health Monitoring
# TYPE health_info gauge
health_info{name="external",status="danger",value="N\\A"} 1.0
I would like to build table dashboard in Grafana where name
, status
, value
will be columns.我想在 Grafana 中构建表仪表板,其中name
、 status
、 value
将是列。 How could I do this?我怎么能这样做?
Since Grafana v4.3 , the table panel supports the display of Prometheus labels.从 Grafana v4.3 开始,表格面板支持 Prometheus 标签的显示。
To create the display, add a table panel in your dashboard:要创建显示,请在仪表板中添加一个表格面板:
Query
tab在Query
选项卡中
Instant
to True and set Format
to Table
;将Instant
切换为 True 并将Format
设置为Table
; if you start by filling the query you may have a BIG response freezing your window如果您从填写查询开始,您可能会收到一个很大的响应,冻结您的windowMetrics
: in your case health_info
在Metrics
中写下您的查询:在您的情况下health_info
Time
column (unless you need it, personally I rarely do)删除Time
列(除非你需要它,我个人很少这样做)/.*/
to Type Hidden
;将包罗万象的规则/.*/
设置为 Type Hidden
; it will hide all your columns它会隐藏你所有的列Add column style
to hide a column to display by typing then name in Apply to columns named
(the completion works well)使用Add column style
隐藏要显示的列,方法是在Apply to columns named
中键入 then name(完成效果很好)Column Header
and tune the display您可以调整Column Header
并调整显示NOTE: currently, you cannot modify the order of the columns.注意:目前,您无法修改列的顺序。
If you want to display multiple metrics on the same lines note that:如果您想在同一行显示多个指标,请注意:
__name__
label指标的名称是 label:您还需要摆脱__name__
labelValue #A
and the display needs to be adjusted添加第二个值时,第一个值的列名变为Value #A
,需要调整显示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.