From 025b2e15c35d08f966e7615317a1948cd9880894 Mon Sep 17 00:00:00 2001 From: Frikky Date: Sun, 22 Oct 2023 20:40:42 +0200 Subject: [PATCH] Only checking running containers --- functions/onprem/orborus/orborus.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 51541037..52fd4948 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -972,9 +972,8 @@ func parseResourceUsage(body io.Reader) (float64, float64, error) { return 0, 0, err } - log.Printf("[DEBUG] CPU : %d", stats.CPUStats.CPUUsage.TotalUsage) - log.Printf("[DEBUG] CPU2: %d", stats.PreCPUStats.CPUUsage.TotalUsage) - + //log.Printf("[DEBUG] CPU : %d", stats.CPUStats.CPUUsage.TotalUsage) + //log.Printf("[DEBUG] CPU2: %d", stats.PreCPUStats.CPUUsage.TotalUsage) if stats.CPUStats.CPUUsage.TotalUsage == 0 || stats.PreCPUStats.CPUUsage.TotalUsage == 0 { log.Printf("[DEBUG] BODY: %#v", stats) } @@ -1055,6 +1054,11 @@ func getOrborusStats() shuffle.OrborusStats { // Iterate through containers and start a goroutine for each container for _, container := range containers { + // Check if container is running + if container.State != "running" { + continue + } + wg.Add(1) go func(container types.Container) { defer wg.Done()