Combine two prometheus query

115 views
Skip to first unread message

s.saurab...@gmail.com

unread,
Mar 15, 2021, 7:38:07 AM3/15/21
to Prometheus Users

Hello,

I have a certain requirement to implement in Grafana where we need to show interface utilization for switch.

I got combination of two queries in order to achieve it

1) ifOutOctets{hostname="XX",ifIndex="103",instance="XX",job="SNMP"}

2) ifName{hostname="XX",ifIndex="103",ifName="Te1/0/1",instance="XX",job="SNMP"}

First query -- It gives interface utilization on specific index

Second query --- It gives interface name mapped to specific index

Now How can I combine both these query in a way that I get interface utilization on interface name not on index.

Pls advice.

Thanks,
Saurabh

Joe Pauly

unread,
Mar 15, 2021, 8:18:39 AM3/15/21
to s.saurab...@gmail.com, Prometheus Users
Put these queries into Query A and Query B

First Do an
outerjoin based on index
then
organize fields to hide index

image.png

In the above example i have done an outerjoin on container then has did organize fields i have hidden the namespace and time values.

Hope this is what you are looking for.


--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/2493f056-332b-402b-bc69-8234c6176148n%40googlegroups.com.


--
Joe Pauly


Saurabh Jain

unread,
Mar 15, 2021, 12:14:38 PM3/15/21
to Joe Pauly, Prometheus Users
Hi Joe,

Thanks for the response.

However Index field not coming during outer Join process. Pls have a look at the below screenshots and advice.

image.png

image.png



image.png

Joe Pauly

unread,
Mar 15, 2021, 1:20:03 PM3/15/21
to Saurabh Jain, Prometheus Users
Can we make it table instead of time series and make it instant turned on.

Then again try outerjoin

Saurabh Jain

unread,
Mar 15, 2021, 11:52:16 PM3/15/21
to Joe Pauly, Prometheus Users
I tried but still not working.

image.png
image.png
image.png

Reply all
Reply to author
Forward
0 new messages