Telgraf json -= first attempt


I’m looking at moving some of my collection scripts for various apis to telegraf.

I have a json api that I pull, and I’d like to get some stats off it. Initially I’m getting everything…which includes history…all as fields. This isn’t needed.

Here’s teh json.

        "month": 87387234
     "month": 4284972934

So ideally , I’d like to pull the totals ($.week, $.day, $.total, $.month) as a whole (to one table), and then for each server: $.servers['server1'].week/day/total/month etc to another table.

I guess my main points is I need a way of excluding $.servers['serverx'].daily as the rest of the information would be fine.

Any pointers for this newbie?


So like a dog with a bone I think I’ve managed to get something:

  ## One or more URLs from which to read formatted metrics
  interval = "5m"
  urls = [
  #HTTP method
  method = "GET"
  timeout = "15s"
  data_format = "json"
  json_query = "servers"
  name_override = "sabnzbd_server_stats"
  tag_keys = [
  fielddrop = ["daily", "daily_*", "*_daily_*"]

which gives me:

time               server1_day server2_day server1_month server2_month etc.....
----                --------------------- --------------------- ------------------------------- -------------------------------
1551126300000000000 0                     8683916971            2053517969                      0


Can I get the main totals in there as well…if I remove that json_query I don’t get any data. If it’s in this one table, thats ok, I wouldn’t mind knowing what the config would look like for populating a 2nd table.