Unale to parse JSON data into Influx DB

I setup telegraf on Windows server. I am able to run it stand-alone and as a service. I need to parse an array of JSON strings to influx db. The python code is executing, but the plug-in throws a parse error as below:

  • Plugin: inputs.exec, Collection 1
  • Internal: 10s
    2017-12-22T20:21:00Z E! Error in plugin [inputs.exec]: unable to parse out as JS
    ON, invalid character ‘H’ looking for beginning of value

Here is the .conf file:

    [[inputs.exec]]
 command = "stats.py"
 data_format = "json"
 name_override = "response_time"
 interval = "10s"
 tag_keys = ["request","site","stype"]


[[outputs.influxdb]]
  urls = ["udp://127.0.0.1:8089"]
  database = "test" # required
  precision = "s"
  timeout = "5s"

The json format I need to use to parse to influxdb as below:

[{‘requestStat’: {‘count’: 20000, ‘min’: 0.0, ‘max’: 1700, ‘avg’: 147.617232}, ‘request’: ‘/login.aspx’, ‘site’: ‘X’, ‘stype’: ‘XY’}, {‘requestStat’: {‘count’: 157588, ‘min’: 0.0, ‘max’: 143654.0, ‘avg’: 216.54604411503414, ‘sum’: 34125058.0}, ‘request’: ‘/default.aspx’, ‘site’: ‘X’, ‘stype’: ‘XY’}]

Please advise

This does not appear to be valid json. Can you test it against a json parser or linter, there are many freely available on the internet?

– richard

you must have something as a middle-man to parse the JSON and push to Influx.
First name comes to my mind is Fluentd. You can use it’s JSON-parser plugin as “input”, and official influxDB plugin as “output”.