summaryrefslogtreecommitdiff
path: root/internal/collector/collector.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-14 17:29:08 +0200
committerPaul Buetow <paul@buetow.org>2026-02-14 17:29:08 +0200
commitb1f0ce01fb6ece8628cf0499690a003cdac28f7f (patch)
treece67d7633075743cd057031c21dca81834494be8 /internal/collector/collector.go
parentef236805d7c7f655ef22da08d708ecb85212c15c (diff)
Remove macOS stats gathering support, require Linux with /procv0.8.4
Remove non-functional macOS monitoring code that used native tools (sysctl, vm_stat, netstat, iostat). Now loadbars exits with an error when attempting local stats gathering on non-Linux systems. macOS can still be used as a client to monitor remote Linux servers via SSH.
Diffstat (limited to 'internal/collector/collector.go')
-rw-r--r--internal/collector/collector.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/collector/collector.go b/internal/collector/collector.go
index cab9df0..91f3d7b 100644
--- a/internal/collector/collector.go
+++ b/internal/collector/collector.go
@@ -25,13 +25,16 @@ type StatsStore interface {
// The script is embedded in the binary; no external script file is required.
func Run(ctx context.Context, host string, cfg *config.Config, store StatsStore) error {
hostKey, user := splitHostUser(host)
-
- // Select script: Darwin for localhost on macOS, Linux for everything else (all remotes are Linux)
+
+ // Select script: Only Linux supported for local monitoring
scriptBytes := LinuxScript
if isLocal(hostKey) {
scriptBytes = getLocalScript()
+ if scriptBytes == nil {
+ return fmt.Errorf("%s: local stats gathering requires Linux with /proc filesystem", hostKey)
+ }
}
-
+
script := bytes.NewReader(scriptBytes)
var scanner *bufio.Scanner
if isLocal(hostKey) {
@@ -135,6 +138,6 @@ func getLocalScript() []byte {
if _, err := exec.Command("test", "-d", "/proc").CombinedOutput(); err == nil {
return LinuxScript
}
- // Otherwise assume macOS
- return DarwinScript
+ // /proc not found - unsupported OS for local stats gathering
+ return nil
}