Filter out uninstalled systemd units when collecting all units (#1011)

fixes #567

Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
This commit is contained in:
xginn8 2018-07-22 03:20:03 -04:00 committed by Ben Kochie
parent 2ae8c1c7a7
commit 140b8b85c3
2 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,7 @@
**Breaking changes**
* [CHANGE]
* [CHANGE] Filter out non-installed units when collecting all systemd units #1011
* [FEATURE] Collect NRefused property for systemd socket units (available as of systemd v239)
* [FEATURE] Collect NRestarts property for systemd service units
* [FEATURE] Add socket unit stats to systemd collector #968

View File

@ -227,7 +227,9 @@ func (c *systemdCollector) getAllUnits() ([]unit, error) {
}
defer conn.Close()
allUnits, err := conn.ListUnits()
// Filter out any units that are not installed and are pulled in only as dependencies.
allUnits, err := conn.ListUnitsFiltered([]string{"loaded"})
if err != nil {
return nil, err
}