Windows Exporter User with Alloy - How to get specific processes current count

  • What Grafana version and what operating system are you using?
    Grafana Cloud Platform

  • What are you trying to achieve?
    Trying to have a Gauge panel. That shows the process count for 2 specific processes running on an instance.

  • How are you trying to achieve it?

  • What happened?
    I see the processes gauge but, when i login to the instance, The count is not accurate, as its not current or live, it never seems to match what is happening on the instance “now”.

  • What did you expect to happen?
    The expected result should show the current count of running processes on the instance.

  • Can you copy/paste the configuration(s) that you are having problems with?
    count by(process) (irate(windows_process_cpu_time_total{instance=~“$instance”, process=~“powershell|GSAWE”}[2m]))

Set to a Time Series Instant or Range gives different results but still not accurate. I’m assuming the query I am using is not quite right, I am not sure on how best to achieve the requirement. Any advice is appreicated.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • No errors.

  • Did you follow any online instructions? If so, what is the URL? Nothing specific related to my query comes up.