【问题标题】:Prometheus query - exclude destinationPrometheus 查询 - 排除目的地
【发布时间】:2017-03-09 17:23:49
【问题描述】:

在我的 ActiveMQ 上,我有一些以 .error 结尾的队列。在 Grafana 仪表板上,我想列出所有没有这些 .error-queues 的队列。 示例:

some.domain.one
some.domain.one.error
some.domain.two
some.domain.two.error

要列出所有队列,我使用此查询:

org_apache_activemq_localhost_QueueSize{Type="Queue",Destination=~"some.domain.*",}

如何排除所有 .error-queues?

【问题讨论】:

    标签: grafana prometheus


    【解决方案1】:

    您可以使用负正则表达式匹配器:org_apache_activemq_localhost_QueueSize{Type="Queue",Destination=~"some.domain.*",Destination!~".*\.error"}

    【讨论】:

    • 酷,谢谢。我不知道我可以更频繁地指定目的地。这对我有用:org_apache_activemq_localhost_ConsumerCount{Type="Queue",Destination=~"some.domain.*",Destination!~".*error"}
    【解决方案2】:

    Thers 是一种更简单的排除多个结尾的方法:

    org_apache_activemq_localhost_QueueSize{Type="Queue",Destination!~".*error|.*warn"}
    

    !~:不包括引用字符串
    |:是or

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-03
      相关资源
      最近更新 更多