Grafana -Needs to add filter in the query to display only running and stopped Service status on the windows

Good Day ,I am using Grafana and Prometheus agent on the windows server

Objective -

  • Grafana Dashboard should display service status which include Running, Stopped in the dashboard

Below Data used

  • Template used - 14451

  • Service Status query

sum(windows_service_state{job=~“$job”,instance=~“$instance”}) by (state)

Outcome attached picture:

However ,I needs only running and stopped status dashboard. Can you help what should i change in the query to get rid off all pending status.

Hi @sravanesr,

Welcome to the :grafana: community support forums !!

So basically you want to hide all the additional legends showing from your query on the right side, is it correct?

If this is correct, the next question will be does all these values are coming from a single prometheus query ?

Hi @sravanesr!

In transformations tab, you have the ‘Filter by name’. This should let you hide and unhide the legends in your panel. As you can see in this snapshot, we were able to do so with the ‘UDP_inuse’.

Tell us if it helps you.

1 Like

Hi Usmahmad -Thanks for coming back to me.

Basically. ,except running and stopped status ,remaining all i need to disable it.

Can you let me know how to do this query?


Perfect eledobleefe .it worked :slight_smile:

Spent 2 days on debugging this issue and now resolved:-)