'up{}' 语法是什么意思?
what does the 'up{}' syntax mean?
我一直在研究一些普罗米修斯模板,每当我查看其他模板示例时,我都会遇到这个命令:
$jobs = label_values(job)
$instance = up{job=~"$jobs"}
我知道 $jobs 是一个正在创建的变量,但我几乎不知道 up 命令在做什么。我在网上看过,但我无法真正缩小搜索范围以找到像 'up' 哈哈
这样的通用词
我最好的猜测是它使 $instance
变量仅等于工作与工作相似的情况?我真的不确定
任何帮助都会澄清一大堆。谢谢!
根据 Jobs and instances Prometheus 文档:
When Prometheus scrapes a target, it attaches some labels
automatically to the scraped time series which serve to identify the
scraped target:
job: The configured job name that the target belongs to.
instance: The <host>:<port> part of the target's URL that was scraped.
If either of these labels are already present in the scraped data, the
behavior depends on the honor_labels
configuration option.
For each instance scrape, Prometheus stores a sample in the following
time series:
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
The up
time series is useful for instance availability monitoring.
我一直在研究一些普罗米修斯模板,每当我查看其他模板示例时,我都会遇到这个命令:
$jobs = label_values(job)
$instance = up{job=~"$jobs"}
我知道 $jobs 是一个正在创建的变量,但我几乎不知道 up 命令在做什么。我在网上看过,但我无法真正缩小搜索范围以找到像 'up' 哈哈
这样的通用词我最好的猜测是它使 $instance
变量仅等于工作与工作相似的情况?我真的不确定
任何帮助都会澄清一大堆。谢谢!
根据 Jobs and instances Prometheus 文档:
When Prometheus scrapes a target, it attaches some labels automatically to the scraped time series which serve to identify the scraped target:
job: The configured job name that the target belongs to. instance: The <host>:<port> part of the target's URL that was scraped.
If either of these labels are already present in the scraped data, the behavior depends on the
honor_labels
configuration option.For each instance scrape, Prometheus stores a sample in the following time series:
up{job="<job-name>", instance="<instance-id>"}: 1 if the instance is healthy, i.e. reachable, or 0 if the scrape failed.
The
up
time series is useful for instance availability monitoring.