Skip to content

Commit

Permalink
feat (mssql): influxdata#126, reuse the existing template
Browse files Browse the repository at this point in the history
   * add support for SQL Database in Azure (MSSQL powered)
  • Loading branch information
ivankudibal committed Jun 26, 2020
1 parent 1de00b5 commit 317bae4
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 121 deletions.
241 changes: 120 additions & 121 deletions mssql/mssql.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
apiVersion: influxdata.com/v2alpha1
kind: Label
metadata:
name: sharp-carson-258001
name: sad-carson-616001
spec:
color: '#FFE480'
name: mssql
---
apiVersion: influxdata.com/v2alpha1
kind: Bucket
kind: Variable
metadata:
name: gifted-snyder-a58001
name: modest-payne-616005
spec:
associations:
- kind: Label
name: sharp-carson-258001
name: mssql
name: sad-carson-616001
name: mssqlType
type: constant
values:
- sqlserver_azuredb_waitstats
- sqlserver_waitstats
---
apiVersion: influxdata.com/v2alpha1
kind: Dashboard
metadata:
name: exciting-thompson-658001
name: elastic-buck-216001
spec:
associations:
- kind: Label
name: sharp-carson-258001
name: sad-carson-616001
charts:
- colors:
- hex: '#00C9FF'
Expand Down Expand Up @@ -154,13 +158,11 @@ spec:
- query: |-
from(bucket: "mssql")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "sqlserver_waitstats")
|> filter(fn: (r) => r["_measurement"] == v.mssqlType)
|> filter(fn: (r) => r["_field"] == "wait_time_ms")
|> derivative(unit: v.windowPeriod, nonNegative: false)
|> yield(name: "derivative")
width: 6
xCol: _time
yCol: _value
yPos: 7
- axes:
- base: "10"
Expand Down Expand Up @@ -238,10 +240,10 @@ spec:
yPos: 11
- axes:
- base: "10"
name: x
name: y
scale: linear
- base: "10"
name: y
name: x
scale: linear
colors:
- hex: '#31C0F6'
Expand Down Expand Up @@ -279,10 +281,10 @@ spec:
yPos: 13
- axes:
- base: "10"
name: x
name: y
scale: linear
- base: "10"
name: y
name: x
scale: linear
colors:
- hex: '#00C9FF'
Expand Down Expand Up @@ -463,10 +465,10 @@ spec:
yPos: 3
- axes:
- base: "10"
name: x
name: y
scale: linear
- base: "10"
name: y
name: x
scale: linear
colors:
- hex: '#31C0F6'
Expand All @@ -490,13 +492,11 @@ spec:
|> filter(fn: (r) => r["_measurement"] == "sqlserver_memory_clerks")
|> filter(fn: (r) => r["_field"] == "size_kb")
|> filter(fn: (r) => r["database_name"] == "master")
|> filter(fn: (r) => r["host"] == "WIN-8EI77QDB3SL")
// |> filter(fn: (r) => r["host"] == "WIN-8EI77QDB3SL")
|> derivative(unit: v.windowPeriod, nonNegative: true)
|> yield(name: "nonnegative derivative")
width: 6
xCol: _time
xPos: 6
yCol: _value
yPos: 5
- axes:
- base: "10"
Expand Down Expand Up @@ -524,7 +524,7 @@ spec:
- query: |-
from(bucket: "mssql")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "sqlserver_waitstats")
|> filter(fn: (r) => r["_measurement"] == v.mssqlType)
|> filter(fn: (r) => r["_field"] == "waiting_tasks_count")
|> derivative(unit: v.windowPeriod, nonNegative: false)
|> yield(name: "derivative")
Expand Down Expand Up @@ -753,124 +753,123 @@ spec:
width: 1
xPos: 11
name: MSSQL

---

