telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Telegraf --config does not read files if files are named http:....

Open poulhs opened this issue 5 years ago • 1 comments

Relevant telegraf.conf:

# contents does not matter, as it is never read:
[[inputs.http_response]]
  urls = [ "https://www.influxdata.com/" ]
  response_timeout = "5s"
  follow_redirects = false
  interval         = "120s"

System info:

(most likely OS independent) RHEL7, RHEL8, ...

Steps to reproduce:

  1. Create the above configuration in the file https::##www.influxdata.com.conf:
cat > 'https:##www.influxdata.com'.conf << EOF
[[inputs.http_response]]
  urls = [ "https://www.influxdata.com/" ]
  response_timeout = "5s"
  follow_redirects = false
  interval         = "120s"
EOF
  1. Create a "verification" link:
ln 'https:##www.influxdata.com'.conf www.influxdata.com.conf
  1. Make telegraf fail on the first:
 telegraf --test --config 'https:##www.influxdata.com'.conf
2021-04-29T12:41:46Z I! Starting Telegraf 1.18.0
2021-04-29T12:41:46Z E! [telegraf] Error running agent: Error loading config file https:##www.influxdata.com.conf: Retry 0 of 3 failed connecting to HTTP config server Get "https:#%23www.influxdata.com.conf": http: no Host in request URL
  1. and succeed on the other:
telegraf --test --config www.influxdata.com.conf
2021-04-29T12:42:34Z I! Starting Telegraf 1.18.0
> http_response,host=...,method=GET,result=success,server=https://www.influxdata.com/,status_code=200 content_length=224068i,http_response_code=200i,response_time=0.397142678,result_code=0i,result_type="success" 1619700155000000000

Expected behavior:

Telegraf should read the configuration file if it exists. The filename is valid and file exists.

Actual behavior:

Telegraf tries to fetch a non-existing URL

Additional info:

We use the naming standard as we perform remote monitoring of thousands of servers. We use the naming scheme in a lot of other places too (kapacitor being one of them).

Bug is verified present in 1.14.3 and 1.18.0

poulhs avatar Apr 29 '21 12:04 poulhs

As discussed on slack, please use 'file://https:##www.influxdata.com.conf' if you really need this!

srebhan avatar May 18 '21 06:05 srebhan