telegraftelegraf-inputs-plugintelegraf-plugins

Telegraf httpjson plugin error - must have one or more fields


i am using the httpjson plugin in telegraf.

My telegraf config looks like this:

[[inputs.httpjson]]
  name = "info_metric"
  servers = ["http://server.port/application/admin/info.json"]
  method = "GET"
  response_timeout = "5s"

The Json itself looks like this when i get it from my browser:

{"git":{"branch":"release/app_27.x","commit":{"id":"23cs3f","time":"2017-10-18T13:55:01+0200"}}}

Error message i get from the telegraf logs:

2017-10-25T11:02:11Z E! Error in plugin [inputs.httpjson]: http_json_info_metric: must have one or more fields

Solution

  • If you look at the httpjson documentation link here . It mentions that only numerical values are extracted from the JSON.

    Note that only numerical values are extracted and the type is float.

    Looking at your JSON, it is not having any numerical value to extract and hence no fields are formed as stated in the error message.