【发布时间】:2017-08-11 12:46:32
【问题描述】:
使用 Prometheus 黑盒导出器,我想知道如何检索指标或值的“年龄”,也就是“受监控的服务运行了多长时间?”。我知道我可以通过编写自己的导出器来解决这个问题,该导出器带有相关时间戳的计量指标,但我想知道我是否可以以某种方式使用现有函数?
我的设置....Prometheus 抓取配置:
scrape_configs:
- job_name: 'blackbox'
scrape_interval: 120s
scrape_timeout: 10s
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://example.org
相关值可以通过up{job="blackbox"}查询,弹出:
Element Value
up{instance="https://example.org/",job="blackbox"} 1
我想做的事:
time()-last_change(up{instance="https://example.org/",job="blackbox"})
有什么建议吗?
【问题讨论】:
标签: prometheus