From 9540846a21b24c28d05c0ec4885800a50ac09097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Tue, 3 Dec 2024 13:29:14 +0100 Subject: [PATCH 1/2] Remove duplicated Output --- cmd/datastore.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/datastore.go b/cmd/datastore.go index e3504da..c812566 100644 --- a/cmd/datastore.go +++ b/cmd/datastore.go @@ -132,7 +132,6 @@ func queryDatastores() { // Calculate results and add perf data to list. perfData, state := processQueryResults(datastoreName, capacity, freeSpace) - pl.Add(&perfData) // Create PartialResult and add to Overall result. pr := result.PartialResult{ @@ -141,15 +140,14 @@ func queryDatastores() { if err = pr.SetState(state); err != nil { check.ExitError(err) } + pr.Perfdata.Add(&perfData) aggregatedResult.AddSubcheck(pr) } dbConnection.Close() - fmt.Printf("%s | %s\n\n", aggregatedResult.GetOutput(), pl.String()) - - check.ExitRaw(aggregatedResult.GetStatus(), aggregatedResult.GetOutput()+" | "+pl.String()) // ExitRaw because of 'nested formatting issues' otherwise. + check.ExitRaw(aggregatedResult.GetStatus(), aggregatedResult.GetOutput()) // ExitRaw because of 'nested formatting issues' otherwise. } // Computes Perfdata, check result based on the queried data. From 15ce1bbd22e4a662ff8fd8391ea06945c7185a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Tue, 3 Dec 2024 13:48:21 +0100 Subject: [PATCH 2/2] Linter fix --- cmd/datastore.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/datastore.go b/cmd/datastore.go index c812566..47f3bc2 100644 --- a/cmd/datastore.go +++ b/cmd/datastore.go @@ -140,6 +140,7 @@ func queryDatastores() { if err = pr.SetState(state); err != nil { check.ExitError(err) } + pr.Perfdata.Add(&perfData) aggregatedResult.AddSubcheck(pr)