Telegraf - How to set DBUS_SESSION_BUS_ADDRESS

I have a warning regarding this env variable DBUS_SESSION_BUS_ADDRESS.
But couldn’t find how to set it in telegraf congif files to be sure that is set when is run as service.

Should it be set here?

/usr/lib/systemd/system/telegraf.service

[Unit]
Description=Telegraf
Documentation=https://github.com/influxdata/telegraf
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
NotifyAccess=all
EnvironmentFile=-/etc/default/telegraf
User=telegraf
ImportCredential=telegraf.*
#ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF_OPTS
ExecStart=/usr/bin/telegraf --config /home/paas/telegraf/telegraf.conf --config-directory /home/paas/telegraf/ $TELEGRAF_OPTS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartForceExitStatus=SIGPIPE
KillMode=mixed
LimitMEMLOCK=8M:8M
PrivateMounts=true

[Install]
WantedBy=multi-user.target

Thanks!

Hi,

I have a warning regarding this env variable DBUS_SESSION_BUS_ADDRESS.

As the full warning message says it can be fixed by setting the environment variable to either the correct bus or to /dev/null.

The EnvironmentFile service variable points to a file that is read in by the Telegraf service each time it starts for environment settings. You can add it to that file with the value and appropriate setting.

Here is the issue we are using to track this: Telegraf Generating Orphaned DBus Processes on RHEL Servers #2 · Issue #13635 · influxdata/telegraf · GitHub

That confirmation was what I needed.
Thanks!

1 Like