On 18/03/2021 12:27, John Dexter wrote:
I have metrics provided by several processes:

subsystem_connected{subsystem="ABC"}

This has a value of 0 or 1, and each process has a different subsystem label. Within Grafana, I want to do a couple of things:

- Display a count how many are connected (value=1)
- Display the list of subsystem values where value=1

I keep thinking I've got it with functions like count_value, etc, but end up just displaying the number of labels regardless of metric value.
Can anyone help me with sample PromQL queries?

For the first you'd want to use "sum", which would add up the values. As they are either 0 or 1, that would give you the total number of time series which have a value of 1, meaning the number connected.

For the second you just want to do a simple "metric = 1" query which will return all time series which have the value of 1. You can then format that within Grafana as a table for example with the subsystem label.

--
Stuart Clark

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/f8930f69-61ef-e3ab-4b99-080e1370aff1%40Jahingo.com.

Reply via email to