Update sqlserver readme; enable query_version = 2 in default config
If unset, query_version is still treated as version 1 for compatibility.
This commit is contained in:
parent
426360d61f
commit
8c8c9200e7
|
@ -1,11 +1,13 @@
|
||||||
# SQL Server plugin
|
# SQL Server Input Plugin
|
||||||
|
|
||||||
This sqlserver plugin provides metrics for your SQL Server instance. It currently works with SQL Server versions 2008+. Recorded metrics are lightweight and use Dynamic Management Views supplied by SQL Server.
|
The `sqlserver` plugin provides metrics for your SQL Server instance. It
|
||||||
|
currently works with SQL Server versions 2008+. Recorded metrics are
|
||||||
|
lightweight and use Dynamic Management Views supplied by SQL Server.
|
||||||
|
|
||||||
## Getting started :
|
### Additional Setup:
|
||||||
|
|
||||||
You have to create a login on every instance you want to monitor, with following script:
|
You have to create a login on every instance you want to monitor, with following script:
|
||||||
```SQL
|
```sql
|
||||||
USE master;
|
USE master;
|
||||||
GO
|
GO
|
||||||
CREATE LOGIN [telegraf] WITH PASSWORD = N'mystrongpassword';
|
CREATE LOGIN [telegraf] WITH PASSWORD = N'mystrongpassword';
|
||||||
|
@ -16,79 +18,81 @@ GRANT VIEW ANY DEFINITION TO [telegraf];
|
||||||
GO
|
GO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuration:
|
||||||
|
|
||||||
## Configuration:
|
```toml
|
||||||
|
|
||||||
```
|
|
||||||
# Read metrics from Microsoft SQL Server
|
# Read metrics from Microsoft SQL Server
|
||||||
[[inputs.sqlserver]]
|
[[inputs.sqlserver]]
|
||||||
# Specify instances to monitor with a list of connection strings.
|
## Specify instances to monitor with a list of connection strings.
|
||||||
# All connection parameters are optional.
|
## All connection parameters are optional.
|
||||||
# By default, the host is localhost, listening on default port, TCP 1433.
|
## By default, the host is localhost, listening on default port, TCP 1433.
|
||||||
# for Windows, the user is the currently running AD user (SSO).
|
## for Windows, the user is the currently running AD user (SSO).
|
||||||
# See https://github.com/denisenkom/go-mssqldb for detailed connection
|
## See https://github.com/denisenkom/go-mssqldb for detailed connection
|
||||||
# parameters.
|
## parameters.
|
||||||
servers = [
|
# servers = [
|
||||||
"Server=192.168.1.10;Port=1433;User Id=<user>;Password=<pw>;app name=telegraf;log=1;",
|
# "Server=192.168.1.10;Port=1433;User Id=<user>;Password=<pw>;app name=telegraf;log=1;",
|
||||||
]
|
# ]
|
||||||
|
|
||||||
# Optional parameter, setting this to 2 will use a new version
|
## Optional parameter, setting this to 2 will use a new version
|
||||||
# of the collection queries that break compatibility with the original
|
## of the collection queries that break compatibility with the original
|
||||||
# dashboards.
|
## dashboards.
|
||||||
query_version = 2
|
query_version = 2
|
||||||
# If you are using AzureDB, setting this to True will gather resource utilization metrics
|
|
||||||
azuredb = False
|
## If you are using AzureDB, setting this to true will gather resource utilization metrics
|
||||||
# If you would like to exclude some of the metrics queries, list them here
|
# azuredb = false
|
||||||
# Possible choices:
|
|
||||||
# - PerformanceCounters
|
## If you would like to exclude some of the metrics queries, list them here
|
||||||
# - WaitStatsCategorized
|
## Possible choices:
|
||||||
# - DatabaseIO
|
## - PerformanceCounters
|
||||||
# - DatabaseProperties
|
## - WaitStatsCategorized
|
||||||
# - CPUHistory
|
## - DatabaseIO
|
||||||
# - DatabaseSize
|
## - DatabaseProperties
|
||||||
# - DatabaseStats
|
## - CPUHistory
|
||||||
# - MemoryClerk
|
## - DatabaseSize
|
||||||
# - VolumeSpace
|
## - DatabaseStats
|
||||||
# - PerformanceMetrics
|
## - MemoryClerk
|
||||||
exclude_query = [ 'PerformanceCounters','WaitStatsCatagorized' ]
|
## - VolumeSpace
|
||||||
|
## - PerformanceMetrics
|
||||||
|
# exclude_query = [ 'PerformanceCounters','WaitStatsCatagorized' ]
|
||||||
```
|
```
|
||||||
|
|
||||||
# Metrics Collected
|
### Metrics:
|
||||||
To provide backwards compatibility, this plugin support two versions of metrics queries.
|
To provide backwards compatibility, this plugin support two versions of metrics queries.
|
||||||
|
|
||||||
The original metrics queries provide:
|
|
||||||
* *Performance counters*: 1000+ metrics from `sys.dm_os_performance_counters`
|
|
||||||
* *Performance metrics*: special performance and ratio metrics
|
|
||||||
* *Wait stats*: wait tasks categorized from `sys.dm_os_wait_stats`
|
|
||||||
* *Memory clerk*: memory breakdown from `sys.dm_os_memory_clerks`
|
|
||||||
* *Database size*: databases size trend from `sys.dm_io_virtual_file_stats`
|
|
||||||
* *Database IO*: databases I/O from `sys.dm_io_virtual_file_stats`
|
|
||||||
* *Database latency*: databases latency from `sys.dm_io_virtual_file_stats`
|
|
||||||
* *Database properties*: databases properties, state and recovery model, from `sys.databases`
|
|
||||||
* *OS Volume*: available, used and total space from `sys.dm_os_volume_stats`
|
|
||||||
* *CPU*: cpu usage from `sys.dm_os_ring_buffers`
|
|
||||||
|
|
||||||
The new (version 2) metrics provide:
|
|
||||||
* *AzureDB*: AzureDB resource utilization from `sys.dm_db_resource_stats`
|
|
||||||
* *Database IO*: IO stats from `sys.dm_io_virtual_file_stats`
|
|
||||||
* *Memory Clerk*: Memory clerk breakdown from `sys.dm_os_memory_clerks`, most clerks have been given a friendly name.
|
|
||||||
* *Performance Counters*: A select list of performance counters from `sys.dm_os_performance_counters`. Some of the important metrics included:
|
|
||||||
* *Activity*: Transactions/sec/database, Batch requests/sec, blocked processes, + more
|
|
||||||
* *Availability Groups*: Bytes sent to replica, Bytes received from replica, Log bytes received, Log send queue, transaction delay, + more
|
|
||||||
* *Log activity*: Log bytes flushed/sec, Log flushes/sec, Log Flush Wait Time
|
|
||||||
* *Memory*: PLE, Page reads/sec, Page writes/sec, + more
|
|
||||||
* *TempDB*: Free space, Version store usage, Active temp tables, temp table creation rate, + more
|
|
||||||
* *Resource Governor*: CPU Usage, Requests/sec, Queued Requests, and Blocked tasks per workload group
|
|
||||||
* *Server properties*: Number of databases in all possible states (online, offline, suspect, etc.), cpu count, physical memory, SQL Server service uptime, and SQL Server version
|
|
||||||
* *Wait stats*: Wait time in ms, number of waiting tasks, resource wait time, signal wait time, max wait time in ms, wait type, and wait category. The waits are categorized using the sasme categories used in Query Store.
|
|
||||||
|
|
||||||
**Note**: Version 2 queries are not backwards compatible with the old queries. Any dashboards or queries based on the old query format will not work with the new format. The version 2 queries are written in such a way as to only gather SQL specific metrics (no disk space or overall CPU related metrics) and they only report raw metrics, no math has been done to calculate deltas. To graph this data you must calculate deltas in your dashboarding software.
|
**Note**: Version 2 queries are not backwards compatible with the old queries. Any dashboards or queries based on the old query format will not work with the new format. The version 2 queries are written in such a way as to only gather SQL specific metrics (no disk space or overall CPU related metrics) and they only report raw metrics, no math has been done to calculate deltas. To graph this data you must calculate deltas in your dashboarding software.
|
||||||
|
|
||||||
# Tags
|
#### Version 1 (deprecated in 1.6):
|
||||||
If you are using the original queries all stats have the following tags:
|
The original metrics queries provide:
|
||||||
* `servername`: hostname:instance
|
- *Performance counters*: 1000+ metrics from `sys.dm_os_performance_counters`
|
||||||
* `type`: type of stats to easily filter measurements
|
- *Performance metrics*: special performance and ratio metrics
|
||||||
|
- *Wait stats*: wait tasks categorized from `sys.dm_os_wait_stats`
|
||||||
|
- *Memory clerk*: memory breakdown from `sys.dm_os_memory_clerks`
|
||||||
|
- *Database size*: databases size trend from `sys.dm_io_virtual_file_stats`
|
||||||
|
- *Database IO*: databases I/O from `sys.dm_io_virtual_file_stats`
|
||||||
|
- *Database latency*: databases latency from `sys.dm_io_virtual_file_stats`
|
||||||
|
- *Database properties*: databases properties, state and recovery model, from `sys.databases`
|
||||||
|
- *OS Volume*: available, used and total space from `sys.dm_os_volume_stats`
|
||||||
|
- *CPU*: cpu usage from `sys.dm_os_ring_buffers`
|
||||||
|
|
||||||
Version 2 queries all have the following:
|
If you are using the original queries all stats have the following tags:
|
||||||
* `host`: Physical host name
|
- `servername`: hostname:instance
|
||||||
* `sql_instance`: Physical host and instance name (hostname:instance)
|
- `type`: type of stats to easily filter measurements
|
||||||
|
|
||||||
|
#### Version 2:
|
||||||
|
The new (version 2) metrics provide:
|
||||||
|
- *AzureDB*: AzureDB resource utilization from `sys.dm_db_resource_stats`
|
||||||
|
- *Database IO*: IO stats from `sys.dm_io_virtual_file_stats`
|
||||||
|
- *Memory Clerk*: Memory clerk breakdown from `sys.dm_os_memory_clerks`, most clerks have been given a friendly name.
|
||||||
|
- *Performance Counters*: A select list of performance counters from `sys.dm_os_performance_counters`. Some of the important metrics included:
|
||||||
|
- *Activity*: Transactions/sec/database, Batch requests/sec, blocked processes, + more
|
||||||
|
- *Availability Groups*: Bytes sent to replica, Bytes received from replica, Log bytes received, Log send queue, transaction delay, + more
|
||||||
|
- *Log activity*: Log bytes flushed/sec, Log flushes/sec, Log Flush Wait Time
|
||||||
|
- *Memory*: PLE, Page reads/sec, Page writes/sec, + more
|
||||||
|
- *TempDB*: Free space, Version store usage, Active temp tables, temp table creation rate, + more
|
||||||
|
- *Resource Governor*: CPU Usage, Requests/sec, Queued Requests, and Blocked tasks per workload group
|
||||||
|
- *Server properties*: Number of databases in all possible states (online, offline, suspect, etc.), cpu count, physical memory, SQL Server service uptime, and SQL Server version
|
||||||
|
- *Wait stats*: Wait time in ms, number of waiting tasks, resource wait time, signal wait time, max wait time in ms, wait type, and wait category. The waits are categorized using the sasme categories used in Query Store.
|
||||||
|
|
||||||
|
Version 2 queries have the following tags:
|
||||||
|
- `host`: Physical host name
|
||||||
|
- `sql_instance`: Physical host and instance name (hostname:instance)
|
||||||
|
|
|
@ -38,35 +38,37 @@ var isInitialized = false
|
||||||
var defaultServer = "Server=.;app name=telegraf;log=1;"
|
var defaultServer = "Server=.;app name=telegraf;log=1;"
|
||||||
|
|
||||||
var sampleConfig = `
|
var sampleConfig = `
|
||||||
## Specify instances to monitor with a list of connection strings.
|
## Specify instances to monitor with a list of connection strings.
|
||||||
## All connection parameters are optional.
|
## All connection parameters are optional.
|
||||||
## By default, the host is localhost, listening on default port, TCP 1433.
|
## By default, the host is localhost, listening on default port, TCP 1433.
|
||||||
## for Windows, the user is the currently running AD user (SSO).
|
## for Windows, the user is the currently running AD user (SSO).
|
||||||
## See https://github.com/denisenkom/go-mssqldb for detailed connection
|
## See https://github.com/denisenkom/go-mssqldb for detailed connection
|
||||||
## parameters.
|
## parameters.
|
||||||
# servers = [
|
# servers = [
|
||||||
# "Server=192.168.1.10;Port=1433;User Id=<user>;Password=<pw>;app name=telegraf;log=1;",
|
# "Server=192.168.1.10;Port=1433;User Id=<user>;Password=<pw>;app name=telegraf;log=1;",
|
||||||
# ]
|
# ]
|
||||||
#
|
|
||||||
## Optional parameter, setting this to 2 will use a new version
|
## Optional parameter, setting this to 2 will use a new version
|
||||||
## of the collection queries that break compatibility with the original
|
## of the collection queries that break compatibility with the original
|
||||||
## dashboards.
|
## dashboards.
|
||||||
# query_version = 2
|
query_version = 2
|
||||||
## If you are using AzureDB, setting this to True will gather resource utilization metrics
|
|
||||||
# azuredb = False
|
## If you are using AzureDB, setting this to true will gather resource utilization metrics
|
||||||
## If you would like to exclude some of the metrics queries, list them here
|
# azuredb = false
|
||||||
## Possible choices:
|
|
||||||
## - PerformanceCounters
|
## If you would like to exclude some of the metrics queries, list them here
|
||||||
## - WaitStatsCategorized
|
## Possible choices:
|
||||||
## - DatabaseIO
|
## - PerformanceCounters
|
||||||
## - DatabaseProperties
|
## - WaitStatsCategorized
|
||||||
## - CPUHistory
|
## - DatabaseIO
|
||||||
## - DatabaseSize
|
## - DatabaseProperties
|
||||||
## - DatabaseStats
|
## - CPUHistory
|
||||||
## - MemoryClerk
|
## - DatabaseSize
|
||||||
## - VolumeSpace
|
## - DatabaseStats
|
||||||
## - PerformanceMetrics
|
## - MemoryClerk
|
||||||
# exclude_query = [ 'PerformanceCounters','WaitStatsCatagorized' ]
|
## - VolumeSpace
|
||||||
|
## - PerformanceMetrics
|
||||||
|
# exclude_query = [ 'PerformanceCounters','WaitStatsCatagorized' ]
|
||||||
`
|
`
|
||||||
|
|
||||||
// SampleConfig return the sample configuration
|
// SampleConfig return the sample configuration
|
||||||
|
|
Loading…
Reference in New Issue