parent
e0938382b1
commit
97fb465c2d
|
|
@ -1,7 +1,7 @@
|
||||||
# systemd Units Input Plugin
|
# systemd Units Input Plugin
|
||||||
|
|
||||||
The systemd_units plugin gathers systemd unit status on Linux. It relies on
|
The systemd_units plugin gathers systemd unit status on Linux. It relies on
|
||||||
`systemctl list-units --all --type=service` to collect data on service status.
|
`systemctl list-units --all --plain --type=service` to collect data on service status.
|
||||||
|
|
||||||
The results are tagged with the unit name and provide enumerated fields for
|
The results are tagged with the unit name and provide enumerated fields for
|
||||||
loaded, active and running fields, indicating the unit health.
|
loaded, active and running fields, indicating the unit health.
|
||||||
|
|
|
||||||
|
|
@ -198,13 +198,13 @@ func setSystemctl(Timeout internal.Duration, UnitType string) (*bytes.Buffer, er
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(systemctlPath, "list-units", "--all", fmt.Sprintf("--type=%s", UnitType), "--no-legend")
|
cmd := exec.Command(systemctlPath, "list-units", "--all", "--plain", fmt.Sprintf("--type=%s", UnitType), "--no-legend")
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
err = internal.RunTimeout(cmd, Timeout.Duration)
|
err = internal.RunTimeout(cmd, Timeout.Duration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &out, fmt.Errorf("error running systemctl list-units --all --type=%s --no-legend: %s", UnitType, err)
|
return &out, fmt.Errorf("error running systemctl list-units --all --plain --type=%s --no-legend: %s", UnitType, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &out, nil
|
return &out, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue