【问题标题】:what does the 'up{}' syntax mean?'up{}' 语法是什么意思?
【发布时间】:2019-02-05 16:03:07
【问题描述】:

我一直在研究一些普罗米修斯模板,每当我查看其他模板示例时,我都会遇到这个命令:

$jobs = label_values(job)

$instance = up{job=~"$jobs"}

我知道 $jobs 是一个正在创建的变量,但我几乎不知道 up 命令在做什么。我在网上查看过,我无法真正缩小搜索范围,找到像“up”这样的通用词哈哈

我最好的猜测是它使$instance 变量仅等于工作与工作相似的情况?我真的不确定

任何帮助都会澄清一堆。谢谢!

【问题讨论】:

    标签: syntax prometheus grafana-templating


    【解决方案1】:

    根据Jobs and instances Prometheus 文档:

    当 Prometheus 抓取目标时,它会附加一些标签 自动到用于识别 抓取目标:

    job: The configured job name that the target belongs to.
    instance: The <host>:<port> part of the target's URL that was scraped.
    

    如果这些标签中的任何一个已经存在于抓取的数据中,则 行为取决于honor_labels 配置选项。

    对于每个实例抓取,Prometheus 将样本存储在以下位置 时间序列:

    up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed. 
    

    up 时间序列对于实例可用性监控很有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      • 2018-05-12
      • 2014-04-21
      • 2021-03-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      相关资源
      最近更新 更多