Skip to content

Commit

Permalink
Re-order checks
Browse files Browse the repository at this point in the history
See: DataDog/dd-agent#3860

The default systemd socket is a private API not intended for external use. For this reason, processes must be run as root to access them, and therefore this is typically very unlikely to work as the agent does not run as root by default. We re-order the checks to try dbus first which is far more likely to succeed.

This has the benefit of not causing extensive logging is syslog for failed connections due to insufficient permissions.


Co-authored-by: Alistair Lynn <[email protected]>
  • Loading branch information
danpalmer and prophile authored Oct 29, 2019
1 parent 3a0c649 commit bbea2c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/collector/corechecks/systemd/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ func (c *SystemdCheck) getDbusConnection() (*dbus.Conn, error) {
if config.IsContainerized() {
conn, err = c.getPrivateSocketConnection("/host" + defaultPrivateSocket)
} else {
conn, err = c.getPrivateSocketConnection(defaultPrivateSocket)
conn, err = c.getSystemBusSocketConnection()
if err != nil {
conn, err = c.getSystemBusSocketConnection()
conn, err = c.getPrivateSocketConnection(defaultPrivateSocket)
}
}
}
Expand Down

0 comments on commit bbea2c6

Please sign in to comment.