From 409d532ae084c222114248ba3f1a915a54cfd77a Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Mon, 7 Oct 2019 16:30:55 +0200 Subject: [PATCH] Fixed duplicate '__' in Perf Data output --- lib/core/tools/Format-IcingaPerfDataLabel.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/tools/Format-IcingaPerfDataLabel.psm1 b/lib/core/tools/Format-IcingaPerfDataLabel.psm1 index d28aaf1..c0bd663 100644 --- a/lib/core/tools/Format-IcingaPerfDataLabel.psm1 +++ b/lib/core/tools/Format-IcingaPerfDataLabel.psm1 @@ -4,6 +4,11 @@ function Format-IcingaPerfDataLabel() $PerfData ); + $Output = ((($PerfData) -Replace ' ', '_') -Replace '[\W]', ''); + + while ($Output.Contains('__')) { + $Output = $Output.Replace('__', '_'); + } # Remove all special characters and spaces on label names - return ((($PerfData) -Replace ' ', '_') -Replace '[\W]', ''); + return $Output; }