I have telegraf successfully up and running on a raspi, feeding system data into influxdb for grafana.
My question is, I have a service on that pi that provides a json file with all kind of stats about itself via http, how do i get that into the same influxdb as measurements?
Should have worded it better… the service provides statistics about itself in json format via http, on the address http://127.0.0.1:8754/monitor.json
the content looks like this: SUSE Paste (it’s longish).
I’m only interested in the value of d11_map_size.
Which to my understanding should give me all the data from that json, tagged with the hostname, under a “category” of “fr24” when I use “explore” in grafana… but it’s not there.
Hello @lemmy04 ,
Have you taken a look at metrics filtering for telegraf?
Specifically fieldpass = ["d11_map_size"]
Also I recommend setting debug = true in the agent portion of your config. Finally, I like to
test that the data is being sent to InfluxDB, run the following (replacing telegraf.conf with the path to your configuration file):
telegraf -config ~/telegraf.conf -test
Have you tried that? If so can you share the resulting line protocol?
Thanks
Yes.
Your values are all in string format.
The keys of values containing strings must be explicitly named to the json parser, otherwise they will apparently not be read.
I have added the processor plugin to turn the string into an integer.
You can omit this if you want to process the value as a string.
This works:
[[inputs.http]]
urls = ["https://susepaste.org/view/raw/15081925"]
method = "GET"
name_override = "fr24"
data_format = "json"
json_string_fields = ["d11_map_size"]
fieldpass = ["d11_map_size"]
# Convert string to unsigned value type
[[processors.converter]]
[processors.converter.fields]
unsigned = ["d11_map_size"]
[[outputs.file]] # only for debugging
files = ["dump1090.out"]
influx_sort_fields = true