Edited: I checked again and starlark did work, it is the gnmi input that automatically saves my data to separate series that make it impossible to correlate values and tags later.
There’s a thread here where user could get data out in single series and that would be perfect for startlark inputs.gnmi: Difference in metrics from input to output · Issue #9117 · influxdata/telegraf · GitHub
I am using Telegraf to get streaming telemetry from Arista switches:
Here is the output from a gnmi call via a client:
[
{
"time": "1970-01-01T07:30:00+07:30",
"updates": [
{
"Path": "network-instances/network-instance[name=default]/protocols/protocol[identifier=BGP][name=BGP]/bgp/neighbors/neighbor[neighbor-address=*****]/state",
"values": {
"network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state": {
"openconfig-network-instance:description": "******",
"openconfig-network-instance:dynamically-configured": false,
"openconfig-network-instance:enabled": true,
"openconfig-network-instance:established-transitions": "3",
"openconfig-network-instance:last-established": "1626783884891099136",
"openconfig-network-instance:messages": {
"received": {
"UPDATE": "2503462"
},
"sent": {
"UPDATE": "1128386"
}
},
"openconfig-network-instance:neighbor-address": "****",
"openconfig-network-instance:peer-as": *****,
"openconfig-network-instance:peer-group": "LEAF",
"openconfig-network-instance:send-community": "NONE",
"openconfig-network-instance:session-state": "ESTABLISHED"
}
}
}
]
}
]
When I check Prometheus TSDB, all fields are in separate series and series with non-numeric values are dropped.
I want to get only 1 or 2 fields into the TSDB and rest of the values (string values for example) can be used as tags.
My question here is: what does the inputs.gnmi.subscription do to my json format above? Did it automatically transform the json into different series? Because I was trying to use Starlark to just print out the content to log and wasn’t able to.
Do you guys have any suggestions on what can be done here? Is there a way to find out format of the data after each stage (input, processor, output)?