【问题标题】:Grafana dashboard Variables: how to extract a label value when the metric equal to a valueGrafana仪表板变量:当指标等于一个值时如何提取标签值
【发布时间】:2021-04-25 12:50:42
【问题描述】:

我有一个名为 nodejs_microservice_health_status 的指标来监控微服务的健康状况。

我想创建一个变量failedmicroservice,当nodejs_microservice_health_status 等于0 时,它会提取指标的service 标签的值。

PromQL 查询nodejs_microservice_health_status == bool 0 返回的所有项目都等于0,但是当我尝试将变量的查询设置为label_values({nodejs_microservice_health_status == bool 0}, service) 时,

我收到以下错误:

有人知道怎么做吗?

【问题讨论】:

    标签: prometheus grafana promql grafana-templating grafana-variable


    【解决方案1】:

    使用以下值,

    查询:

    query_result(nodejs_microservice_health_status==0)
    

    正则表达式:

    /.*service=\"([^\"]+)\".*/
    

    【讨论】:

      猜你喜欢
      • 2021-06-11
      • 2020-09-05
      • 1970-01-01
      • 1970-01-01
      • 2020-10-02
      • 2021-09-02
      • 1970-01-01
      • 1970-01-01
      • 2020-12-01
      相关资源
      最近更新 更多