Telegraf plugin problem

Hi!

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.

Thanks for your help!
Krisztian

HI @1forrest,

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!

@1forrest

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.

Which version of InfluxDB are you using?

Please post the exact error message here:

```log
put the error message here
```

Please post your Telegraf config in Markdown format here:

```toml
put the Telegraf config code here
```

Version:

Log:
2021-03-16T19:37:47Z I! Starting Telegraf 1.17.3 stdout
2021-03-16T19:37:44Z I! Using config file: /etc/telegraf/telegraf.conf stdout
2021-03-16T19:37:44Z E! [telegraf] Error running agent: Error: no inputs found, did you provide a valid config file? stdout

Telegraf config, made by Influxdb. This is what I moved to /etc/telegraf/ folder and should be picked up by the Telegraf but goes to error

Configuration for telegraf agent

[agent]

Default data collection interval for all inputs

interval = “10s”

Rounds collection interval to ‘interval’

ie, if interval=“10s” then always collect on :00, :10, :20, etc.

round_interval = true

Telegraf will send metrics to outputs in batches of at most

metric_batch_size metrics.

This controls the size of writes that Telegraf sends to output plugins.

metric_batch_size = 1000

For failed writes, telegraf will cache metric_buffer_limit metrics for each

output, and will flush this buffer on a successful write. Oldest metrics

are dropped first when this buffer fills.

This buffer only fills when writes fail to output plugin(s).

metric_buffer_limit = 10000

Collection jitter is used to jitter the collection by a random amount.

Each plugin will sleep for a random time within jitter before collecting.

This can be used to avoid many plugins querying things like sysfs at the

same time, which can have a measurable effect on the system.

collection_jitter = “0s”

Default flushing interval for all outputs. Maximum flush_interval will be

flush_interval + flush_jitter

flush_interval = “10s”

Jitter the flush interval by a random amount. This is primarily to avoid

large write spikes for users running a large number of telegraf instances.

ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s

flush_jitter = “0s”

By default or when set to “0s”, precision will be set to the same

timestamp order as the collection interval, with the maximum being 1s.

ie, when interval = “10s”, precision will be “1s”

when interval = “250ms”, precision will be “1ms”

Precision will NOT be used for service inputs. It is up to each individual

service input to set the timestamp at the appropriate precision.

Valid time units are “ns”, “us” (or “µs”), “ms”, “s”.

precision = “”

Logging configuration:

Run telegraf with debug log messages.

debug = false

Run telegraf in quiet mode (error log messages only).

quiet = false

Specify the log file name. The empty string means to log to stderr.

logfile = “”

Override default hostname, if empty use os.Hostname()

hostname = “”

If set to true, do no set the “host” tag in the telegraf agent.

omit_hostname = false

[[outputs.influxdb_v2]]

The URLs of the InfluxDB cluster nodes.

Multiple URLs can be specified for a single cluster, only ONE of the

urls will be written to each interval.

urls exp: http://127.0.0.1:8086

urls = [“http://192.168.1.124:8086”]

Token for authentication.

token = “$INFLUX_TOKEN”

Organization is the name of the organization you wish to write to; must exist.

organization = “forest”

Destination bucket to write into.

bucket = “forest_bucket”

Please post your config in markdown format here, it is barely readable…
I would say, you don’t have any inputs plugin in your Telegraf config?

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

sudo docker ps

No data

As the error message makes clear, you have not configured any input plugin in Telegraf.
How do you send data to InfluxDB without data? :smirk:

Thanks! I have added the Fibaro plugin and at least it passed through but came up a new error message. 192.168.1.1:53 No such host error

I tried to look for IP address but I do not know what is it and why influxdb is looked up under that IP. Do I need to adjust the host file?

I don’t know your setup, so I can only guess.
Is the InfluxDB instance running at all?
Is the container running?

sudo docker ps -a

Yes, it is running

What I do not know where this IP is coming from

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.