You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've installed and configured httpjson input for telegraf and it works well for single object jsons. Getting a response with an array of objects (multiple measurements), it gives the following error: ERROR in input [inputs.httpjson]: unable to parse out as JSON, json: cannot unmarshal array into Go value of type map[string]interface {} and I there seems to be no reason. I've copied the new version of the json parser in /plugins/parsers/json. If I'm not missing anything, how come it doesn't work?
Thanks a lot,
Marketa
Telegraf version 1.1.2
OS Ubuntu 14.04.5 LTS
[Include Telegraf version, operating system name, and other relevant details]
Steps to reproduce:
Input server config - call (rest api) responding with an array of objects json
Expected behavior:
Process each object in the array as a single metric.
Actual behavior:
Does nothing, logs an error ERROR in input [inputs.httpjson]: unable to parse out as JSON, json: cannot unmarshal array into Go value of type map[string]interface {}
Bug report
Hi,
I've installed and configured httpjson input for telegraf and it works well for single object jsons. Getting a response with an array of objects (multiple measurements), it gives the following error:
ERROR in input [inputs.httpjson]: unable to parse out as JSON, json: cannot unmarshal array into Go value of type map[string]interface {}
and I there seems to be no reason. I've copied the new version of the json parser in /plugins/parsers/json. If I'm not missing anything, how come it doesn't work?Thanks a lot,
Marketa
Relevant telegraf.conf:
Functional input
[[inputs.httpjson]] name = "myapp_systeminfo" interval = "30s" servers = [ "http://test.myapp.company.it/rest/api/2/serverInfo" ] pass = [ "buildNumber", "versionNumbers" ] tag_keys = [ "baseUrl", "version" ] method = "GET" response_timeout = "5s" [inputs.httpjson.headers] Authorization = "Basic AJRtuiW46YNRtaB4=" [inputs.httpjson.parameters] doHealthCheck = "true"
Error giving input
[[inputs.httpjson]] name = "myapp_applicenses" servers = [ "http://test.myapp.company.it/rest/myappmonitor/1.0/applicenses" ] pass = [ "daysLeft" ] tag_keys = [ "application" ] method = "GET" response_timeout = "5s" [inputs.httpjson.headers] Authorization = "Basic AJRtuiW46YNRtaB4="
System info:
Telegraf version 1.1.2
OS Ubuntu 14.04.5 LTS
[Include Telegraf version, operating system name, and other relevant details]
Steps to reproduce:
Expected behavior:
Process each object in the array as a single metric.
Actual behavior:
Does nothing, logs an error
ERROR in input [inputs.httpjson]: unable to parse out as JSON, json: cannot unmarshal array into Go value of type map[string]interface {}
Additional info:
Functional response (gets processed)
{ "baseUrl":"http://test.myapp.company.it", "version":"7.2.4", "versionNumbers":[ 7, 2, 4 ], "deploymentType":"Server", "buildNumber":72006, "buildDate":"2016-10-31T00:00:00.000+0100", "serverTime":"2016-12-13T17:43:48.952+0100", "scmInfo":"91606a849e49df24789f9d9a6614de45c98c37a8", "serverTitle":"MyAPPtest - MYAPP" }
Non-functional response (logs the error)
[ { "application":"myapp-app1", "daysLeft":126 }, { "application":"myapp-app2", "daysLeft":126 }, { "application":"myapp-app3", "daysLeft":126 } ]
The text was updated successfully, but these errors were encountered: