I have the following timeseries entries.
ifDescr{ifDescr="GigabitEthernet1/1",ifIndex="1",instance="x.x.x.x",job="snmp"} 1
ifDescr{ifDescr="GigabitEthernet1/2",ifIndex="2",instance="x.x.x.x",job="snmp"} 1
ifDescr{ifDescr="GigabitEthernet5/3",ifIndex="3",instance="x.x.x.x",job="snmp"}
ifHCInOctets{ifIndex="1",instance="x.x.x.x",job="snmp"}
ifHCInOctets{ifIndex="2",instance="x.x.x.x",job="snmp"}
ifHCInOctets{ifIndex="2",instance="x.x.x.x",job="snmp"}
As is, I have no way of telling which index matches which description, which makes things confusing.
Is there a way to basically to do a join of the above labels using ifIndex
to correlate to the the ifDesc label? Or maybe the job can be used to tie the two timeseries together?
I have looked at the group_left
feature but haven't been able to figure out how to get it working to combine/aggregate labels.
In this case you want something like rate(ifHCInOctets[5m]) * ignoring(ifDescr) group_left(ifDescr) ifDescr
explanation:
Prometheus will only let you use grouping on operations between series. The value of ifDescr
is always "1" so it's safe to multiply.
The ignoring
clause means don't use the ifDescr
label for matching (as it's only on one of the series). ifIndex
, instance
and job
will be used.
group_left
is specifying what labels you want from the series ifDescr
. In this case they have the same names.
<vector expr> <bin-op> ignoring(<label list>) group_left(<label list>) <vector expr>