Hi, friends:
I created telegraf
in influx config:
[root@fastnetmon ~]# influx config list
Active Name URL Org
default http://localhost:8086 demo.net
influx http://localhost:8086 demo.net
* telegraf http://localhost:8086 demo.net
this is my fragment of /etc/telegraf/telegraf.conf
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "telegraf"
retention_policy = "influx_retention"
username = "telegraf"
password = "Ab123456#pwd"
when I start telegraf, but get below Unauthorized
error:
[root@dele telegraf]# /usr/bin/telegraf --config /etc/telegraf/telegraf.conf
2020-11-30T21:27:25Z I! Starting Telegraf 1.16.2
2020-11-30T21:27:25Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system
2020-11-30T21:27:25Z I! Loaded aggregators:
2020-11-30T21:27:25Z I! Loaded processors:
2020-11-30T21:27:25Z I! Loaded outputs: influxdb
2020-11-30T21:27:25Z I! Tags enabled: host=fastnetmon
2020-11-30T21:27:25Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"fastnetmon", Flush Interval:10s
2020-11-30T21:27:25Z W! [outputs.influxdb] When writing to [http://localhost:8086]: database "telegraf" creation failed: 401 Unauthorized
2020-11-30T21:27:35Z E! [outputs.influxdb] When writing to [http://localhost:8086]: 401 Unauthorized
2020-11-30T21:27:35Z E! [agent] Error writing to outputs.influxdb: could not write any address
^C2020-11-30T21:27:40Z I! [agent] Hang on, flushing any cached metrics before shutdown
2020-11-30T21:27:40Z E! [outputs.influxdb] When writing to [http://localhost:8086]: 401 Unauthorized
2020-11-30T21:27:40Z E! [agent] Error writing to outputs.influxdb: could not write any address
I found the token is different from default token, because when create config there only can set token(can not password):
influx config create -n telegraf \
-u http://localhost:8086 \
-o demo.net \
-t Ab123456#pwd \
-a
# more .influxdbv2/configs
[default]
url = "http://localhost:8086"
token = "fPOiCsoJfAiHDH432nf1ButrsMuG-_MguGbgGL5y8rW0bAdFTOi4v5jzYZOBuQS0vokUfPhRRf232BTVdKKjQQ=="
org = "demo.net"
previous = true
[influx]
url = "http://localhost:8086"
token = "Ab123456#pwd"
org = "demo.net"
[telegraf]
url = "http://localhost:8086"
token = "Ab123456#pwd"
org = "demo.net"
active = true