syntax - 'up{}' 语法是什么意思?
问题描述
我一直在研究一些普罗米修斯模板,每当我查看其他模板示例时,我都会遇到这个命令:
$jobs = label_values(job)
$instance = up{job=~"$jobs"}
我知道 $jobs 是一个正在创建的变量,但我几乎不知道 up 命令在做什么。我在网上查看过,我真的无法将搜索范围缩小到足以找到像“up”这样的通用词哈哈
我最好的猜测是它使$instance
变量仅等于工作与工作相似的情况?我真的不确定
任何帮助都会澄清一堆。谢谢!
解决方案
根据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
时间序列对于实例可用性监控很有用。
推荐阅读
- python - ANTLR Python解析器错误
- javascript - Javascript一次打印输出一个而不是一次打印整个页面?
- mysql - 如何在 MySQL 中使用 Levenshtein 函数查找标题相似的文章
- javascript - Javascript 以或包含开头
- sas - PROC SQL“SELECT INTO”不创建宏变量
- php - laravel 4.2 laravel-dompdf 无法将变量传递给模板
- python - “张量”这个名称是指一个不存在的张量。图中不存在“张量”操作
- objective-c - 未调用 FirebaseStorage 完成块。Objective-C
- java - 如何在 Google Analytics 中查看/删除任何特定用户数据
- docker - Docker Compose 从 git 存储库构建上下文,文件夹内包含 Dockerfile