Use field as value, remove field, then merge

Hi,

I’m looking to merge some SNMP interface metrics. Most metrics use the same fields, but not all. For example, the interface type metric returns its value in a field.

ifHCInOctets{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge"} 4.02571046513016e+14
ifAdminStatus{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge"} 1
ifType_info{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge",ifType="bridge"} 1

The first two metrics may be merged, but the third one may not, due to the added ifType field.

Would it be possible to somehow use the ifType field as the value for that metric, and then remove the field, that it may be merged with the others?

I would like to avoid the join transformation if at all possible.

you can accomplish a lot with Grafana’s transformations, even without using the join. If you’re still blocked on this the community might want to know what your data looks like now and how you want it to look like transformed:

Hi,

Indeed, I have yet to solve this. So, the data looks as in my first post. Theoretically I would like it to look like so:

ifHCInOctets{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge"} 4.02571046513016e+14
ifAdminStatus{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge"} 1
ifType_info{ifAlias="",ifDescr="bridge",ifIndex="26",ifName="bridge"} "bridge"

That way I can merge all metrics.

My ultimate goal is to display for all interfaces their metrics in a table. Using the merge transformation gets me most of the way, with the notable exception of ifType with its additional label.

A different interface is a more clear example due to the interface type not matching the interface name.

ifHCInOctets{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1"} 4.02571046513016e+14
ifAdminStatus{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1"} 1
ifType_info{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1",ifType="ethernetCsmacd"} 1

To be transformed into:

ifHCInOctets{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1"} 4.02571046513016e+14
ifAdminStatus{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1"} 1
ifType_info{ifAlias="",ifDescr="ether1",ifIndex="3",ifName="ether1"} "ethernetCsmacd"