user685590
user685590

Reputation: 2564

telegraf http input plugin

I am trying to create a proof on concept using the TICK stack for monitoring. I have the helloworld stack running and showing CPU/Docker metrics.

I am trying to use the telegraf http input plugin to pull from an http endpoint:

From the docs i have simply configured the URL, GET and type (Set to json)

[[inputs.http]]
## One or more URLs from which to read formatted metrics
urls = [
"http://localhost:500/Queues"
]
method = "GET"
data_format = "json"

However nothing appears in Influx/Chronograf. I can modify the endpoint to suit any changes there, but what am i doing wrong in telegraf config ?

Upvotes: 1

Views: 4669

Answers (2)

Frank
Frank

Reputation: 41

I think I had the same struggle. For me the following conf worked:

[[inputs.http]]
name_override ="restservice_health"
urls = [
   "https://localhost:5001/health"
]
method = "GET"
data_format = "value"
data_type = "string"

In this way, it appeared in Influxdb under the name "restservice_health" (allthough this option is not important for the example, so you could leave it out).

Upvotes: 2

Steven Soroka
Steven Soroka

Reputation: 19902

First, you would have to look at the result of the http://localhost:500/Queues request to make sure that it's a valid JSON object. Then, depending on what is returned from that endpoint, you may have to configure the JSON parser, for example by setting json_query to a GJSON query to navigate the JSON response to the data you need.

Upvotes: 0

Related Questions