在grafana仪表板上的Prometheus中动态更改指标名称 [英] Dynamically change the metric name in prometheus in grafana dashboard

查看:244
本文介绍了在grafana仪表板上的Prometheus中动态更改指标名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用prometheus和grafana监视neo4j数据库集群.我想基于DBNAME作为变量创建一个动态仪表板.以下是我用来填充面板的查询.这里graph_db是DBName,并且只有多个数据库才会更改.有没有一种方法可以使用变量动态更改指标名称.

I'm using prometheus and grafana to monitor the neo4j database cluster.I wanted to create a dynamic dashboard based on the DBNAME as a variable. Below is the query I'm using to populate a panel. Here the graph_db is the DBName and only this changes for multiple databases. Is there a way to change the metric name dynamically using variable.

neo4j_graph_db_transaction_last_closed_tx_id_total {job ='$ job',instance =〜"$ neo4j_instance"} ->对于graph_db neo4j_system_transaction_last_closed_tx_id_total {job ='$ job',instance =〜"$ neo4j_instance"} ->对于系统

neo4j_graph_db_transaction_last_closed_tx_id_total{job='$job', instance=~"$neo4j_instance"} --> For graph_db neo4j_system_transaction_last_closed_tx_id_total{job='$job', instance=~"$neo4j_instance"} --> For system

推荐答案

我在grafana中找到了解决方案,我们可以替换变量,并以此来解决问题.我正在使用Grafana的最新稳定版本,它对我有用.

I have found the solution in grafana we can subsitute the variables and use like this to solve the problem. I'm using the latest stable version of Grafana and it worked for me.

neo4j _ $ {var} _transaction_last_closed_tx_id_total {job ='$ job',instance =〜"$ neo4j_instance"}

neo4j_${var}_transaction_last_closed_tx_id_total{job='$job', instance=~"$neo4j_instance"}

这篇关于在grafana仪表板上的Prometheus中动态更改指标名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