From 558ab0c730de439f879b220c335f2ae737421f26 Mon Sep 17 00:00:00 2001 From: Mark Wilkinson - m82labs Date: Thu, 14 Sep 2017 18:04:13 -0400 Subject: [PATCH] Fix duplicate keys in perf counters sqlserver query (#3175) (cherry picked from commit 1c5ebd4be3673a8d5f14642d5efc81b5da08dcc3) --- plugins/inputs/sqlserver/sqlserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index ed3216258..2bc33a54a 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -1022,7 +1022,7 @@ CREATE TABLE #PCounters Primary Key(object_name, counter_name, instance_name) ); INSERT #PCounters -SELECT RTrim(spi.object_name) object_name +SELECT DISTINCT RTrim(spi.object_name) object_name , RTrim(spi.counter_name) counter_name , RTrim(spi.instance_name) instance_name , spi.cntr_value @@ -1044,7 +1044,7 @@ CREATE TABLE #CCounters Primary Key(object_name, counter_name, instance_name) ); INSERT #CCounters -SELECT RTrim(spi.object_name) object_name +SELECT DISTINCT RTrim(spi.object_name) object_name , RTrim(spi.counter_name) counter_name , RTrim(spi.instance_name) instance_name , spi.cntr_value