Hello,
I checked the other related post on this Multiple telegraf configs but have an issue
- Have 2 telegraf configs under /etc/telegraf/telegraf.d – both are writing to 2 separate InfluxDB databases
- Standalone test in the foreground works fine. The below produces separate line protocol outputs (Perfect output)
telegraf --config /etc/telegraf/telegraf.d/telegraf.conf --config-directory /etc/telegraf/telegraf.d --test
telegraf --config /etc/telegraf/telegraf.d/network_telegraf.conf --config-directory /etc/telegraf/telegraf.d --test
- Created services in Ubuntu
Service One config
Description=The plugin-driven server agent for reporting metrics into InfluxDB
Documentation=GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.
After=network.target
[Service]
EnvironmentFile=-/etc/default/telegraf
User=telegraf
ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.d/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartForceExitStatus=SIGPIPE
KillMode=control-group
[Install]
WantedBy=multi-user.target
Service Two config
[Unit]
Description=The plugin-driven server agent for reporting metrics into InfluxDB
Documentation=GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.
After=network.target
[Service]
EnvironmentFile=-/etc/default/telegrafnetwork
User=telegraf
ExecStart=/usr/bin/telegraf -config /etc/telegraf/network_telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartForceExitStatus=SIGPIPE
KillMode=control-group
[Install]
WantedBy=multi-user.target
When I start Service-A, I can see data into both InfluxDB databases (duplicated)! Appreciate any assistance.
Start command: sudo systemctl start telegraf.service
Thanks, Kind regards