Unable to start telegraf service

I have installed telegraf under raspberry pi and I am trying to start telegraf service but it fails with the following error:

error loading config file /etc/telegraf/telegraf.conf: line 1: configuration specified the fields ["database" "password" "urls" "username"], but they weren't used

More details:

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION="11 (bullseye)"
pi@raspberrypi:~ $ sudo apt install telegraf
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
telegraf is already the newest version (1.28.1-1).
0 upgraded, 0 newly installed, 0 to remove and 105 not upgraded.
pi@raspberrypi:~ $ /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS
2023-09-20T14:46:16Z I! Loading config: /etc/telegraf/telegraf.conf
2023-09-20T14:46:16Z E! error loading config file /etc/telegraf/telegraf.conf: line 1: configuration specified the fields ["database" "password" "urls" "username"], but they weren't used
pi@raspberrypi:~ $ sudo systemctl start telegraf.service
Job for telegraf.service failed because the control process exited with error code.
See "systemctl status telegraf.service" and "journalctl -xe" for details.

Tried to follow this tutorial: Monitoring Raspberry Pi System using InfluxDB, Telegraf and Grafana

Do you have anything to suggest? Is there any better tutorial?

Attaching also the .conf file. Lines 1355~1361

your config has:

# [[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://"]
    urls = [""]
#   ## The target database for metrics; will be created as needed.
#   ## For UDP url endpoint database needs to be configured on server side.
    database = "telegraf"
    username = "database_user"
    password = "database_password"

You need to uncomment the first line I show above to enable the influxdb output.

1 Like

pfffff, you may close this! Thanks

1 Like