Ah, reverse it to:
(ifName * 0) + on(ifIndex,hostname,instance,job) group_left ifOutOctets
However, if you are using the regular prometheus snmp_expporter, you should be aware that configured correctly it will do this step for you, eg, copying directly from my snmp exporters metrics:
# HELP ifOutOctets The total number of octets transmitted out of the interface, including framing characters - 1.3.6.1.2.1.2.2.1.16
# TYPE ifOutOctets counter
ifOutOctets{ifAlias="",ifDescr="apcli0",ifIndex="16",ifName="apcli0"} 0
ifOutOctets{ifAlias="",ifDescr="apclii0",ifIndex="28",ifName="apclii0"} 0
ifOutOctets{ifAlias="",ifDescr="br0",ifIndex="29",ifName="br0"} 2.7732281e+07
ifOutOctets{ifAlias="",ifDescr="eth0",ifIndex="2",ifName="eth0"} 2.76292118e+08
ifOutOctets{ifAlias="",ifDescr="lo",ifIndex="1",ifName="lo"} 1.930652e+06
ifOutOctets{ifAlias="",ifDescr="ra0",ifIndex="4",ifName="ra0"} 5.37888286e+08
ifOutOctets{ifAlias="",ifDescr="ra1",ifIndex="5",ifName="ra1"} 0
You may have to regenerate the configuration for it to do that though:
https://github.com/prometheus/snmp_exporter/blob/main/README.md#generating-configuration
It's been a couple of years since I did the setup now and I don't remember the details.
- Regards, Rob.