Monitoring dump1090

Hi,

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?

Cheers
MH

Hello @lemmy04,
Welcome!
Have you checked out the telegraf file plugin?

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.

I’ve tried the http input like so:

root@flightpi:~# cat /etc/telegraf/telegraf.d/fr24.conf
[[inputs.http]]
urls = ["http://127.0.0.1:8754/monitor.json"]
method = "GET"
name_override = "fr24"
data_format = "json"

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.

Any ideas?

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

the rest of the data from that host arrives in my influxdb just fine, its just this one thing that doesn’t work…

root@flightpi:/etc/telegraf/telegraf.d# telegraf --config /etc/telegraf/telegraf.d/fr24.conf --debug --test
2021-03-18T08:28:29Z I! Starting Telegraf 1.17.3
2021-03-18T08:28:29Z D! [agent] Initializing plugins
2021-03-18T08:28:29Z D! [agent] Starting service inputs
2021-03-18T08:28:30Z D! [agent] Stopping service inputs
2021-03-18T08:28:30Z D! [agent] Input channel closed
2021-03-18T08:28:30Z D! [agent] Stopped Successfully

this is all i get…

I also tried it with the input.exec module and curl on the URL for the status file, same result.
curl on the commandline works…

Any ideas?

Cheers
[L]

even if i add the bits from the separate config file directly into telegraf.conf it does fetch the data.

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
1 Like