I recently installed Telegraf (version Telegraf 1.34.1) on my Raspberry Pi and tried to start it using:
sudo systemctl start telegraf
However, when I check its status, I see that the service has failed to start:
sudo systemctl status telegraf
telegraf.service - Telegraf
Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; p>
Active: failed (Result: exit-code) since Thu 2025-03-27 15:47:41>
Duration: 79ms
Docs: GitHub - influxdata/telegraf: Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
Process: 3012 ExecStart=/usr/bin/telegraf -config /etc/telegraf/t>
Main PID: 3012 (code=exited, status=2)
CPU: 100ms
Mar 27 15:47:41 pi5-pune-06 systemd[1]: telegraf.service: Scheduled r>
Mar 27 15:47:41 pi5-pune-06 systemd[1]: Stopped telegraf.service - Te>
Mar 27 15:47:41 pi5-pune-06 systemd[1]: telegraf.service: Start reque>
Mar 27 15:47:41 pi5-pune-06 systemd[1]: telegraf.service: Failed with>
Mar 27 15:47:41 pi5-pune-06 systemd[1]: Failed to start telegraf.serv>
telegraf.conf
# Global tags to identify the Raspberry Pi in InfluxDB
[global_tags]
device = "raspberry_pi_06" # Tag to identify this device (for easy identification in InfluxDB)
location = "office" # Specify the location of the device (optional)
environment = "dev" # Add an environment tag to distinguish between dev, prod, etc. (optional)
# Telegraf agent configuration
[agent]
interval = "60s" # How often to gather metrics (every 60 seconds)
flush_interval = "10s" # Interval to flush data to InfluxDB (every 10 seconds)
hostname = "pi5-pune-06" # Hostname of the Raspberry Pi (useful for identifying the device)
buffer_strategy = "disk"
metric_buffer_limit = 0
[[outputs.influxdb_v2]]
urls = <influx_db_url>
token = <inlflux_db_token>
organization = "organization"
bucket = "bucket"
# Input plugins: System metrics
[[inputs.cpu]]
percpu = true # Collect CPU usage for each individual core (useful for multi-core systems)
totalcpu = true # Collect total CPU usage (overall CPU usage)
[[inputs.mem]]
# Collect system memory usage, including total, used, and free memory statistics.
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs"] # Exclude temporary filesystems from disk usage metrics
mount_points = ["/", "/boot"] # Focus on the root ("/") and boot partitions for disk metrics
[[inputs.net]]
interfaces = ["eth0", "wlan0"] # Collect network statistics from both Ethernet (eth0) and Wi-Fi (wlan0) interfaces
When I do sudo journalctl -u telegraf -f
I am getting
Mar 27 17:36:28 pi5-06 telegraf[3465]: main.main()
Mar 27 17:36:28 pi5-06 telegraf[3465]: /go/src/github.com/influxdata/telegraf/cmd/telegraf/main.go:414 +0xf0
Mar 27 17:36:28 pi5-06 systemd[1]: telegraf.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 27 17:36:28 pi5-06 systemd[1]: telegraf.service: Killing process 3478 (dbus-daemon) with signal SIGKILL.
Mar 27 17:36:28 pi5-06 systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Mar 27 17:36:28 pi5-pune-06 systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
Mar 27 17:36:28 pi5-06 systemd[1]: Stopped telegraf.service - Telegraf.
Mar 27 17:36:28 pi5-06 systemd[1]: telegraf.service: Start request repeated too quickly.
Mar 27 17:36:28 pi5-06 systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Mar 27 17:36:28 pi5-06 systemd[1]: Failed to start telegraf.service - Telegraf.