I'm collecting interface statistics from some switches using the following configuration:
modules:
if_mib:
walk:
- ifTable
auth:
community: monitor
The data returned from the exporter is indexed by ifIndex
. That is, a query for ifInOctets{instance="192.168.1.1"}
results in:
ifInOctets{ifIndex="1",instance="192.168.1.1",job="snmp_if"} 129355
ifInOctets{ifIndex="2",instance="192.168.1.1",job="snmp_if"} 359870890
ifInOctets{ifIndex="3",instance="192.168.1.1",job="snmp_if"} 0
ifInOctets{ifIndex="4",instance="192.168.1.1",job="snmp_if"} 212586200
Etc. I want the interface names for display purposes, which I can get with the following query:
ifInOctets{instance="192.168.1.1"} * ignoring(ifDescr) group_left(ifDescr) ifDescr
Which returns:
{ifDescr="lo",ifIndex="1",instance="192.168.1.1",job="snmp_if"} 129355
{ifDescr="itf0",ifIndex="2",instance="192.168.1.1",job="snmp_if"} 359870890
{ifDescr="imq0",ifIndex="3",instance="192.168.1.1",job="snmp_if"} 0
{ifDescr="eth0",ifIndex="4",instance="192.168.1.1",job="snmp_if"} 2125862004
How can I filter the results by the value of the ifDescr
attribute?
I tried the following, expecting it to fail, and indeed I was not surprised:
ifInOctets{instance="192.168.1.1", ifDescr="eth0"} * ignoring(ifDescr) group_left(ifDescr) ifDescr