mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-28 06:59:44 -08:00
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:
parent
2ae8c1c7a7
commit
140b8b85c3
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
**Breaking changes**
|
**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 NRefused property for systemd socket units (available as of systemd v239)
|
||||||
* [FEATURE] Collect NRestarts property for systemd service units
|
* [FEATURE] Collect NRestarts property for systemd service units
|
||||||
* [FEATURE] Add socket unit stats to systemd collector #968
|
* [FEATURE] Add socket unit stats to systemd collector #968
|
||||||
|
|
|
@ -227,7 +227,9 @@ func (c *systemdCollector) getAllUnits() ([]unit, error) {
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue