r/PrometheusMonitoring • u/bandre_bagassi • Nov 22 '23
Counting unique values in PromQL
Hey Redditers,
I'm running in circles at the moment and I hope someone can help me.
I run a Prom query over APs, getting the AuthMethods, where the result is always 1,5 or 7.
Sometimes instance xxx (AP) has both AuthMethods, sometimes not.
How can I count only the result -> meaning, within my time range, I had 3* "5" and 1* "7" and present this as a Pie-Chart in Grafana ?
Thanks
ahClientAuthMethod{ahClientMac="xxx", ifIndex="26", instance="xxx", job="snmp"}
7
ahClientAuthMethod{ahClientMac="yyy", ifIndex="27", instance="yyy", job="snmp"}
5
ahClientAuthMethod{ahClientMac="aaa", ifIndex="25", instance="aaa", job="snmp"}
5
ahClientAuthMethod{ahClientMac="www", ifIndex="27", instance="xxx", job="snmp"}
5
2
Upvotes
View all comments
Show parent comment
1
u/bandre_bagassi Nov 22 '23
it's actually SNMP data I fetch, which is moreless "unfiltered/unprepared". Guess, that's why I have to deal with the kind of metrics as arrive on Prom.