I cant get it done :-(((
My python code generates this:
{
"metrics": [{
"fields": {
"state": 1
},
"name": "vpnikestatus",
"timestamp": 1541682407,
"tags": {
"peerip": "217.16.206.38",
"cmapname": "mycompanies",
"aclname": "tun-audi",
"mygateway": "1.1.1.1"
}
}, {
"fields": {
"state": 3
},
"name": "vpnikestatus",
"timestamp": 1541682407,
"tags": {
"ikeversion": 2,
"usedip": "18.196.91.186",
"mygateway": "1.1.1.1",
"countrycode": "DE",
"peerip": "18.196.91.186",
"cmapname": "mycompanies",
"longitude": 8.6842,
"aclname": "tun-skoda",
"latitude": 50.1155,
"city": "Frankfurt am Main"
}
}, {
"fields": {
"state": 2
},
"name": "vpnikestatus",
"timestamp": 1541682407,
"tags": {
"ikeversion": 1,
"usedip": "80.152.197.230",
"mygateway": "1.1.1.1",
"countrycode": "DE",
"peerip": "80.152.197.230",
"cmapname": "mycompanies",
"longitude": 7.75,
"aclname": "tun-trabant",
"latitude": 49.9667,
"city": "Daxweiler"
}
},
...
]
}
it is exact the same as the telegraf json batch output format like in the link below:
in the cli in influx I see that:
> show field keys from exec_vpnikestatus
name: exec_vpnikestatus
fieldKey fieldType
-------- ---------
metrics_0_fields_state float
metrics_0_timestamp float
metrics_100_fields_state float
metrics_100_timestamp float
metrics_101_fields_state float
metrics_101_tags_ikeversion float
metrics_101_tags_latitude float
metrics_101_tags_longitude float
metrics_101_timestamp float
metrics_102_fields_state float
metrics_102_timestamp float
metrics_103_fields_state float
metrics_103_tags_ikeversion float
metrics_103_tags_latitude float
metrics_103_tags_longitude float
metrics_103_timestamp float
metrics_104_fields_state float
metrics_104_timestamp float
metrics_105_fields_state float
for each datapoints it generates a new fieldname??? What the hell is this?
My aim is to write multiple datapoints with the same timestamp to the same measurement but with different tag values (the tag and field names are all the same in the python script output). I am deadly tired now, cannot sleep for days because of this shit…
telegraf.conf:
[[inputs.exec]]
command = "C:/Python27/python.exe C:/Python27/check_restapi_asavpn.py -d 172.156.144.234 -p fsfd"
data_format = "json"
name_suffix = "_vpnikestatus"
interval = "300s"
timeout = "30s"