Closed
Description
Issue is present only when interface
is set to proper value in telegraf.conf
Relevant telegraf.conf for Windows:
[[inputs.http_response]]
## List of urls to query.
urls = ["http://127.0.0.1:15000/hello", "http://[::1]:15000/hello"]
## Interface to use when dialing an address
interface = "Loopback Pseudo-Interface 1"
Relevant telegraf.conf for Linux:
[[inputs.http_response]]
## List of urls to query.
urls = ["http://127.0.0.1:15000/hello", "http://[::1]:15000/hello"]
## Interface to use when dialing an address
interface = "lo"
System info:
- Telegraf 1.16.2 (but probably there is problem since
interface
was added to plugin here: Add support for interface field in http_response input plugin #6006 - so from Telegraf 1.12.0) - Windows 10 Pro and Ubuntu 18
Steps to reproduce:
- Start web server which listens on the TCP6 and TCP4 networks. For example:
http.HandleFunc("/hello", func(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, "hello\n")
})
http.ListenAndServe(":15000", nil)
- Verify that web server responds successfully for
http://127.0.0.1:15000/hello
andhttp://[::1]:15000/hello
(using web browser orcurl
) - Run Telegraf in Windows with given config (be sure that proper name of loopback interface is used).
- Run Telegraf in Linux with given config (be sure that proper name of loopback interface is used).
Expected behavior:
- Web server starts successfully.
- Web server responds successfully for
http://127.0.0.1:15000/hello
andhttp://[::1]:15000/hello
. - Telegraf for Windows successfully monitors both URLs.
- Telegraf for Linux successfully monitors both URLs.
Actual behavior:
- Web server starts successfully.
- Web server responds successfully for
http://127.0.0.1:15000/hello
andhttp://[::1]:15000/hello
. - Telegraf for Windows successfully monitors only
http://[::1]:15000/hello
URL:
http_response,host=win10,method=GET,result=connection_failed,server=http://127.0.0.1:15000/hello result_type="connection_failed",result_code=3i 1606058770000000000
http_response,host=win10,method=GET,result=success,server=http://[::1]:15000/hello,status_code=200 content_length=6i,result_type="success",result_code=0i,response_time=0.0020097,http_response_code=200i 1606058770000000000
- Telegraf for Linux successfully monitors only
http://127.0.0.1:15000/hello
URL:
http_response,host=ubuntu,method=GET,result=success,server=http://127.0.0.1:15000/hello,status_code=200 result_code=0i,response_time=0.02016597,http_response_code=200i,content_length=6i,result_type="success" 1606058900000000000
http_response,host=ubuntu,method=GET,result=connection_failed,server=http://[::1]:15000/hello result_type="connection_failed",result_code=3i 1606058900000000000
Additional info:
Why Telegraf for Windows fails for IPv4 URL http://127.0.0.1:15000/hello
and Telegraf for Linux fails for IPv6 URL http://[::1]:15000/hello
?
It is because in this line
Would it work if any address ordering solution is provided (so the same address would be chosen
independently from OS type)?
No, they would just fail for the same address type. Other address type would still not work. It is because HTTP Client with chosen address is configured per plugin and not per provided URL.
Activity