From 05ed62fda1ae90289514fbc48f603c4ec081b097 Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Sat, 7 Dec 2024 18:13:41 +0100 Subject: [PATCH] Fix debian errors --- collector/apt/apt.go | 6 ++++-- collector/systemd/systemd.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/collector/apt/apt.go b/collector/apt/apt.go index 40d4ac9..b0cf396 100644 --- a/collector/apt/apt.go +++ b/collector/apt/apt.go @@ -33,7 +33,8 @@ func (c *AptCollector) updateInstalledPackages() error { return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out)) } - c.installedPackages = len(strings.Split(strings.TrimSpace(string(out)), "\n")) + // remove the unstable interface warning + c.installedPackages = len(strings.Split(strings.TrimSpace(string(out)), "\n")) - 3 return nil } @@ -50,7 +51,8 @@ func (c *AptCollector) updatePendingUpdates() error { return fmt.Errorf("failed to run apt list: %w (%s)", err, string(out)) } - c.pendingUpdates = len(strings.Split(strings.TrimSpace(string(out)), "\n")) + // remove the unstable interface warning + c.pendingUpdates = len(strings.Split(strings.TrimSpace(string(out)), "\n")) - 3 return nil } diff --git a/collector/systemd/systemd.go b/collector/systemd/systemd.go index af7e488..e1f4d74 100644 --- a/collector/systemd/systemd.go +++ b/collector/systemd/systemd.go @@ -41,7 +41,7 @@ func (c *SystemdCollector) Collect() interface{} { } func (c *SystemdCollector) getServicesStatus() ([]serviceStatus, error) { - out, err := exec.Command("/sbin/systemctl", "list-units", "--output", "json").CombinedOutput() + out, err := exec.Command("/usr/bin/systemctl", "list-units", "--output", "json").CombinedOutput() if err != nil { return nil, fmt.Errorf("failed to run systemd command: %w", err) }