apiVersion: influxdata.com/v2alpha1
kind: Telegraf
metadata:
name: mssql-config
name: endangered-goldberg-216003
spec:
config: |
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## urls exp: http://127.0.0.1:9999
urls = ["$INFLUX_HOST"]
config: |-
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## urls exp: http://127.0.0.1:9999
urls = ["$INFLUX_HOST"]
## Token for authentication.
token = "$INFLUX_TOKEN"
## Token for authentication.
token = "$INFLUX_TOKEN"
## Organization is the name of the organization you wish to write to; must exist.
organization = "$INFLUX_ORG"
## Organization is the name of the organization you wish to write to; must exist.
organization = "$INFLUX_ORG"
## Destination bucket to write into.
bucket = "$INFLUX_BUCKET"
## Destination bucket to write into.
bucket = "$INFLUX_BUCKET"
[agent]
## Default data collection interval for all inputs, can be changed as per collection interval needs
interval = "10s"
[agent]
## Default data collection interval for all inputs, can be changed as per collection interval needs
interval = "10s"
# Read metrics from Microsoft SQL Server
[[inputs.sqlserver]]
## Specify instances to monitor with a list of connection strings.
## All connection parameters are optional.
## By default, the host is localhost, listening on default port, TCP 1433.
## for Windows, the user is the currently running AD user (SSO).
## See https://github.com/denisenkom/go-mssqldb for detailed connection
## parameters, in particular, tls connections can be created like so:
## "encrypt=true;certificate=<cert>;hostNameInCertificate=<SqlServer host fqdn>"
# servers = [
# "Server=192.168.1.10;Port=1433;User Id=<user>;Password=<pw>;app name=telegraf;log=1;",
# ]
# Read metrics from Microsoft SQL Server
[[inputs.sqlserver]]
## Specify instances to monitor with a list of connection strings.
## All connection parameters are optional.
## By default, the host is localhost, listening on default port, TCP 1433.
## for Windows, the user is the currently running AD user (SSO).
## See https://github.com/denisenkom/go-mssqldb for detailed connection
## parameters, in particular, tls connections can be created like so:
## "encrypt=true;certificate=<cert>;hostNameInCertificate=<SqlServer host fqdn>"
# servers = [
# "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
## of the collection queries that break compatibility with the original
## dashboards.
## Version 2 - is compatible from SQL Server 2012 and later versions and also for SQL Azure DB
query_version = 2
## Optional parameter, setting this to 2 will use a new version
## of the collection queries that break compatibility with the original
## dashboards.
## Version 2 - is compatible from SQL Server 2012 and later versions and also for SQL Azure DB
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
# azuredb = false
## Possible queries
## Version 2:
## - PerformanceCounters
## - WaitStatsCategorized
## - DatabaseIO
## - ServerProperties
## - MemoryClerk
## - Schedulers
## - SqlRequests
## - VolumeSpace
## - Cpu
## Version 1:
## - PerformanceCounters
## - WaitStatsCategorized
## - CPUHistory
## - DatabaseIO
## - DatabaseSize
## - DatabaseStats
## - DatabaseProperties
## - MemoryClerk
## - VolumeSpace
## - PerformanceMetrics
## Possible queries
## Version 2:
## - PerformanceCounters
## - WaitStatsCategorized
## - DatabaseIO
## - ServerProperties
## - MemoryClerk
## - Schedulers
## - SqlRequests
## - VolumeSpace
## - Cpu
## Version 1:
## - PerformanceCounters
## - WaitStatsCategorized
## - CPUHistory
## - DatabaseIO
## - DatabaseSize
## - DatabaseStats
## - DatabaseProperties
## - MemoryClerk
## - VolumeSpace
## - PerformanceMetrics
## A list of queries to include. If not specified, all the above listed queries are used.
# include_query = []
## A list of queries to include. If not specified, all the above listed queries are used.
# include_query = []
## A list of queries to explicitly ignore.
exclude_query = [ 'Schedulers' , 'SqlRequests' ]
## A list of queries to explicitly ignore.
exclude_query = [ 'Schedulers' , 'SqlRequests' ]
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Instances = ["*"]
Counters = ["% Idle Time", "% Interrupt Time", "% Privileged Time", "% User Time", "% Processor Time"]
Measurement = "win_cpu"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Instances = ["*"]
Counters = ["% Idle Time", "% Interrupt Time", "% Privileged Time", "% User Time", "% Processor Time"]
Measurement = "win_cpu"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Disk times and queues
ObjectName = "LogicalDisk"
Instances = ["*"]
Counters = ["% Idle Time", "% Disk Time","% Disk Read Time", "% Disk Write Time", "% User Time", "Current Disk Queue Length"]
Measurement = "win_disk"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Disk times and queues
ObjectName = "LogicalDisk"
Instances = ["*"]
Counters = ["% Idle Time", "% Disk Time","% Disk Read Time", "% Disk Write Time", "% User Time", "Current Disk Queue Length"]
Measurement = "win_disk"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
ObjectName = "System"
Counters = ["Context Switches/sec","System Calls/sec", "Processor Queue Length"]
Instances = ["------"]
Measurement = "win_system"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
ObjectName = "System"
Counters = ["Context Switches/sec","System Calls/sec", "Processor Queue Length"]
Instances = ["------"]
Measurement = "win_system"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back, such as from the Memory object.
ObjectName = "Memory"
Counters = ["Available Bytes","Cache Faults/sec","Demand Zero Faults/sec","Page Faults/sec","Pages/sec","Transition Faults/sec","Pool Nonpaged Bytes","Pool Paged Bytes"]
Instances = ["------"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_mem"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# Example query where the Instance portion must be removed to get data back, such as from the Memory object.
ObjectName = "Memory"
Counters = ["Available Bytes","Cache Faults/sec","Demand Zero Faults/sec","Page Faults/sec","Pages/sec","Transition Faults/sec","Pool Nonpaged Bytes","Pool Paged Bytes"]
Instances = ["------"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_mem"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# more counters for the Network Interface Object can be found at
# https://msdn.microsoft.com/en-us/library/ms803962.aspx
ObjectName = "Network Interface"
Counters = ["Bytes Received/sec","Bytes Sent/sec","Packets Received/sec","Packets Sent/sec"]
Instances = ["*"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_net"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
[[inputs.win_perf_counters.object]]
# more counters for the Network Interface Object can be found at
# https://msdn.microsoft.com/en-us/library/ms803962.aspx
ObjectName = "Network Interface"
Counters = ["Bytes Received/sec","Bytes Sent/sec","Packets Received/sec","Packets Sent/sec"]
Instances = ["*"] # Use 6 x - to remove the Instance bit from the query.
Measurement = "win_net"
#IncludeTotal=false #Set to true to include _Total instance when querying for all (*).
name: mssql-config
17 changes: 17 additions & 0 deletions mssql/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ influx pkg -u https://raw.githubusercontent.com/influxdata/community-templates/m
- 1 Dashboards: 'MSSQL'
- 1 Label: 'mssql'
- 1 Bucket: 'mssql'
- 1 Variable: 'mssqlType'

## Setup Instructions

Expand All @@ -31,6 +32,22 @@ General instructions on using InfluxDB Templates can be found in the [use a temp
- `INFLUX_HOST` - The address of you InfluxDB
- `INFLUX_BUCKET` - The name of the Bucket. If you going to use the bucket included, you need to export the variable. Ex: <code>INFLUX_BUCKET=mssql</code>

## Additional Instructions For Azure DB

The template can be used to monitor SQL database service in Azure.

Proceed with the general instructions above. Download the Telegraf config and set up the following:

```
servers = [
"Server=DBHOST.database.windows.net;Port=1433;User Id=DBUSER;Password=DBPSWD;app name=DBNAME;log=1;",
]
azuredb = true
```

Use the `mssqlType` variable to see data inside the `Wait Time` and `Wait Tasks` dashboard cells.


## Contact

Author: Ignacio Van Droogenbroeck
Expand Down

0 comments on commit 317bae4

Please sign in to comment.