From 25da17e3cbd65f04558dfce9c44a8e65e1c316b7 Mon Sep 17 00:00:00 2001 From: Adarsha Date: Fri, 18 Sep 2015 16:53:43 +0400 Subject: [PATCH] Avoid trailing and leading _ in column names --- Influxer/Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Influxer/Program.cs b/Influxer/Program.cs index 0389c94..5b61e99 100644 --- a/Influxer/Program.cs +++ b/Influxer/Program.cs @@ -305,14 +305,15 @@ private static async Task ProcessPerfMonLog(string InputFileName, HttpClie //get the column headers var column = 1; var influxIdentifiers = new char[]{' ',';','_','(',')','%'}; + var whiteSpace = new char[]{'_'}; pecrfCounters.AddRange (columns.Skip (1).Where (s => s.StartsWith ("\\")).Select (p => p.Replace (influxIdentifiers, "_").Split ('\\')).Select (p => new PerfmonCounter () { ColumnIndex = column++, - Host = p[2], - PerformanceObject = p[3], - CounterName = p[4] + Host = p[2].Trim(whiteSpace), + PerformanceObject = p[3].Trim(whiteSpace), + CounterName = p[4].Trim(whiteSpace) })); perfGourp = pecrfCounters.GroupBy (p => p.PerformanceObject);