Panel should display colored bars for window_service_state states

Re-reading your initial post, I think you’ll want to drop the instance variable altogether, and do something like so:

Set the name label match to your target service, and set the format to Table. Do not include state=“running”, as you want to get all states:

Add a transformation to group the results by instance:

Add value mappings to colourize the results. Here I chose running=green and any other state=red, and renamed them to up/down:

This will give you a result that looks like so, with one row per instance (I only have one Windows instance in this prometheus instance):

However, state timeline connects missing values by default, so if an instance was offline for a period of time (as mine was between 1100h-1135h), it’s not going to reflect that properly. Easily fixed by setting a disconnect threshold appropriate to your scrape interval:

Which makes the final product looks like:

2 Likes