小编npa*_*ath的帖子

如何使用 prometheus 和 node_exporter 获得服务器的整体正常运行时间

我正在寻找一个查询来获取上周运行 prometheus 的服务器的平均正常运行时间。它应该是大约 15 小时/周,所以大约 8-10%。

我在 CentOS 7.6.1810 上使用 Prometheus 2.5.0 和 node_exporter。我最有希望的实验是:

1 - avg_over_time(up{job="prometheus"}[7d])

这是我在寻找获得平均正常运行时间的方法时发现的,但它给了我正好 1。(我猜它忽略了没有发生擦伤的时间?)

2 - sum_over_time(up{job="prometheus"}[7d]) * 15 / 604800

这在技术上有效,但取决于刮擦间隔,在我的情况下为 15 秒。我似乎无法找到从 prometheus 的配置中获取所述间隔的方法,因此我必须将其硬编码到查询中。

我还试图找到获取工作的所有开始和结束时间的方法,但到目前为止无济于事。

prometheus prometheus-node-exporter

3
推荐指数
1
解决办法
7395
查看次数