Could Not Write Any Address

Telegraf does not seem able to create telegraf database. I have created an admin role for telegraf in influxdb… was not connecting before that either. Using the same cert.pem for both influxdb https and telegraf. Any ideas? Couldn’t find similar errors on any forums.

Receiving the following message starting up Telegraf:

W! [outputs.influxdb] When writing to [ht/tps://ADDRESS:8086]: database "telegraf" creation failed: 
Post https://ADDRESS:8086/query: Service Unavailable
Jun 04 16:41:22 EC2_DATA telegraf[5594]: 2020-06-04T16:41:22Z D! [agent] Successfully 
connected to outputs.influxdb
Jun 04 16:41:22 EC2_DATA telegraf[5594]: 2020-06-04T16:41:22Z D! [agent] Starting service inputs
Jun 04 16:36:10 EC2_DATA telegraf[2984]: 2020-06-04T16:36:10Z E! [outputs.influxdb] When 
writing to [ht/tps://ADDRESS:8086]: Post https://ADDRESS:8086/write? 
consistency=any&db=telegraf: Service Unavailable
Jun 04 16:36:10 EC2_DATA telegraf[2984]: 2020-06-04T16:36:10Z D! [outputs.influxdb] Buffer 
fullness: 63 / 10000 metrics
Jun 04 16:36:10 EC2_DATA telegraf[2984]: 2020-06-04T16:36:10Z E! [agent] Error writing to 
outputs.influxdb: could not write any address

Current telegraf.config:

OUTPUT PLUGINS

Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
The full HTTP or UDP URL for your InfluxDB instance.

Multiple URLs can be specified for a single cluster, only ONE of the
urls will be written to each interval.
/# urls = [“unix:///var/run/influxdb.sock”]
/# urls = [“udp://127.0.0.1:8089”]
urls = [“ht/tps://ADDRESS:8086”]

/## The target database for metrics; will be created as needed.
/## For UDP url endpoint database needs to be configured on server side.
database = “telegraf”

/## The value of this tag will be used to determine the database. If this
/## tag is not set the ‘database’ option is used as the default.
/# database_tag = “”

/## If true, the ‘database_tag’ will not be included in the written metric.
exclude_database_tag = false

/## If true, no CREATE DATABASE queries will be sent. Set to true when using
/## Telegraf with a user without permissions to create databases or when the
/## database already exists.
skip_database_creation = false

/## Name of existing retention policy to write to. Empty string writes to
/## the default retention policy. Only takes effect when using HTTP.
retention_policy = “”

/## The value of this tag will be used to determine the retention policy. If this
/## tag is not set the ‘retention_policy’ option is used as the default.
/# retention_policy_tag = “”

/## If true, the ‘retention_policy_tag’ will not be included in the written metric.
exclude_retention_policy_tag = false

/## Write consistency (clusters only), can be: “any”, “one”, “quorum”, “all”.
/## Only takes effect when using HTTP.
write_consistency = “any”

/## Timeout for HTTP messages.
timeout = “5s”

/## HTTP Basic Auth
username = “telegraf”
password = “[REDACTED]”

/## HTTP User-Agent
/#user_agent = “telegraf”

/## UDP payload size is the maximum packet size to send.
udp_payload = “512B”

/## Optional TLS Config for use on HTTP connections.
tls_ca = “/etc/telegraf/cert.pem”
tls_cert = “/etc/telegraf/cert.pem”
tls_key = “/etc/telegraf/cert.pem”
/## Use TLS but skip chain & host verification
/# insecure_skip_verify = true

/## HTTP Proxy override, if unset values the standard proxy environment
/## variables are consulted to determine which proxy, if any, should be used.
http_proxy = “ht/tp://ANOTHER_ADDRESS:80”

/## Additional HTTP headers
/# http_headers = {“X-Special-Header” = “Special-Value”}

/## HTTP Content-Encoding for write request body, can be set to “gzip” to
/## compress body or “identity” to apply no encoding.
/# content_encoding = “identity”

/## When true, Telegraf will output unsigned integers as unsigned values,
/## i.e.: “42u”. You will need a version of InfluxDB supporting unsigned
/## integer values. Enabling this option will result in field type errors if
/## existing data has been written.
/# influx_uint_support = false

Are you writing directly to influxdb?
If you are using a telegraf gateway (input influxdb listener) the create database request is not passed through.

have you tried to create the database manually? is it able to write in that case?

I was not using the telegraf gateway.

I just got it to work by commenting out http_proxy. I am not sure why, but that seemed to be causing the error. Works fine now.