Skip to content

Commit

Permalink
Filter out uninstalled systemd units when collecting all units (prome…
Browse files Browse the repository at this point in the history
…theus#1011)

fixes prometheus#567

Signed-off-by: Matthew McGinn <[email protected]>
  • Loading branch information
xginn8 authored and SuperQ committed Jul 22, 2018
1 parent 2ae8c1c commit 140b8b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion collector/systemd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 140b8b8

Please sign in to comment.