Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using inputs.httpjson #2170

Closed
Alan1810 opened this issue Dec 16, 2016 · 1 comment
Closed

Error using inputs.httpjson #2170

Alan1810 opened this issue Dec 16, 2016 · 1 comment

Comments

@Alan1810
Copy link

Hi,

I'm trying to use inputs.json with telegraf 1.1.2 on Ubuntu 14.04.5 but I have this error in telegraf log file :

ERROR in input [inputs.httpjson]: unable to parse out as JSON, json: cannot unmarshal array into Go value of type map[string]interface {}

Telegraf configuration is :

[[inputs.httpjson]]
    name = "nodejs_stats"
    servers = [ "http://localhost:3000/api/monitoring/apps" ]
    response_timeout = "5s"
    method = "GET"
    tag_keys = [ "name" ]

JSON output response is :

[{"pid":21078,"name":"api-wrapper","pm_id":0,"status":"online","memory":51695616,"cpu":0,"restart_time":0,"unstable_restarts":0},{"pid":21087,"name":"api-wrapper","pm_id":1,"status":"online","memory":51945472,"cpu":0,"restart_time":0,"unstable_restarts":0},{"pid":21096,"name":"rest-api","pm_id":2,"status":"online","memory":74776576,"cpu":7,"restart_time":0,"unstable_restarts":0},{"pid":21101,"name":"rest-api","pm_id":3,"status":"online","memory":73617408,"cpu":1,"restart_time":0,"unstable_restarts":0}]

Anyone has an idea to resolve this problem ?

Regards

@sparrc
Copy link
Contributor

sparrc commented Dec 16, 2016

in telegraf 1.1.2 the JSON parser did not have the ability to parse arrays, this will be a feature in release 1.2: #1965

@sparrc sparrc closed this as completed Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants