简体   繁体   English

如何仅当Prometheus中的PC处于启动状态时才能获得时间平均值

[英]How to get average over time only when PC is up in Prometheus

I'm currently trying to get the average amount of free RAM in the last week on a Windows PC, using the WMI Exporter ( https://github.com/martinlindhe/wmi_exporter ) and Prometheus with the following query : 我目前正在尝试使用WMI导出器( https://github.com/martinlindhe/wmi_exporter )和Prometheus并在Windows PC上获得上周平均可用RAM的平均值,并带有以下查询:

avg_over_time(wmi_os_physical_memory_free_bytes{instance="foo"}[1w])

The query inside "avg_over_time" is working correctly, but the problem is the PC is not up 24/7. “ avg_over_time”内的查询正常运行,但问题是PC没有24/7正常运行。 Since I can't have holes in a range, I was considering the idea of using a recording rules. 由于我无法在某个范围内打洞,因此我正在考虑使用记录规则的想法。

The other problem is that the PC doesn't start and stop at known values, so I can't use the following solution : How to get the average over time only during the day in Prometheus because I can't tell the time of the day I need to start collecting. 另一个问题是PC不会以已知值启动和停止,因此我不能使用以下解决方案: 如何仅在白天在Prometheus中获取一段时间内的平均值,因为我无法告知时间我需要开始收集的一天。

Is there any recording rule that could concatenate all the information gathered only during the up time of the pc ? 是否有任何记录规则可以将仅在计算机正常运行期间收集的所有信息连接起来?

Thanks in advance. 提前致谢。

上面的表达式已经avg_over_time您的要求,因为在无法刮除目标并且avg_over_time不会做任何想做的事情之前,没有任何数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将多个IP地址分配给PC时如何获取默认IP地址 - How to get default IP address when multiple IP addresses are assigned to PC 调用wmi时如何解决缓慢的加载时间(仅处理器) - How to fix slow load time when calling wmi(processor only) 如何使用PHP获得Windows平均负载? - How to get Windows load average with PHP? 如何获取与PC关联的所有windows用户帐户 - How to get all windows user accounts associated with a PC 是否可以获得 PC 的物理 USB 端口数? - Is it possible to get PC's # of physical USB ports? 我如何使用WMI获取PC上所有网卡的MAC地址 - how can i get get the MACaddress of all the NICs on my PC using WMI 在 powershell 中,你如何获得你电脑上安装的所有固件的信息? 名称及其版本 - In powershell, how do you get information on all firmwares installed on your pc? Name and its version 如何在远程PC上监视活动窗口 - How to monitor the active window on a remote PC PC关机时WMI永久事件 - WMI Permanent Event When PC is Shutdown 如何使用 Prometheus wmi_exporter 使用 wmi_process_cpu_time_total 和 wmi_cs_logical_processors 计算每个进程的标准化百分比 CPU - How to calculate normalized %CPU per process using Prometheus wmi_exporter using wmi_process_cpu_time_total and wmi_cs_logical_processors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM