I was wondering if i could get help with my telegraf config.
I’ve tried this a bunch of different ways from the json_v2 testdata, but cant seem to figure out how to get the information cleanly into influxdb.
here is an example json i am trying to send to telegraf:
{
"tenant": [
{
"Cu1": [
{
"Cu1-Site1": {
"device-type": "vedge",
"interfaces": [
{
"GigabitEthernet1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet2": {
"rx_kbps": 17,
"tx_kbps": 52
}
},
{
"GigabitEthernet3": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet4": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Loopback65528": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"NVI0": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Sdwan-system-intf": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel2": {
"rx_kbps": 1,
"tx_kbps": 0
}
},
{
"vmanage_system": {
"rx_kbps": 0,
"tx_kbps": 0
}
}
],
"reachability": "reachable"
}
},
{
"Cu1-Site2": {
"device-type": "vedge",
"interfaces": [
{
"GigabitEthernet1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet2": {
"rx_kbps": 15,
"tx_kbps": 52
}
},
{
"GigabitEthernet3": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet4": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Loopback65528": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"NVI0": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Sdwan-system-intf": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel2": {
"rx_kbps": 1,
"tx_kbps": 0
}
},
{
"vmanage_system": {
"rx_kbps": 0,
"tx_kbps": 0
}
}
],
"reachability": "reachable"
}
},
{
"cu1-hub-internet": {
"device-type": "vedge",
"interfaces": [],
"reachability": "unreachable"
}
}
]
},
{
"cu2": [
{
"Cu2-Site1": {
"device-type": "vedge",
"interfaces": [
{
"GigabitEthernet1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet2": {
"rx_kbps": 13,
"tx_kbps": 30
}
},
{
"GigabitEthernet3": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet4": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Loopback65528": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"NVI0": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Sdwan-system-intf": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel2": {
"rx_kbps": 1,
"tx_kbps": 0
}
},
{
"vmanage_system": {
"rx_kbps": 0,
"tx_kbps": 0
}
}
],
"reachability": "reachable"
}
},
{
"Cu2-Site2": {
"device-type": "vedge",
"interfaces": [
{
"GigabitEthernet1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet2": {
"rx_kbps": 14,
"tx_kbps": 52
}
},
{
"GigabitEthernet3": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"GigabitEthernet4": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Loopback65528": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"NVI0": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Sdwan-system-intf": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel1": {
"rx_kbps": 0,
"tx_kbps": 0
}
},
{
"Tunnel2": {
"rx_kbps": 1,
"tx_kbps": 0
}
},
{
"vmanage_system": {
"rx_kbps": 0,
"tx_kbps": 0
}
}
],
"reachability": "reachable"
}
}
]
}
],
"vManage Response Time": 57.96632242202759
}
and here is my current telegraf config:
data_format = "json_v2"
[[inputs.http_listener_v2.json_v2]]
[[inputs.http_listener_v2.json_v2.object]]
disable_prepend_keys = true
path = "@this"
included_keys = [
"tenant",
"interfaces"
]
tags = ["interfaces"]
this bring in all the information i need, but not in a scalable format.
with influxdb, everything is listed by interface rx then interface tx, with no association to what device.
what im looking for with this is a way to parse the json with json_v2 so in influxdb i can sort by the following:
tenant -> device -> interfaces -> rx/tx stats
for example, from the above json:
tenant -> Cu1 -> Cu1-Site1 -> interfaces (list all interfaces) -> view the rx/tx stats
ive tried this a few different ways, but it always shows up like a mess in influx.
trying to learn how to filter it with https://gjson.dev/ has helped, but im not sure how to account for the possible variables. i.e. if i dont know what the tenant name, device name, or what interfaces it has
I am a few days into this, so i would really appreciate the help.
if there is an easier way to do this, let me know. or if i should format the json differently to make the filtering easy let me know. im flexible either way
Thanks