I have installed influxdb and Telegraf on my Synology NAS in the Docker. In the Influxdb UI I created the bucket, telegraf configuration and token. When I start my Telegraf in the Terminal I can see the following problem:
[outputs.influxdb] When writing to [http://localhost:8086]: 401 Unauthorized
[agent] Error writing to outputs.influxdb: could not write any address
I saw somewhere that the localhost after the http should be changed to influxdb but I do not know how and not know if this is what I need to perform.
The localhost should be changed to whatever the hostname is for your InfluxDB container. If you called it influxdb (which is common) then indeed you should replace localhost with influxdb, but if you’ve named it something else you’ll need to use that name instead.
Thanks for your answer. Can you help me with a description how I can change this? When I check the config file in the etc directory I cannot find it. I do not know how I can change this setting. Thanks!
I don’t know your setup exactly, but if you use docker, then the influxdb container has a name.
You can run docker ps and the column NAMES will give you the name of the container.
Afaik you have to use this name instead of localhost
The name is clear my problem is how to change this in the Telegraf’s config file. I assume I have to rewrite but I do not know how I can do it.
I also tried to download the Telegraf config fle from Influxdb and whn I put it to the custom mounted path I have given during installation, Telegraf does not start up. It says that the confog file is not correct.
So I do not know how to change the default config file of Telegraf and the one created by Influxdb does not work.
Using Putty through SSH, I receive the bellow error when run docker ps
Got permission denied while trying to connect to the Docker daemon socket at uni x:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers /json: dial unix /var/run/docker.sock: connect: permission denied
Yes, but the InfluxDB container has no ports open, it is not accessible.
Please post here your docker configuration or your docker-compose.yml file for the InfluxDB container.