Data sent from Telegraf to InfluxDB

It’s normal to send data from Telegraf to ==> InfluxDB without database credentials in telegraf.conf?
It was supposed to work in this 2 ways (with and without)?

server1 (telegraf) ==> server2 (influxDB)

[root@server1 ~]# cat /etc/telegraf/telegraf.conf
[global_tags]

[agent]
interval = “15s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “15s”
flush_jitter = “5s”
debug = false
quiet = false
hostname = “server1”
#logfile = “/var/log/telegraf/telegraf.log”
omit_hostname = false

[[outputs.influxdb]]
urls = [“http://server2:8086”]
database = “database”
precision = “s”

Kind Regards,

Not sure I’m understanding correctly, but yes, you only need to set credentials for your InfluxDB if you have restricted your InfluxDB to certain users. By the way, the precision option on the InfluxDB no longer has any effect so you can remove it.

1 Like

What I’m trying to say is that:

1. If I set the credentials for the database created in influxDB is ok, the data will be sent by telegraf to influxDB.
–telegraf.conf–
[[outputs.influxdb]]
urls = [“http://server2:8086”]
database = “database”
retention_policy = “”
write_consistency = “any”
timeout = “5s”
username = “user”
password = “password”

2. If I not set the credentials for database created in influxDB is also ok, the data will be sent by telegraf also to influxDB (previous example posted by me without credentials).
–telegraf.conf–
[[outputs.influxdb]]
urls = [“http://server2:8086”]
database = “database”

I’ve tested and have the both ways and it seems is working.
What do you think about this, is a normal behavior?

This would only be normal if the database does not have HTTP authentication turned on, do you have auth-enabled = true set on the http service in your influxdb.conf?

1 Like

I didn’t know about this option, very interesting aspect.
It seems that is on “false” now.
What is your recommendation for good practices regarding this topic?

[root@server1]# grep “auth-enabled” /etc/influxdb/influxdb.conf
#auth-enabled = false

Check the authentication and authorization docs, you will need this set to true unless you have the database on a restricted network.

1 Like

Thank you Daniel for the guidance, appreciated.
Have a great day.