Skip to content

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

@poulhs

Description

@poulhs

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

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behaviorgood first issueThis is a smaller issue suited for getting started in Telegraf, Golang, and contributing to OSS.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions