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

Requesting HTTP_response plugin to support multiple addresses #2294

Closed
seprich opened this issue Jan 19, 2017 · 4 comments
Closed

Requesting HTTP_response plugin to support multiple addresses #2294

seprich opened this issue Jan 19, 2017 · 4 comments

Comments

@seprich
Copy link

seprich commented Jan 19, 2017

Feature Request

Proposal:

HTTP_response plugin should support checking connectivity and response times of multiple addresses.
Currently in config file only one address can be given: address = "" which is limiting. Instead it should
be possible to give a list of addresses, similar to the HTTPJSON plugin, which takes a list of servers.

In my use case I desired to monitor the /health api responses of several microservices at once.
Edit:
It turns out that the whole configuration sections [[inputs.http_response]] can be duplicated and telegraf will obey and act on each copy. So this issue is more about having somewhere in documentation mentioned clearly that (all or just some?) plugins can be instantiated multiple times. Current documentation does not point this out so the reader will automatically assume that each plugin is configured once only.

@sparrc
Copy link
Contributor

sparrc commented Jan 21, 2017

this is documented: https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#output-configuration-examples

if you want to submit a PR to make it more obvious, that would be OK as well

@sparrc sparrc closed this as completed Jan 21, 2017
@danesparza
Copy link

Also: A tip from the linked docs:

It is highly recommended that you utilize name_override, name_prefix, or name_suffix config options to avoid measurement collisions

@rakesh1084
Copy link

rakesh1084 commented Mar 31, 2017

Hi is there a way to configure multiple http_requests in one input something like below:-

Tried modifying the file to monitor multiple web sites using the config file
nano /etc/telegraf/telegraf.conf

 [[inputs.http_response]]
   address = [
     "http://localhost:90/mantisBT",
     "http://localhost/app1",
     "http://localhost/app2",
   ]

after saving this when I tried
telegraf -config /etc/telegraf/telegraf.conf -input-filter http_response -test
no output was displayed.

when i tried

 [[inputs.http_response]]
   address = "http://localhost:90/","http://localhost/app1"

after saving this when I tried
telegraf -config /etc/telegraf/telegraf.conf -input-filter http_response -test
printed error was below
2017/03/31 14:05:16 E! Error parsing /etc/telegraf/telegraf.conf, toml: line 985: parse error

when tried

 [[inputs.http_response]]
   address = "http://localhost:90/"
   address = "http://localhost/app1"

it returned
2017/03/31 14:21:48 E! Error parsing /etc/telegraf/telegraf.conf, toml: line 986: key `address' is in conflict with line 985

Can you please reply.

@rakesh1084
Copy link

Okay. learnt that below config can handle it.

 [[inputs.http_response]]
#   ## Server address (default http://localhost)
   address = "http://localhost/app1"

 [[inputs.http_response]]
#   ## Server address (default http://localhost)
   address = "http://localhost:90/"

 [[inputs.http_response]]
#   ## Server address (default http://localhost)
   address = "http://localhost:3000/"

Thanks for the wonderful project..


telegraf -config /etc/telegraf/telegraf.conf -input-filter http_response -test
* Plugin: inputs.http_response, Collection 1
> http_response,server=http://localhost:90/,method=GET,host=10.*.*.* response_time=0.022389100000000002,http_response_code=301i 1490956393000000000
* Plugin: inputs.http_response, Collection 1
> http_response,method=GET,host=*.*.*.*,server=http://localhost:3000/ response_time=0.0030783000000000004,http_response_code=302i 1490956393000000000
* Plugin: inputs.http_response, Collection 1
> http_response,method=GET,host=*.*.*.*,server=http://localhost/app1
response_time=0.0216025,http_response_code=200i 1490956393000000000

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

4 participants