1.在grafana中创建的一个表,表中有多个指标,而有些指标的标签是不一样的,比如有的是以node分组的,而一些标签中没有node,但是具体值一样的,标签名为instance,所以这里就需要将instance替换为node,否则分组不同是不能显示在一张表上的,使用label_replace(原本的promql,"node", "$1", "instance", "(.*)")进行替换
#内存利用率由 sum (container_memory_working_set_bytes{origin_prometheus=~"$origin_prometheus",id="/"})by (instance) / sum (machine_memory_bytes{origin_prometheus=~"$origin_prometheus"})by (instance) 改为 label_replace(sum (container_memory_working_set_bytes{origin_prometheus=~"$origin_prometheus",id="/"})by (instance) / sum (machine_memory_bytes{origin_prometheus=~"$origin_prometheus"})by (instance),"node", "$1", "instance", "(.*)") #CPU利用率由 sum (rate (container_cpu_usage_seconds_total{origin_prometheus=~"$origin_prometheus",id="/"}[2m]))by (instance) / sum (machine_cpu_cores{origin_prometheus=~"$origin_prometheus"})by (instance) 改为 label_replace(sum (rate (container_cpu_usage_seconds_total{origin_prometheus=~"$origin_prometheus",id="/"}[2m]))by (instance) / sum (machine_cpu_cores{origin_prometheus=~"$origin_prometheus"})by (instance),"node", "$1", "instance", "(.*)")
标签:origin,node,sum,grafana,图表,instance,prometheus,制作,id From: https://www.cnblogs.com/xiaoxiaomuyuyu/p/18228891