diff --git a/plugins/inputs/sqlserver/azuresqlqueries.go b/plugins/inputs/sqlserver/azuresqlqueries.go index 3ea95b956..fa4eb1977 100644 --- a/plugins/inputs/sqlserver/azuresqlqueries.go +++ b/plugins/inputs/sqlserver/azuresqlqueries.go @@ -432,100 +432,101 @@ WITH PerfCounters AS ( END WHERE counter_name IN ( - ''SQL Compilations/sec'' - ,''SQL Re-Compilations/sec'' - ,''User Connections'' - ,''Batch Requests/sec'' - ,''Logouts/sec'' - ,''Logins/sec'' - ,''Processes blocked'' - ,''Latch Waits/sec'' - ,''Full Scans/sec'' - ,''Index Searches/sec'' - ,''Page Splits/sec'' - ,''Page lookups/sec'' - ,''Page reads/sec'' - ,''Page writes/sec'' - ,''Readahead pages/sec'' - ,''Lazy writes/sec'' - ,''Checkpoint pages/sec'' - ,''Page life expectancy'' - ,''Log File(s) Size (KB)'' - ,''Log File(s) Used Size (KB)'' - ,''Data File(s) Size (KB)'' - ,''Transactions/sec'' - ,''Write Transactions/sec'' - ,''Active Temp Tables'' - ,''Temp Tables Creation Rate'' - ,''Temp Tables For Destruction'' - ,''Free Space in tempdb (KB)'' - ,''Version Store Size (KB)'' - ,''Memory Grants Pending'' - ,''Memory Grants Outstanding'' - ,''Free list stalls/sec'' - ,''Buffer cache hit ratio'' - ,''Buffer cache hit ratio base'' - ,''Backup/Restore Throughput/sec'' - ,''Total Server Memory (KB)'' - ,''Target Server Memory (KB)'' - ,''Log Flushes/sec'' - ,''Log Flush Wait Time'' - ,''Memory broker clerk size'' - ,''Log Bytes Flushed/sec'' - ,''Bytes Sent to Replica/sec'' - ,''Log Send Queue'' - ,''Bytes Sent to Transport/sec'' - ,''Sends to Replica/sec'' - ,''Bytes Sent to Transport/sec'' - ,''Sends to Transport/sec'' - ,''Bytes Received from Replica/sec'' - ,''Receives from Replica/sec'' - ,''Flow Control Time (ms/sec)'' - ,''Flow Control/sec'' - ,''Resent Messages/sec'' - ,''Redone Bytes/sec'' - ,''XTP Memory Used (KB)'' - ,''Transaction Delay'' - ,''Log Bytes Received/sec'' - ,''Log Apply Pending Queue'' - ,''Redone Bytes/sec'' - ,''Recovery Queue'' - ,''Log Apply Ready Queue'' - ,''CPU usage %'' - ,''CPU usage % base'' - ,''Queued requests'' - ,''Requests completed/sec'' - ,''Blocked tasks'' - ,''Active memory grant amount (KB)'' - ,''Disk Read Bytes/sec'' - ,''Disk Read IO Throttled/sec'' - ,''Disk Read IO/sec'' - ,''Disk Write Bytes/sec'' - ,''Disk Write IO Throttled/sec'' - ,''Disk Write IO/sec'' - ,''Used memory (KB)'' - ,''Forwarded Records/sec'' - ,''Background Writer pages/sec'' - ,''Percent Log Used'' - ,''Log Send Queue KB'' - ,''Redo Queue KB'' - ,''Mirrored Write Transactions/sec'' - ,''Group Commit Time'' - ,''Group Commits/Sec'' + 'SQL Compilations/sec' + ,'SQL Re-Compilations/sec' + ,'User Connections' + ,'Batch Requests/sec' + ,'Logouts/sec' + ,'Logins/sec' + ,'Processes blocked' + ,'Latch Waits/sec' + ,'Full Scans/sec' + ,'Index Searches/sec' + ,'Page Splits/sec' + ,'Page lookups/sec' + ,'Page reads/sec' + ,'Page writes/sec' + ,'Readahead pages/sec' + ,'Lazy writes/sec' + ,'Checkpoint pages/sec' + ,'Page life expectancy' + ,'Log File(s) Size (KB)' + ,'Log File(s) Used Size (KB)' + ,'Data File(s) Size (KB)' + ,'Transactions/sec' + ,'Write Transactions/sec' + ,'Active Temp Tables' + ,'Temp Tables Creation Rate' + ,'Temp Tables For Destruction' + ,'Free Space in tempdb (KB)' + ,'Version Store Size (KB)' + ,'Memory Grants Pending' + ,'Memory Grants Outstanding' + ,'Free list stalls/sec' + ,'Buffer cache hit ratio' + ,'Buffer cache hit ratio base' + ,'Backup/Restore Throughput/sec' + ,'Total Server Memory (KB)' + ,'Target Server Memory (KB)' + ,'Log Flushes/sec' + ,'Log Flush Wait Time' + ,'Memory broker clerk size' + ,'Log Bytes Flushed/sec' + ,'Bytes Sent to Replica/sec' + ,'Log Send Queue' + ,'Bytes Sent to Transport/sec' + ,'Sends to Replica/sec' + ,'Bytes Sent to Transport/sec' + ,'Sends to Transport/sec' + ,'Bytes Received from Replica/sec' + ,'Receives from Replica/sec' + ,'Flow Control Time (ms/sec)' + ,'Flow Control/sec' + ,'Resent Messages/sec' + ,'Redone Bytes/sec' + ,'XTP Memory Used (KB)' + ,'Transaction Delay' + ,'Log Bytes Received/sec' + ,'Log Apply Pending Queue' + ,'Redone Bytes/sec' + ,'Recovery Queue' + ,'Log Apply Ready Queue' + ,'CPU usage %' + ,'CPU usage % base' + ,'Queued requests' + ,'Requests completed/sec' + ,'Blocked tasks' + ,'Active memory grant amount (KB)' + ,'Disk Read Bytes/sec' + ,'Disk Read IO Throttled/sec' + ,'Disk Read IO/sec' + ,'Disk Write Bytes/sec' + ,'Disk Write IO Throttled/sec' + ,'Disk Write IO/sec' + ,'Used memory (KB)' + ,'Forwarded Records/sec' + ,'Background Writer pages/sec' + ,'Percent Log Used' + ,'Log Send Queue KB' + ,'Redo Queue KB' + ,'Mirrored Write Transactions/sec' + ,'Group Commit Time' + ,'Group Commits/Sec' ) OR ( - spi.[object_name] LIKE ''%User Settable%'' - OR spi.[object_name] LIKE ''%SQL Errors%'' - OR spi.[object_name] LIKE ''%Batch Resp Statistics%'' + spi.[object_name] LIKE '%User Settable%' + OR spi.[object_name] LIKE '%SQL Errors%' + OR spi.[object_name] LIKE '%Batch Resp Statistics%' ) OR ( - spi.[instance_name] IN (''_Total'') + spi.[instance_name] IN ('_Total') AND spi.[counter_name] IN ( - ''Lock Timeouts/sec'' - ,''Lock Timeouts (timeout > 0)/sec'' - ,''Number of Deadlocks/sec'' - ,''Lock Waits/sec'' - ,''Latch Waits/sec'' + 'Lock Timeouts/sec' + ,'Lock Timeouts (timeout > 0)/sec' + ,'Number of Deadlocks/sec' + ,'Lock Waits/sec' + ,'Latch Waits/sec' ) ) +) INSERT INTO @PCounters select * from PerfCounters @@ -539,7 +540,7 @@ SELECT WHEN '_Total' THEN 'Total' ELSE ISNULL(pc.[instance_name],'') END AS [instance] - ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value], + ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value] ,cast(pc.[cntr_type] as varchar(25)) as [counter_type] from @PCounters pc LEFT OUTER JOIN @PCounters AS pc1 @@ -954,100 +955,101 @@ WITH PerfCounters AS ( END WHERE counter_name IN ( - ''SQL Compilations/sec'' - ,''SQL Re-Compilations/sec'' - ,''User Connections'' - ,''Batch Requests/sec'' - ,''Logouts/sec'' - ,''Logins/sec'' - ,''Processes blocked'' - ,''Latch Waits/sec'' - ,''Full Scans/sec'' - ,''Index Searches/sec'' - ,''Page Splits/sec'' - ,''Page lookups/sec'' - ,''Page reads/sec'' - ,''Page writes/sec'' - ,''Readahead pages/sec'' - ,''Lazy writes/sec'' - ,''Checkpoint pages/sec'' - ,''Page life expectancy'' - ,''Log File(s) Size (KB)'' - ,''Log File(s) Used Size (KB)'' - ,''Data File(s) Size (KB)'' - ,''Transactions/sec'' - ,''Write Transactions/sec'' - ,''Active Temp Tables'' - ,''Temp Tables Creation Rate'' - ,''Temp Tables For Destruction'' - ,''Free Space in tempdb (KB)'' - ,''Version Store Size (KB)'' - ,''Memory Grants Pending'' - ,''Memory Grants Outstanding'' - ,''Free list stalls/sec'' - ,''Buffer cache hit ratio'' - ,''Buffer cache hit ratio base'' - ,''Backup/Restore Throughput/sec'' - ,''Total Server Memory (KB)'' - ,''Target Server Memory (KB)'' - ,''Log Flushes/sec'' - ,''Log Flush Wait Time'' - ,''Memory broker clerk size'' - ,''Log Bytes Flushed/sec'' - ,''Bytes Sent to Replica/sec'' - ,''Log Send Queue'' - ,''Bytes Sent to Transport/sec'' - ,''Sends to Replica/sec'' - ,''Bytes Sent to Transport/sec'' - ,''Sends to Transport/sec'' - ,''Bytes Received from Replica/sec'' - ,''Receives from Replica/sec'' - ,''Flow Control Time (ms/sec)'' - ,''Flow Control/sec'' - ,''Resent Messages/sec'' - ,''Redone Bytes/sec'' - ,''XTP Memory Used (KB)'' - ,''Transaction Delay'' - ,''Log Bytes Received/sec'' - ,''Log Apply Pending Queue'' - ,''Redone Bytes/sec'' - ,''Recovery Queue'' - ,''Log Apply Ready Queue'' - ,''CPU usage %'' - ,''CPU usage % base'' - ,''Queued requests'' - ,''Requests completed/sec'' - ,''Blocked tasks'' - ,''Active memory grant amount (KB)'' - ,''Disk Read Bytes/sec'' - ,''Disk Read IO Throttled/sec'' - ,''Disk Read IO/sec'' - ,''Disk Write Bytes/sec'' - ,''Disk Write IO Throttled/sec'' - ,''Disk Write IO/sec'' - ,''Used memory (KB)'' - ,''Forwarded Records/sec'' - ,''Background Writer pages/sec'' - ,''Percent Log Used'' - ,''Log Send Queue KB'' - ,''Redo Queue KB'' - ,''Mirrored Write Transactions/sec'' - ,''Group Commit Time'' - ,''Group Commits/Sec'' + 'SQL Compilations/sec' + ,'SQL Re-Compilations/sec' + ,'User Connections' + ,'Batch Requests/sec' + ,'Logouts/sec' + ,'Logins/sec' + ,'Processes blocked' + ,'Latch Waits/sec' + ,'Full Scans/sec' + ,'Index Searches/sec' + ,'Page Splits/sec' + ,'Page lookups/sec' + ,'Page reads/sec' + ,'Page writes/sec' + ,'Readahead pages/sec' + ,'Lazy writes/sec' + ,'Checkpoint pages/sec' + ,'Page life expectancy' + ,'Log File(s) Size (KB)' + ,'Log File(s) Used Size (KB)' + ,'Data File(s) Size (KB)' + ,'Transactions/sec' + ,'Write Transactions/sec' + ,'Active Temp Tables' + ,'Temp Tables Creation Rate' + ,'Temp Tables For Destruction' + ,'Free Space in tempdb (KB)' + ,'Version Store Size (KB)' + ,'Memory Grants Pending' + ,'Memory Grants Outstanding' + ,'Free list stalls/sec' + ,'Buffer cache hit ratio' + ,'Buffer cache hit ratio base' + ,'Backup/Restore Throughput/sec' + ,'Total Server Memory (KB)' + ,'Target Server Memory (KB)' + ,'Log Flushes/sec' + ,'Log Flush Wait Time' + ,'Memory broker clerk size' + ,'Log Bytes Flushed/sec' + ,'Bytes Sent to Replica/sec' + ,'Log Send Queue' + ,'Bytes Sent to Transport/sec' + ,'Sends to Replica/sec' + ,'Bytes Sent to Transport/sec' + ,'Sends to Transport/sec' + ,'Bytes Received from Replica/sec' + ,'Receives from Replica/sec' + ,'Flow Control Time (ms/sec)' + ,'Flow Control/sec' + ,'Resent Messages/sec' + ,'Redone Bytes/sec' + ,'XTP Memory Used (KB)' + ,'Transaction Delay' + ,'Log Bytes Received/sec' + ,'Log Apply Pending Queue' + ,'Redone Bytes/sec' + ,'Recovery Queue' + ,'Log Apply Ready Queue' + ,'CPU usage %' + ,'CPU usage % base' + ,'Queued requests' + ,'Requests completed/sec' + ,'Blocked tasks' + ,'Active memory grant amount (KB)' + ,'Disk Read Bytes/sec' + ,'Disk Read IO Throttled/sec' + ,'Disk Read IO/sec' + ,'Disk Write Bytes/sec' + ,'Disk Write IO Throttled/sec' + ,'Disk Write IO/sec' + ,'Used memory (KB)' + ,'Forwarded Records/sec' + ,'Background Writer pages/sec' + ,'Percent Log Used' + ,'Log Send Queue KB' + ,'Redo Queue KB' + ,'Mirrored Write Transactions/sec' + ,'Group Commit Time' + ,'Group Commits/Sec' ) OR ( - spi.[object_name] LIKE ''%User Settable%'' - OR spi.[object_name] LIKE ''%SQL Errors%'' - OR spi.[object_name] LIKE ''%Batch Resp Statistics%'' + spi.[object_name] LIKE '%User Settable%' + OR spi.[object_name] LIKE '%SQL Errors%' + OR spi.[object_name] LIKE '%Batch Resp Statistics%' ) OR ( - spi.[instance_name] IN (''_Total'') + spi.[instance_name] IN ('_Total') AND spi.[counter_name] IN ( - ''Lock Timeouts/sec'' - ,''Lock Timeouts (timeout > 0)/sec'' - ,''Number of Deadlocks/sec'' - ,''Lock Waits/sec'' - ,''Latch Waits/sec'' + 'Lock Timeouts/sec' + ,'Lock Timeouts (timeout > 0)/sec' + ,'Number of Deadlocks/sec' + ,'Lock Waits/sec' + ,'Latch Waits/sec' ) ) +) INSERT INTO @PCounters select * from PerfCounters @@ -1060,7 +1062,7 @@ SELECT WHEN '_Total' THEN 'Total' ELSE ISNULL(pc.[instance_name],'') END AS [instance] - ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value], + ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value] ,cast(pc.[cntr_type] as varchar(25)) as [counter_type] from @PCounters pc LEFT OUTER JOIN @PCounters AS pc1