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

Failed to connect/Error was 'unsupported scheme #8231

Closed
coolblknerd opened this issue Oct 6, 2020 · 5 comments
Closed

Failed to connect/Error was 'unsupported scheme #8231

coolblknerd opened this issue Oct 6, 2020 · 5 comments
Labels
support Telegraf questions, may be directed to community site or slack

Comments

@coolblknerd
Copy link

coolblknerd commented Oct 6, 2020

I've been trying to configure the telegraf agent on some nodes however I can't get the agent to pick up my URL value that's using a environment variable. I understand that 1.11 introduced the ${} syntax, however, whether I uses the new or old syntax, the environment variable isn't getting picked up.

Relevant telegraf.conf:

urls = ["${INFLUXDB_URI}"] or urls = ["$INFLUXDB_URI"]

System info:

Telegraf: 1.15.3
Ubuntu 20.04 LTS

Steps to reproduce:

  1. Install Telegraf
  2. Create environment variable INFLUXDB_URI
  3. Create telegraf.conf file with urls attribute updated with either "[$INFLUXDB_URI]" or "[${INFLUXDB_URI}]"
  4. Attempt to start telegraf
  5. Run 'service telegraf status"

Expected behavior:

Expect Telegraf to connect to the given InfluxDB URI without any errors.

Actual behavior:

Receiving "[agent] Failed to connect to [outputs.influxdb], retrying in 15s, error was 'unsupported scheme ["$INFLUXDB_URI"]: "

Additional info:

@coolblknerd coolblknerd added the bug unexpected problem or unintended behavior label Oct 6, 2020
@sjwang90
Copy link
Contributor

sjwang90 commented Oct 8, 2020

Can you the full config for your outputs.influxdb?

@sjwang90 sjwang90 added support Telegraf questions, may be directed to community site or slack and removed bug unexpected problem or unintended behavior labels Oct 8, 2020
@coolblknerd
Copy link
Author

Here ya go @sjwang90

[[outputs.influxdb]]
urls = ["$INFLUXDB_URI"] 
database = "telegraf" ]
retention_policy = ""
write_consistency = "any"
timeout = "5s"
username = "telegraf"
password = *****
user_agent = "selenoid"

@sjwang90
Copy link
Contributor

sjwang90 commented Oct 8, 2020

That error message doesn't correspond this problem, but at first glance the ] in the database = "telegraf" ] shouldn't be there.

Can you run check the environment variable you set for your URL. Here's some documentation around it that may help.

@sjwang90
Copy link
Contributor

Hey @coolblknerd just checking if this is still a problem. Closing this issue for now. Please reach out to us in our Community Slack or Community Page as it'll be a better place to get this question answered.

@alteredtech
Copy link

alteredtech commented Mar 31, 2021

I am getting this issue as well.
Ubuntu 20.04.2 LTS
Telegraf 1.18.0

here is my /etc/telegraf/telegraf.d/outputs.influxdb.conf

[[outputs.influxdb]]
    urls = ["${INFLUX_URL}"]
    database = "pihole"
    ## HTTP Basic Auth
    username = "${INFLUX_USER}"
    password = "${INFLUX_PWD}"
    namepass = ["pihole_stats*"]

Here is my /etc/default/telegraf

INFLUX_URL = "http://10.0.0.5:8086"
INFLUX_USER = "telegraf"
INFLUX_PWD = "somepassword"

then my /etc/telegraf/telegraf.d/inputs.pihole.conf for good measure

[[inputs.http]]
    #pihole URL for data in json format
    urls=["http://10.0.0.5:8080/admin/api.php"]

    method = "GET"

    #Overwrite measurement name from default http to pihole_stats
    name_override = "pihole_stats"

    timeout = "10s"

    #exclude host items from tags
    tagexclude = ["host"]

    #data from http in JSON format
    data_format = "json"

    #JSON values to set as string fields
    json_string_fields = ["url","status"]

    insecure_skip_verify = true

print of my sudo -u telegraf printenv

LC_TERMINAL=iTerm2
TERM=xterm-256color
LC_TERMINAL_VERSION=3.4.4
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
MAIL=/var/mail/telegraf
LOGNAME=telegraf
USER=telegraf
HOME=/etc/telegraf
SHELL=/bin/false
SUDO_COMMAND=/usr/bin/printenv
SUDO_USER=ubuntu
SUDO_UID=1000
SUDO_GID=1000

Another note, when I run telegraf --test, it is meant to pull from the telegraf.d and essentially make one large conf file correct? That is what I read here #6334

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Telegraf questions, may be directed to community site or slack
Projects
None yet
Development

No branches or pull requests

3 participants