From e3ba59200ee4bdcd4d994d4aca41ace4b00bfbbe Mon Sep 17 00:00:00 2001
From: Marcin Gminski <8288333+marcingminski@users.noreply.github.com>
Date: Wed, 5 Apr 2023 21:48:24 +0100
Subject: [PATCH] Fix #465 (#471)
---
.../Grafana/SQL Instance Overview.json | 6587 +++++++++--------
1 file changed, 3405 insertions(+), 3182 deletions(-)
diff --git a/SqlWatch.Dashboard/Grafana/SQL Instance Overview.json b/SqlWatch.Dashboard/Grafana/SQL Instance Overview.json
index 7f0eeffa..eacbba30 100644
--- a/SqlWatch.Dashboard/Grafana/SQL Instance Overview.json
+++ b/SqlWatch.Dashboard/Grafana/SQL Instance Overview.json
@@ -3,20 +3,28 @@
"list": [
{
"builtIn": 1,
- "datasource": "-- Grafana --",
+ "datasource": {
+ "type": "datasource",
+ "uid": "grafana"
+ },
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
+ "target": {
+ "limit": 100,
+ "matchAny": false,
+ "tags": [],
+ "type": "dashboard"
+ },
"type": "dashboard"
}
]
},
"editable": true,
- "gnetId": null,
+ "fiscalYearStartMonth": 0,
"graphTooltip": 1,
- "id": 33,
- "iteration": 1621358421053,
+ "id": 1,
"links": [
{
"asDropdown": true,
@@ -30,10 +38,14 @@
"type": "dashboards"
}
],
+ "liveNow": false,
"panels": [
{
- "collapsed": true,
- "datasource": null,
+ "collapsed": false,
+ "datasource": {
+ "type": "mssql",
+ "uid": "EeAYXKY4k"
+ },
"gridPos": {
"h": 1,
"w": 24,
@@ -41,2203 +53,2295 @@
"y": 0
},
"id": 173,
- "panels": [
+ "panels": [],
+ "targets": [
{
- "datasource": null,
- "fieldConfig": {
- "defaults": {
- "custom": {}
- },
- "overrides": []
- },
- "gridPos": {
- "h": 5,
- "w": 24,
- "x": 0,
- "y": 1
+ "datasource": {
+ "type": "mssql",
+ "uid": "EeAYXKY4k"
},
- "id": 59,
- "options": {
- "content": "
This dashboard was designed to help you understand what happens in your SQL Server and help you find bottlenecks. A single page view helps correlate various events and makes it easier to spot trends. Like most computer systems, SQL Server relies on the following components to perform well: CPU > Memory > Storage > Network.\r\nIf any of these does not perform well, we may be seeing performance degradation in our database and/or application. We start looking at the tiles from left to right. Although the data flows from right to left (Storage to CPU), in case of slow disks, we may be seeing long latencies, lots of disk tranfers and long Pending Queue and not a lot of CPU activity. In case of poorly optimised queries or general workload problems, we may be seeing lots of CPU activity but not a lot of disk activity.
", - "mode": "html" + "refId": "A" + } + ], + "title": "$sql_instance: SQL Server Overview", + "type": "row" + }, + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "gridPos": { + "h": 5, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 59, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "This dashboard was designed to help you understand what happens in your SQL Server and help you find bottlenecks. A single page view helps correlate various events and makes it easier to spot trends. Like most computer systems, SQL Server relies on the following components to perform well: CPU > Memory > Storage > Network.\r\nIf any of these does not perform well, we may be seeing performance degradation in our database and/or application. We start looking at the tiles from left to right. Although the data flows from right to left (Storage to CPU), in case of slow disks, we may be seeing long latencies, lots of disk tranfers and long Pending Queue and not a lot of CPU activity. In case of poorly optimised queries or general workload problems, we may be seeing lots of CPU activity but not a lot of disk activity.
", + "mode": "html" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "queryType": "randomWalk", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transparent": true, - "type": "text" + "queryType": "randomWalk", + "refId": "A" + } + ], + "transparent": true, + "type": "text" + }, + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 248, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false }, + "content": "$sql_version
", + "mode": "html" + }, + "pluginVersion": "9.4.7", + "targets": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, - "gridPos": { - "h": 3, - "w": 24, - "x": 0, - "y": 6 + "queryType": "randomWalk", + "refId": "A" + } + ], + "transparent": true, + "type": "text" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "id": 248, - "options": { - "content": "$sql_version
", - "mode": "html" + "decimals": 0, + "links": [], + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 80 + }, + { + "color": "red", + "value": 95 + } + ] }, - "pluginVersion": "7.4.2", - "targets": [ - { - "queryType": "randomWalk", - "refId": "A" + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 9 + }, + "id": 268, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "panelId": 269, + "refId": "A" + } + ], + "transformations": [ + { + "id": "seriesToColumns", + "options": { + "byField": "Time" + } + }, + { + "id": "filterFieldsByName", + "options": { + "include": { + "pattern": "CPU usage %" } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transparent": true, - "type": "text" + } }, { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" + "id": "organize", + "options": { + "excludeByName": { + "Availability Group Bytes": true, + "Batch Requests/sec": true, + "Bytes Received from Replica/sec": true, + "Bytes Sent to Replica/sec": true, + "Connection Memory (KB)": true, + "Logins/sec": true, + "Optimizer Memory (KB)": true, + "SQL Cache Memory (KB)": true, + "SQL Compilations/sec": true, + "Stolen Server Memory (KB)": true, + "Target Server Memory (KB)": true, + "Time": true, + "Total Server Memory (KB)": true, + "Transactions/sec": true, + "User Connections": true, + "Wait Time": true, + "max": true, + "min": true + }, + "indexByName": { + "Time": 0, + "max": 3, + "min": 4, + "sql": 2, + "system": 1 + }, + "renameByName": { + "CPU usage %": "CPU" + } + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "displayName": "Wait Time", + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "max": 100, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 80 - }, - { - "color": "red", - "value": 95 - } - ] + { + "color": "light-orange", + "value": 800 }, - "unit": "percent" - }, - "overrides": [] + { + "color": "red", + "value": 1000 + } + ] }, - "gridPos": { - "h": 4, - "w": 3, - "x": 0, - "y": 9 + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 3, + "y": 9 + }, + "id": 310, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" }, - "id": 268, + "panelId": 102, + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 269, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "seriesToColumns", - "options": { - "byField": "Time" - } - }, - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "CPU usage %" - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Availability Group Bytes": true, - "Batch Requests/sec": true, - "Bytes Received from Replica/sec": true, - "Bytes Sent to Replica/sec": true, - "Connection Memory (KB)": true, - "Logins/sec": true, - "Optimizer Memory (KB)": true, - "SQL Cache Memory (KB)": true, - "SQL Compilations/sec": true, - "Stolen Server Memory (KB)": true, - "Target Server Memory (KB)": true, - "Time": true, - "Total Server Memory (KB)": true, - "Transactions/sec": true, - "User Connections": true, - "Wait Time": true, - "max": true, - "min": true - }, - "indexByName": { - "Time": 0, - "max": 3, - "min": 4, - "sql": 2, - "system": 1 - }, - "renameByName": { - "CPU usage %": "CPU" - } - } + "include": { + "pattern": "" } - ], - "transparent": true, - "type": "stat" + } }, { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "displayName": "Wait Time", - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 800 - }, - { - "color": "red", - "value": 1000 - } - ] - }, - "unit": "ms" + "id": "calculateField", + "options": { + "mode": "reduceRow", + "reduce": { + "reducer": "sum" }, - "overrides": [] + "replaceFields": true + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "thresholds" }, - "gridPos": { - "h": 4, - "w": 3, - "x": 3, - "y": 9 - }, - "id": 310, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 102, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "" - } - } - }, - { - "id": "calculateField", - "options": { - "mode": "reduceRow", - "reduce": { - "reducer": "sum" - }, - "replaceFields": true - } - } - ], - "transparent": true, - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "blue", - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 1 - }, - { - "color": "red", - "value": 4 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 2, - "x": 6, - "y": 9 - }, - "id": 217, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Pending] = sum([runnable_tasks_count]+work_queue_count+pending_disk_io_count)\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_schedulers]\n WHERE 1 = 1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n GROUP BY snapshot_time --$__timeGroup([snapshot_time], $aggregation) \nORDER BY\n time ASC\n \n ", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Pending" - ] - } - } - } - ], - "transparent": true, - "type": "stat" - }, - { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "blue", - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 1 - }, - { - "color": "red", - "value": 2 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 2, - "x": 8, - "y": 9 - }, - "id": 287, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "auto" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 296, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Waiting" - ] - } - } - } - ], - "transparent": true, - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "blue", - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "displayName": "Blocked", - "links": [], - "mappings": [], - "min": 0, - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "red", - "value": 0.1 - }, - { - "color": "red", - "value": 2 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 2, - "x": 10, - "y": 9 - }, - "id": 218, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT time = isnull(x.event_time,h.snapshot_time)\r\n ,[Blocked] = sum(case when isnull(blocking_session_id,0) > 0 then 1 else 0 end)\r\n --xes only collects data when the event happens so it will return null if no events\r\n --this will make grafana show \"No Data\" rather than default to zero as we're nog going to have a serie either.\r\n --we have to fudge it a bit\r\n \r\n from dbo.sqlwatch_logger_snapshot_header h\r\n left join [dbo].[ufn_sqlwatch_get_blocking_chains] ($__timeFrom(), $__timeTo(),'$sql_instance') x\r\n on h.snapshot_time = x.snapshot_time\r\n and h.snapshot_type_id = x.snapshot_type_id\r\n and h.sql_instance = x.sql_instance\r\n where h.sql_instance = '$sql_instance'\r\n and h.snapshot_type_id = 9\r\n and $__timeFilter(h.snapshot_time)\r\n group by isnull(x.event_time,h.snapshot_time)\r\n order by time asc", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Blocked" - ] - } - } - } - ], - "transparent": true, - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 85 - }, - { - "color": "red", - "value": 95 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Memory Low" - }, - "properties": [ - { - "id": "unit", - "value": "none" - }, - { - "id": "mappings", - "value": [ - { - "from": "", - "id": 1, - "text": "OK", - "to": "", - "type": 1, - "value": "0" - }, - { - "from": "", - "id": 2, - "text": "Low", - "to": "", - "type": 1, - "value": "1" - } - ] - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - }, - { - "id": "displayName", - "value": "Memory" - } - ] - } - ] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 12, - "y": 9 - }, - "id": 199, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Memory] = AVG([physical_memory_in_use_kb]*1.0/([physical_memory_in_use_kb]+[available_commit_limit_kb]))\n ,[Memory Low] = case when convert(int,process_physical_memory_low)+convert(int,process_virtual_memory_low) > 0 then 1 else 0 end\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_process_memory]\n WHERE 1 = 1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n GROUP BY snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n , case when convert(int,process_physical_memory_low)+convert(int,process_virtual_memory_low) > 0 then 1 else 0 end\nORDER BY\n time ASC\n \n ", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Memory", - "Memory Low" - ] - } - } - } - ], - "transparent": true, - "type": "stat" - }, - { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "displayName": "Max Latency", - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 20 - }, - { - "color": "red", - "value": 50 - } - ] - }, - "unit": "ms" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 3, - "x": 18, - "y": 9 - }, - "id": 230, - "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "vertical", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 15, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "/Max/" - } - } - }, - { - "id": "reduce", - "options": { - "reducers": [ - "lastNotNull" - ] - } - } - ], - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "custom": {}, - "mappings": [], - "max": 2, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "OK" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "thresholds" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "WARNING" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "light-orange", - "mode": "thresholds" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 1 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "CRITICAL" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "red", - "mode": "thresholds" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "red", - "value": 1 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "CHECK ERROR" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "semi-dark-purple", - "mode": "thresholds" - } - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "dark-purple", - "value": 1 - } - ] - } - } - ] - } - ] - }, - "gridPos": { - "h": 4, - "w": 3, - "x": 21, - "y": 9 - }, - "id": 246, - "links": [], - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "sum" - ], - "fields": "", - "limit": 4, - "values": true - }, - "text": {}, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT time=getdate(),t.last_check_status,last_check_status_count=count(c.last_check_status)\r\n FROM (\r\n select last_check_status='OK' union all \r\n select last_check_status = 'WARNING' union all \r\n select last_check_status = 'CRITICAL' union all \r\n select last_check_status = 'CHECK ERROR') t\r\n\r\n\touter apply (\r\n\t\tselect last_check_status = case when last_check_status is null then 'CHECK ERROR' else last_check_status end\r\n\t\tfrom [dbo].[sqlwatch_meta_check] mc\r\n\t\twhere [sql_instance] = '$sql_instance'\r\n\t\tand case when last_check_status is null then 'CHECK ERROR' else last_check_status end = t.last_check_status\r\n\t\tand check_enabled = 1\r\n\t\t) c\r\ngroup by t.last_check_status\r\n\r\n order by case t.last_check_status when 'OK' then 1 when 'WARNING' then 2 when 'CRITICAL' then 3 else 4 end ", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "rgb(105, 105, 105)", - "mode": "thresholds" - }, - "custom": {}, - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Batch Requests/sec" - }, - "properties": [ - { - "id": "unit", - "value": "reqps" - }, - { - "id": "displayName", - "value": "Batch Requests" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Logins/sec" - }, - "properties": [ - { - "id": "displayName", - "value": "Logins" - }, - { - "id": "unit", - "value": "cps" - }, - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 2 - }, - { - "color": "red", - "value": 8 - } - ] - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Transactions/sec" - }, - "properties": [ - { - "id": "unit", - "value": "cps" - }, - { - "id": "displayName", - "value": "Transactions" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Availability Group Bytes" - }, - "properties": [ - { - "id": "unit", - "value": "Bps" - }, - { - "id": "noValue", - "value": "N/A" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "SQL Compilations/sec" - }, - "properties": [ - { - "id": "unit", - "value": "cps" - }, - { - "id": "displayName", - "value": "SQL Compilations" - } - ] - } - ] - }, - "gridPos": { - "h": 12, - "w": 3, - "x": 0, - "y": 13 - }, - "id": 269, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": { - "titleSize": 14, - "valueSize": 20 - }, - "textMode": "auto" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "select \r\n\t time = pc.snapshot_time\r\n\t, 'CPU usage %' = sum(case \r\n\t when 1=1 and mpc.counter_name = 'Processor Time %' then pc.[cntr_value_calculated] \r\n\t --when serverproperty('EngineEdition') = 3 and mpc.counter_name = 'CPU usage %' then pc.[cntr_value_calculated] \r\n\t --when serverproperty('EngineEdition') <> 3 and mpc.counter_name = 'Processor Time %' then pc.[cntr_value_calculated]\r\n\t else null end)\r\n\t, 'Batch Requests/sec' = avg(case when mpc.counter_name = 'Batch Requests/sec' then pc.[cntr_value_calculated] else null end)\r\n\r\n\t, 'Logins/sec' = avg(case when mpc.counter_name = 'Logins/sec' then pc.[cntr_value_calculated] else null end)\r\n\t, 'Transactions/sec' = sum(case when mpc.counter_name = 'Transactions/sec' and pc.instance_name not in ('_Total','mssqlsystemresource') then pc.[cntr_value_calculated] else null end)\r\n\t, 'User Connections' = avg(case when mpc.counter_name = 'User Connections' then pc.[cntr_value_calculated] else null end)\r\n\t, 'SQL Compilations/sec' = avg(case when mpc.counter_name = 'SQL Compilations/sec' then pc.[cntr_value_calculated] else null end)\r\n\t, 'Availability Group Bytes' = avg(case when mpc.counter_name in ('Bytes Sent to Replica/sec','Bytes Received from Replica/sec') then pc.[cntr_value_calculated] else null end)\r\n --\r\n ,'Connection Memory (KB)' = avg(case when mpc.counter_name = 'Connection Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Optimizer Memory (KB)' = avg(case when mpc.counter_name = 'Optimizer Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'SQL Cache Memory (KB)' = avg(case when mpc.counter_name = 'SQL Cache Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Total Server Memory (KB)' = avg(case when mpc.counter_name = 'Total Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Stolen Server Memory (KB)' = avg(case when mpc.counter_name = 'Stolen Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Target Server Memory (KB)' = avg(case when mpc.counter_name = 'Target Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\nfrom [dbo].[sqlwatch_logger_perf_os_performance_counters] pc\r\n\r\ninner join [dbo].[sqlwatch_meta_performance_counter] mpc\r\n\ton pc.sql_instance = mpc.sql_instance\r\n\tand pc.performance_counter_id = mpc.performance_counter_id\r\n\t\r\nwhere $__timeFilter(pc.snapshot_time)\r\nand pc.snapshot_time >= dateadd(minute,-15,getutcdate())\r\nand pc.[sql_instance] = '$sql_instance'\r\nand mpc.counter_name in ('CPU usage %'\r\n ,'Batch Requests/sec'\r\n ,'Logins/sec'\r\n ,'Transactions/sec'\r\n ,'User Connections'\r\n ,'SQL Compilations/sec'\r\n ,'Bytes Sent to Replica/sec'\r\n ,'Bytes Received from Replica/sec'\r\n ,'Processor Time %'\r\n ,'% Processor Time'\r\n \r\n ,'Connection Memory (KB)'\r\n ,'Optimizer Memory (KB)'\r\n ,'SQL Cache Memory (KB)'\r\n ,'Total Server Memory (KB)'\r\n ,'Stolen Server Memory (KB)'\r\n , 'Target Server Memory (KB)'\r\n )\r\n\r\ngroup by pc.snapshot_time\r\norder by time asc", - "refId": "SQL Server Perf Counters" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Activity", - "transformations": [ - { - "id": "seriesToColumns", - "options": { - "byField": "Time" - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "CPU usage %": true, - "Connection Memory (KB)": true, - "Optimizer Memory (KB)": true, - "SQL Cache Memory (KB)": true, - "SQL Compilations/sec": true, - "Stolen Server Memory (KB)": true, - "Target Server Memory (KB)": true, - "Time": true, - "Total Server Memory (KB)": true, - "Wait Time": true - }, - "indexByName": { - "Batch Requests/sec": 1, - "Logins/sec": 3, - "SQL Compilations/sec": 2, - "Time": 0, - "Transactions/sec": 4, - "User Connections": 5 - }, - "renameByName": { - "Bytes Received from Replica/sec": "AG: to Replica", - "Bytes Sent to Replica/sec": "AG: from Replica" - } - } - } - ], - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "rgb(105, 105, 105)", - "mode": "thresholds" - }, - "custom": {}, - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgb(30, 69, 24)", - "value": null - }, - { - "color": "light-orange", - "value": 800 - }, - { - "color": "red", - "value": 1000 - } - ] - }, - "unit": "ms" - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 3, - "x": 3, - "y": 13 - }, - "id": 102, + "decimals": 0, "links": [], - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "limit": 15, - "values": false - }, - "text": { - "titleSize": 14, - "valueSize": 16 - }, - "textMode": "value_and_name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Wait Type] = case when len([wait])>19 then left([wait],19) + '...' else [wait] end\n ,[Wait Time] = sum([wait_time_ms_per_second]) \n --,[Total] = sum([wait_time_ms_per_second]) over (partition by snapshot_time)\n FROM (SELECT wait_time_ms_per_second, wait= case when '$Waits' = 'Category' then [wait_category] else LOWER([wait_type]) end, snapshot_time, RN=ROW_NUMBER() over (partition by wait_category order by wait_time_ms_per_second desc)\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_wait_stats] \n WHERE 1=1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n ) t\n WHERE 1=1 --t.RN = 1\n GROUP BY case when len([wait])>19 then left([wait],19) + '...' else [wait] end\n ,snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n \nORDER BY\n time desc\n \n ", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Top Waits by Total Time", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "" - } - } - }, - { - "id": "renameByRegex", - "options": { - "regex": "(.Wait Time)", - "renamePattern": "" - } - } - ], - "type": "stat" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "dark-green", - "mode": "fixed" + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null }, - "custom": {}, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] + { + "color": "light-orange", + "value": 1 + }, + { + "color": "red", + "value": 4 } - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 3, - "x": 6, - "y": 13 + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 2, + "x": 6, + "y": 9 + }, + "id": 217, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "id": 299, + "format": "time_series", + "hide": false, + "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Pending] = sum([runnable_tasks_count]+work_queue_count+pending_disk_io_count)\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_schedulers]\n WHERE 1 = 1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n GROUP BY snapshot_time --$__timeGroup([snapshot_time], $aggregation) \nORDER BY\n time ASC\n \n ", + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", "options": { - "displayMode": "basic", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": false, - "text": { - "titleSize": 12, - "valueSize": 16 + "include": { + "names": [ + "Pending" + ] } + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "thresholds" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT time = r1.snapshot_time\r\n ,[running] = avg(running)\r\n ,[sleeping] = avg(sleeping)\r\n ,[dormant] = avg(dormant)\r\n ,[preconnect] = avg(preconnect)\r\n ,[cpu_time] = avg(cpu_time)\r\n ,[reads] = avg(reads)\r\n ,[writes] = avg(writes)\r\n , type = case when type = 1 then 'User' else 'System' end\r\n FROM [sqlwatch_logger_dm_exec_sessions_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n and snapshot_time > dateadd(minute,-15,GETUTCDATE())\t\r\n and r1.sql_instance = '$sql_instance'\r\n group by r1.snapshot_time, case when type = 1 then 'User' else 'System' end\r\n order by time asc", - "refId": "2" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Sessions", - "transformations": [ - { - "id": "seriesToColumns", - "options": { - "byField": "Time" - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "System cpu_time": true, - "System reads": true, - "System writes": true, - "User cpu_time": true, - "User reads": true, - "User writes": true, - "cpu_time": true, - "reads": true, - "writes": true - }, - "indexByName": { - "Time": 0, - "max": 3, - "min": 4, - "sql": 2, - "system": 1 - }, - "renameByName": {} - } - } - ], - "type": "bargauge" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "dark-green", - "mode": "thresholds" + "decimals": 0, + "links": [], + "mappings": [], + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] - } - }, - "overrides": [ { - "matcher": { - "id": "byRegexp", - "options": "Waiting|Suspended|Runnable" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 1 - }, - { - "color": "red", - "value": 2 - } - ] - } - } - ] + "color": "light-orange", + "value": 1 + }, + { + "color": "red", + "value": 2 } ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 2, + "x": 8, + "y": 9 + }, + "id": 287, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" }, - "gridPos": { - "h": 12, - "w": 3, - "x": 9, - "y": 13 - }, - "id": 296, + "panelId": 296, + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", "options": { - "displayMode": "basic", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": false, - "text": { - "titleSize": 12, - "valueSize": 16 + "include": { + "names": [ + "Waiting" + ] } + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "thresholds" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT time = r1.snapshot_time\r\n , Background\t= background\r\n , Running = running\r\n , Runnable = runnable\r\n , Sleeping\t = sleeping\r\n , Suspended\t = suspended\r\n , Waiting\t = waiting_tasks\r\n FROM [sqlwatch_logger_dm_exec_requests_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n\tand type = 1\r\n\tand r1.snapshot_time > dateadd(minute,-15,getutcdate())\r\n and r1.sql_instance = '$sql_instance'\r\n order by time asc", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "User Requests", - "transformations": [ - { - "id": "filterFieldsByName", - "options": {} - } - ], - "type": "bargauge" + "decimals": 0, + "displayName": "Blocked", + "links": [], + "mappings": [], + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "red", + "value": 0.1 + }, + { + "color": "red", + "value": 2 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 2, + "x": 10, + "y": 9 + }, + "id": 218, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "green", - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "noValue": "0", - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "dark-green", - "value": 1 - } - ] + "alias": "", + "datasource": { + "uid": "$DataSource" + }, + "format": "time_series", + "hide": false, + "rawSql": "SELECT time = isnull(x.event_time,h.snapshot_time)\r\n ,[Blocked] = sum(case when isnull(blocking_session_id,0) > 0 then 1 else 0 end)\r\n --xes only collects data when the event happens so it will return null if no events\r\n --this will make grafana show \"No Data\" rather than default to zero as we're nog going to have a serie either.\r\n --we have to fudge it a bit\r\n \r\n from dbo.sqlwatch_logger_snapshot_header h\r\n left join [dbo].[ufn_sqlwatch_get_blocking_chains] ($__timeFrom(), $__timeTo(),'$sql_instance') x\r\n on h.snapshot_time = x.snapshot_time\r\n and h.snapshot_type_id = x.snapshot_type_id\r\n and h.sql_instance = x.sql_instance\r\n where h.sql_instance = '$sql_instance'\r\n and h.snapshot_type_id = 9\r\n and $__timeFilter(h.snapshot_time)\r\n group by isnull(x.event_time,h.snapshot_time)\r\n order by time asc", + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "Blocked" + ] + } + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "links": [], + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null }, - "unit": "deckbytes" + { + "color": "light-orange", + "value": 85 + }, + { + "color": "red", + "value": 95 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Memory Low" }, - "overrides": [ + "properties": [ { - "matcher": { - "id": "byName", - "options": "Memory Deficit" - }, - "properties": [ - { - "id": "thresholds", - "value": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 1024 - }, - { - "color": "red", - "value": 1025 - } - ] - } - }, - { - "id": "noValue", - "value": "0" - }, + "id": "unit", + "value": "none" + }, + { + "id": "mappings", + "value": [ { - "id": "mappings", - "value": [ - { - "from": "-9999999999999999", - "id": 1, - "text": "0", - "to": "0", - "type": 2 + "options": { + "0": { + "text": "OK" + }, + "1": { + "text": "Low" } - ] + }, + "type": "value" } ] + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } + }, + { + "id": "displayName", + "value": "Memory" } ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 9 + }, + "id": 199, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "gridPos": { - "h": 12, - "w": 3, - "x": 12, - "y": 13 - }, - "id": 300, + "format": "time_series", + "hide": false, + "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Memory] = AVG([physical_memory_in_use_kb]*1.0/([physical_memory_in_use_kb]+[available_commit_limit_kb]))\n ,[Memory Low] = case when convert(int,process_physical_memory_low)+convert(int,process_virtual_memory_low) > 0 then 1 else 0 end\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_process_memory]\n WHERE 1 = 1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n GROUP BY snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n , case when convert(int,process_physical_memory_low)+convert(int,process_virtual_memory_low) > 0 then 1 else 0 end\nORDER BY\n time ASC\n \n ", + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "/.*/", - "values": false - }, - "text": { - "titleSize": 12, - "valueSize": 16 - }, - "textMode": "value_and_name" + "include": { + "names": [ + "Memory", + "Memory Low" + ] + } + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 269, - "refId": "A" + "decimals": 0, + "displayName": "Max Latency", + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 20 + }, + { + "color": "red", + "value": 50 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 18, + "y": 9 + }, + "id": 230, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "panelId": 15, + "refId": "A" + } + ], + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "pattern": "/Max/" } - ], - "timeFrom": null, - "timeShift": null, - "title": "SQL Memory", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Connection Memory (KB)", - "Optimizer Memory (KB)", - "SQL Cache Memory (KB)", - "Total Server Memory (KB)", - "Stolen Server Memory (KB)", - "Target Server Memory (KB)", - "Time" + } + }, + { + "id": "reduce", + "options": { + "reducers": [ + "lastNotNull" + ] + } + } + ], + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "mappings": [], + "max": 2, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "OK" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "thresholds" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + } ] } } + ] + }, + { + "matcher": { + "id": "byName", + "options": "WARNING" }, - { - "id": "calculateField", - "options": { - "alias": "Memory Deficit", - "binary": { - "left": "Target Server Memory (KB)", - "operator": "-", - "reducer": "sum", - "right": "Total Server Memory (KB)" - }, - "mode": "binary", - "reduce": { - "reducer": "sum" - }, - "replaceFields": false + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-orange", + "mode": "thresholds" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 1 + } + ] + } } + ] + }, + { + "matcher": { + "id": "byName", + "options": "CRITICAL" }, - { - "id": "renameByRegex", - "options": { - "regex": "(\\(KB\\))", - "renamePattern": "" + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "thresholds" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "red", + "value": 1 + } + ] + } } + ] + }, + { + "matcher": { + "id": "byName", + "options": "CHECK ERROR" }, - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "Connection Memory ", - "Optimizer Memory ", - "SQL Cache Memory ", - "Total Server Memory ", - "Stolen Server Memory ", - "Target Server Memory ", - "Memory Deficit" + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "semi-dark-purple", + "mode": "thresholds" + } + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "dark-purple", + "value": 1 + } ] } } - } - ], - "type": "stat" + ] + } + ] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 21, + "y": 9 + }, + "id": 246, + "links": [], + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "sum" + ], + "fields": "", + "limit": 4, + "values": true }, + "text": {}, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ { - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "rgb(105, 105, 105)", - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] - }, - "unit": "Bps" - }, - "overrides": [] + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "gridPos": { - "h": 12, - "w": 3, - "x": 15, - "y": 13 + "format": "time_series", + "hide": false, + "rawSql": "SELECT time=getdate(),t.last_check_status,last_check_status_count=count(c.last_check_status)\r\n FROM (\r\n select last_check_status='OK' union all \r\n select last_check_status = 'WARNING' union all \r\n select last_check_status = 'CRITICAL' union all \r\n select last_check_status = 'CHECK ERROR') t\r\n\r\n\touter apply (\r\n\t\tselect last_check_status = case when last_check_status is null then 'CHECK ERROR' else last_check_status end\r\n\t\tfrom [dbo].[sqlwatch_meta_check] mc\r\n\t\twhere [sql_instance] = '$sql_instance'\r\n\t\tand case when last_check_status is null then 'CHECK ERROR' else last_check_status end = t.last_check_status\r\n\t\tand check_enabled = 1\r\n\t\t) c\r\ngroup by t.last_check_status\r\n\r\n order by case t.last_check_status when 'OK' then 1 when 'WARNING' then 2 when 'CRITICAL' then 3 else 4 end ", + "refId": "A" + } + ], + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "rgb(105, 105, 105)", + "mode": "thresholds" + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Batch Requests/sec" + }, + "properties": [ + { + "id": "unit", + "value": "reqps" + }, + { + "id": "displayName", + "value": "Batch Requests" + } + ] }, - "id": 295, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false + { + "matcher": { + "id": "byName", + "options": "Logins/sec" }, - "text": { - "titleSize": 12, - "valueSize": 16 + "properties": [ + { + "id": "displayName", + "value": "Logins" + }, + { + "id": "unit", + "value": "cps" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 2 + }, + { + "color": "red", + "value": 8 + } + ] + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Transactions/sec" }, - "textMode": "auto" + "properties": [ + { + "id": "unit", + "value": "cps" + }, + { + "id": "displayName", + "value": "Transactions" + } + ] }, - "pluginVersion": "7.4.2", - "targets": [ - { - "panelId": 15, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Disk IO", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "/IO/" - } + { + "matcher": { + "id": "byName", + "options": "Availability Group Bytes" + }, + "properties": [ + { + "id": "unit", + "value": "Bps" + }, + { + "id": "noValue", + "value": "N/A" } + ] + }, + { + "matcher": { + "id": "byName", + "options": "SQL Compilations/sec" }, - { - "id": "renameByRegex", - "options": { - "regex": "(.IO$)", - "renamePattern": "" + "properties": [ + { + "id": "unit", + "value": "cps" + }, + { + "id": "displayName", + "value": "SQL Compilations" } - } - ], - "type": "stat" + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 0, + "y": 13 + }, + "id": 269, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": { + "titleSize": 14, + "valueSize": 20 }, + "textMode": "auto" + }, + "pluginVersion": "9.4.7", + "targets": [ { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" + "alias": "", + "datasource": { + "uid": "$DataSource" + }, + "format": "time_series", + "hide": false, + "rawSql": "select \r\n\t time = pc.snapshot_time\r\n\t, 'CPU usage %' = sum(case \r\n\t when 1=1 and mpc.counter_name = 'Processor Time %' then pc.[cntr_value_calculated] \r\n\t --when serverproperty('EngineEdition') = 3 and mpc.counter_name = 'CPU usage %' then pc.[cntr_value_calculated] \r\n\t --when serverproperty('EngineEdition') <> 3 and mpc.counter_name = 'Processor Time %' then pc.[cntr_value_calculated]\r\n\t else null end)\r\n\t, 'Batch Requests/sec' = avg(case when mpc.counter_name = 'Batch Requests/sec' then pc.[cntr_value_calculated] else null end)\r\n\r\n\t, 'Logins/sec' = avg(case when mpc.counter_name = 'Logins/sec' then pc.[cntr_value_calculated] else null end)\r\n\t, 'Transactions/sec' = sum(case when mpc.counter_name = 'Transactions/sec' and pc.instance_name not in ('_Total','mssqlsystemresource') then pc.[cntr_value_calculated] else null end)\r\n\t, 'User Connections' = avg(case when mpc.counter_name = 'User Connections' then pc.[cntr_value_calculated] else null end)\r\n\t, 'SQL Compilations/sec' = avg(case when mpc.counter_name = 'SQL Compilations/sec' then pc.[cntr_value_calculated] else null end)\r\n\t, 'Availability Group Bytes' = avg(case when mpc.counter_name in ('Bytes Sent to Replica/sec','Bytes Received from Replica/sec') then pc.[cntr_value_calculated] else null end)\r\n --\r\n ,'Connection Memory (KB)' = avg(case when mpc.counter_name = 'Connection Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Optimizer Memory (KB)' = avg(case when mpc.counter_name = 'Optimizer Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'SQL Cache Memory (KB)' = avg(case when mpc.counter_name = 'SQL Cache Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Total Server Memory (KB)' = avg(case when mpc.counter_name = 'Total Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Stolen Server Memory (KB)' = avg(case when mpc.counter_name = 'Stolen Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\n ,'Target Server Memory (KB)' = avg(case when mpc.counter_name = 'Target Server Memory (KB)' then pc.[cntr_value_calculated] else null end)\r\nfrom [dbo].[sqlwatch_logger_perf_os_performance_counters] pc\r\n\r\ninner join [dbo].[sqlwatch_meta_performance_counter] mpc\r\n\ton pc.sql_instance = mpc.sql_instance\r\n\tand pc.performance_counter_id = mpc.performance_counter_id\r\n\t\r\nwhere $__timeFilter(pc.snapshot_time)\r\nand pc.snapshot_time >= dateadd(minute,-15,getutcdate())\r\nand pc.[sql_instance] = '$sql_instance'\r\nand mpc.counter_name in ('CPU usage %'\r\n ,'Batch Requests/sec'\r\n ,'Logins/sec'\r\n ,'Transactions/sec'\r\n ,'User Connections'\r\n ,'SQL Compilations/sec'\r\n ,'Bytes Sent to Replica/sec'\r\n ,'Bytes Received from Replica/sec'\r\n ,'Processor Time %'\r\n ,'% Processor Time'\r\n \r\n ,'Connection Memory (KB)'\r\n ,'Optimizer Memory (KB)'\r\n ,'SQL Cache Memory (KB)'\r\n ,'Total Server Memory (KB)'\r\n ,'Stolen Server Memory (KB)'\r\n , 'Target Server Memory (KB)'\r\n )\r\n\r\ngroup by pc.snapshot_time\r\norder by time asc", + "refId": "SQL Server Perf Counters" + } + ], + "title": "Activity", + "transformations": [ + { + "id": "seriesToColumns", + "options": { + "byField": "Time" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "CPU usage %": true, + "Connection Memory (KB)": true, + "Optimizer Memory (KB)": true, + "SQL Cache Memory (KB)": true, + "SQL Compilations/sec": true, + "Stolen Server Memory (KB)": true, + "Target Server Memory (KB)": true, + "Time": true, + "Total Server Memory (KB)": true, + "Wait Time": true + }, + "indexByName": { + "Batch Requests/sec": 1, + "Logins/sec": 3, + "SQL Compilations/sec": 2, + "Time": 0, + "Transactions/sec": 4, + "User Connections": 5 + }, + "renameByName": { + "Bytes Received from Replica/sec": "AG: to Replica", + "Bytes Sent to Replica/sec": "AG: from Replica" + } + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "mssql", + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "rgb(105, 105, 105)", + "mode": "thresholds" + }, + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgb(30, 69, 24)", + "value": null }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "light-orange", - "value": 20 - }, - { - "color": "red", - "value": 50 - } - ] + { + "color": "light-orange", + "value": 800 }, - "unit": "ms" - }, - "overrides": [] + { + "color": "red", + "value": 1000 + } + ] }, - "gridPos": { - "h": 12, - "w": 3, - "x": 18, - "y": 13 + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 3, + "y": 13 + }, + "id": 102, + "links": [], + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "limit": 15, + "values": false + }, + "text": { + "titleSize": 14, + "valueSize": 16 + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" + }, + "editorMode": "code", + "format": "time_series", + "hide": false, + "rawQuery": true, + "rawSql": "SELECT \n [time] = snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n ,[Wait Type] = case when len([wait])>19 then left([wait],19) + '...' else [wait] end\n ,[Wait Time] = sum([wait_time_ms_per_second]) \n --,[Total] = sum([wait_time_ms_per_second]) over (partition by snapshot_time)\n FROM (SELECT wait_time_ms_per_second, wait= case when '$Waits' = 'Category' then [wait_category] else LOWER([wait_type]) end, snapshot_time, RN=ROW_NUMBER() over (partition by wait_category order by wait_time_ms_per_second desc)\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_wait_stats] \n WHERE 1=1\n AND $__timeFilter(snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n ) t\n WHERE 1=1 --t.RN = 1\n GROUP BY case when len([wait])>19 then left([wait],19) + '...' else [wait] end\n ,snapshot_time --$__timeGroup([snapshot_time], $aggregation) \n \nORDER BY\n time asc\n \n ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Top Waits by Total Time", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "pattern": "" + } + } + }, + { + "id": "renameByRegex", + "options": { + "regex": "(.Wait Time)", + "renamePattern": "" + } + } + ], + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "dark-green", + "mode": "fixed" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 6, + "y": 13 + }, + "id": 299, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": false, + "text": { + "titleSize": 12, + "valueSize": 16 + } + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "id": 15, + "format": "time_series", + "hide": false, + "rawSql": "SELECT time = r1.snapshot_time\r\n ,[running] = avg(running)\r\n ,[sleeping] = avg(sleeping)\r\n ,[dormant] = avg(dormant)\r\n ,[preconnect] = avg(preconnect)\r\n ,[cpu_time] = avg(cpu_time)\r\n ,[reads] = avg(reads)\r\n ,[writes] = avg(writes)\r\n , type = case when type = 1 then 'User' else 'System' end\r\n FROM [sqlwatch_logger_dm_exec_sessions_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n and snapshot_time > dateadd(minute,-15,GETUTCDATE())\t\r\n and r1.sql_instance = '$sql_instance'\r\n group by r1.snapshot_time, case when type = 1 then 'User' else 'System' end\r\n order by time asc", + "refId": "2" + } + ], + "title": "Sessions", + "transformations": [ + { + "id": "seriesToColumns", "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": { - "titleSize": 12, - "valueSize": 16 - }, - "textMode": "auto" + "byField": "Time" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "System cpu_time": true, + "System reads": true, + "System writes": true, + "User cpu_time": true, + "User reads": true, + "User writes": true, + "cpu_time": true, + "reads": true, + "writes": true + }, + "indexByName": { + "Time": 0, + "max": 3, + "min": 4, + "sql": 2, + "system": 1 + }, + "renameByName": {} + } + } + ], + "type": "bargauge" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "dark-green", + "mode": "thresholds" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT \n [time] = snapshot_time \n ,[Latency Reads] = MAX(fs.[io_latency_read])\n ,[Latency Writes] = MAX(fs.[io_latency_write])\n \t ,[Reads IO] = AVG(fs.bytes_read_per_second)\n \t ,[Writes IO] = AVG(fs.bytes_written_per_second)\n ,[Disk] = left(upper([file_physical_name]),2) + ' ' + isnull(v.label,'')\n ,[Max Latency] = max(case when fs.[io_latency_read] > fs.[io_latency_write] then fs.[io_latency_read] else fs.[io_latency_write] end) over (partition by snapshot_time )\n FROM [dbo].[vw_sqlwatch_report_fact_perf_file_stats] fs\n outer apply (\n select top 1 label \n from [dbo].[sqlwatch_meta_os_volume] v\n\t where v.volume_name = left(fs.file_physical_name,3)) v\n WHERE 1 = 1\n AND $__timeFilter(fs.snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n AND database_name IN ($database)\n GROUP BY fs.snapshot_time \n , left(upper([file_physical_name]),2) + ' ' + isnull(v.label,'')\n ,case when fs.[io_latency_read] > fs.[io_latency_write] then fs.[io_latency_read] else fs.[io_latency_write] end\nORDER BY\n time ASC", - "refId": "File Stats" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Disk Latency", - "transformations": [ - { - "id": "renameByRegex", - "options": { - "regex": "(.Max Latency)", - "renamePattern": "IGNORE" + "decimals": 0, + "links": [], + "mappings": [], + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "Waiting|Suspended|Runnable" }, - { - "id": "filterFieldsByName", - "options": { - "include": { - "pattern": "/Latency/" + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 1 + }, + { + "color": "red", + "value": 2 + } + ] } } - }, - { - "id": "renameByRegex", - "options": { - "regex": "(.Latency)", - "renamePattern": "" - } - } - ], - "type": "stat" + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 9, + "y": 13 + }, + "id": 296, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, + "showUnfilled": false, + "text": { + "titleSize": 12, + "valueSize": 16 + } + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" + }, + "format": "time_series", + "hide": false, + "rawSql": "SELECT time = r1.snapshot_time\r\n , Background\t= background\r\n , Running = running\r\n , Runnable = runnable\r\n , Sleeping\t = sleeping\r\n , Suspended\t = suspended\r\n , Waiting\t = waiting_tasks\r\n FROM [sqlwatch_logger_dm_exec_requests_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n\tand type = 1\r\n\tand r1.snapshot_time > dateadd(minute,-15,getutcdate())\r\n and r1.sql_instance = '$sql_instance'\r\n order by time asc", + "refId": "A" + } + ], + "title": "User Requests", + "transformations": [ { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" + "id": "filterFieldsByName", + "options": {} + } + ], + "type": "bargauge" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "green", + "mode": "thresholds" + }, + "decimals": 0, + "links": [], + "mappings": [], + "min": 0, + "noValue": "0", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null }, - "custom": {}, - "links": [], - "mappings": [ - { - "from": "", - "id": 1, - "text": "OK", - "to": "", - "type": 1, - "value": "0" - }, - { - "from": "", - "id": 2, - "text": "WARNING", - "to": "", - "type": 1, - "value": "1" - }, - { - "from": "", - "id": 3, - "text": "CRITICAL", - "to": "", - "type": 1, - "value": "2" - }, - { - "from": "", - "id": 4, - "text": "CHECK ERROR", - "to": "", - "type": 1, - "value": "3" + { + "color": "dark-green", + "value": 1 + } + ] + }, + "unit": "deckbytes" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Memory Deficit" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 1024 + }, + { + "color": "red", + "value": 1025 + } + ] } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "rgba(115, 191, 105, 0)", - "value": null - }, - { - "color": "rgb(30, 69, 24)", - "value": 0 - }, - { - "color": "light-orange", - "value": 1 - }, - { - "color": "red", - "value": 2 - }, + }, + { + "id": "noValue", + "value": "0" + }, + { + "id": "mappings", + "value": [ { - "color": "dark-purple", - "value": 3 + "options": { + "from": -10000000000000000, + "result": { + "text": "0" + }, + "to": 0 + }, + "type": "range" } ] } - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 3, - "x": 21, - "y": 13 + ] + } + ] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 12, + "y": 13 + }, + "id": 300, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "/.*/", + "values": false + }, + "text": { + "titleSize": 12, + "valueSize": 16 + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" }, - "id": 224, + "panelId": 269, + "refId": "A" + } + ], + "title": "SQL Memory", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "Connection Memory (KB)", + "Optimizer Memory (KB)", + "SQL Cache Memory (KB)", + "Total Server Memory (KB)", + "Stolen Server Memory (KB)", + "Target Server Memory (KB)", + "Time" + ] + } + } + }, + { + "id": "calculateField", "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "limit": 15, - "values": true + "alias": "Memory Deficit", + "binary": { + "left": "Target Server Memory (KB)", + "operator": "-", + "reducer": "sum", + "right": "Total Server Memory (KB)" }, - "text": { - "titleSize": 14, - "valueSize": 13 + "mode": "binary", + "reduce": { + "reducer": "sum" }, - "textMode": "name" - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "hide": false, - "rawSql": "SELECT top 15 time=isnull(last_check_date,getutcdate()),[check_name] = CASE WHEN LEN([check_name]) > 28 THEN LEFT(check_name,27) + '...' ELSE [check_name] END\n ,status = CASE [last_check_status] \n WHEN 'CRITICAL' THEN 2\n WHEN 'WARNING' THEN 1\n WHEN 'OK' THEN 0\n ELSE 3 END\n FROM (select last_check_date , check_name = (replace(replace([check_name],'Database',''),' failure count',''))\n , last_check_status = case when last_check_status is null then 'CHECK ERROR' else last_check_status end\n from [dbo].[vw_sqlwatch_report_dim_check] with (nolock)\n WHERE [target_sql_instance] = '$sql_instance'\n AND check_enabled = 1\n ) t\n --AND last_check_status <> 'ok'\n --AND $__timeFilter(last_check_date)\n --AND last_check_status IN ($Status)\n order by case when last_check_status = 'OK' then dateadd(month,-12,last_check_date) else isnull(last_check_date,getutcdate()) end desc", - "refId": "A" + "replaceFields": false + } + }, + { + "id": "renameByRegex", + "options": { + "regex": "(\\(KB\\))", + "renamePattern": "" + } + }, + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "Connection Memory ", + "Optimizer Memory ", + "SQL Cache Memory ", + "Total Server Memory ", + "Stolen Server Memory ", + "Target Server Memory ", + "Memory Deficit" + ] } - ], - "timeFrom": null, - "timeShift": null, - "title": "Checks", - "transformations": [ - { - "id": "filterFieldsByName", - "options": {} - }, - { - "id": "organize", - "options": { - "excludeByName": {}, - "indexByName": { - "check_description": 1, - "check_name": 0, - "last_check_value": 3, - "status": 2 - }, - "renameByName": { - "check_description": "Description", - "check_name": "", - "last_check_date": "Check Date", - "last_check_value": "", - "status": "" - } + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "rgb(105, 105, 105)", + "mode": "thresholds" + }, + "decimals": 0, + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null } + ] + }, + "unit": "Bps" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 15, + "y": 13 + }, + "id": 295, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": { + "titleSize": 12, + "valueSize": 16 + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "panelId": 15, + "refId": "A" + } + ], + "title": "Disk IO", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "pattern": "/IO/" } - ], - "type": "stat" + } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "id": "renameByRegex", + "options": { + "regex": "(.IO$)", + "renamePattern": "" + } + } + ], + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 25 + "decimals": 0, + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "light-orange", + "value": 20 + }, + { + "color": "red", + "value": 50 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 18, + "y": 13 + }, + "id": 15, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": { + "titleSize": 12, + "valueSize": 16 + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "id": 297, + "format": "time_series", + "hide": false, + "rawSql": "SELECT \n [time] = snapshot_time \n ,[Latency Reads] = MAX(fs.[io_latency_read])\n ,[Latency Writes] = MAX(fs.[io_latency_write])\n \t ,[Reads IO] = AVG(fs.bytes_read_per_second)\n \t ,[Writes IO] = AVG(fs.bytes_written_per_second)\n ,[Disk] = left(upper([file_physical_name]),2) + ' ' + isnull(v.label,'')\n ,[Max Latency] = max(case when fs.[io_latency_read] > fs.[io_latency_write] then fs.[io_latency_read] else fs.[io_latency_write] end) over (partition by snapshot_time )\n FROM [dbo].[vw_sqlwatch_report_fact_perf_file_stats] fs\n outer apply (\n select top 1 label \n from [dbo].[sqlwatch_meta_os_volume] v\n\t where v.volume_name = left(fs.file_physical_name,3)) v\n WHERE 1 = 1\n AND $__timeFilter(fs.snapshot_time)\n and snapshot_time >= dateadd(minute,-15,getutcdate())\n AND [sql_instance] = '$sql_instance'\n AND database_name IN ($database)\n GROUP BY fs.snapshot_time \n , left(upper([file_physical_name]),2) + ' ' + isnull(v.label,'')\n ,case when fs.[io_latency_read] > fs.[io_latency_write] then fs.[io_latency_read] else fs.[io_latency_write] end\nORDER BY\n time ASC", + "refId": "File Stats" + } + ], + "title": "Disk Latency", + "transformations": [ + { + "id": "renameByRegex", "options": { - "content": " ", - "mode": "html" + "regex": "(.Max Latency)", + "renamePattern": "IGNORE" + } + }, + { + "id": "filterFieldsByName", + "options": { + "include": { + "pattern": "/Latency/" + } + } + }, + { + "id": "renameByRegex", + "options": { + "regex": "(.Latency)", + "renamePattern": "" + } + } + ], + "type": "stat" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "pluginVersion": "7.4.2", - "targets": [ + "links": [], + "mappings": [ { - "queryType": "randomWalk", - "refId": "A" + "options": { + "0": { + "text": "OK" + }, + "1": { + "text": "WARNING" + }, + "2": { + "text": "CRITICAL" + }, + "3": { + "text": "CHECK ERROR" + } + }, + "type": "value" } ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transparent": true, - "type": "text" - }, - { - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "fixedColor": "rgb(51, 51, 51)", - "mode": "fixed" + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(115, 191, 105, 0)", + "value": null }, - "custom": {}, - "decimals": 0, - "links": [], - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - } - ] + { + "color": "rgb(30, 69, 24)", + "value": 0 }, - "unit": "none" - }, - "overrides": [ { - "matcher": { - "id": "byRegexp", - "options": "/Size/" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - } - ] + "color": "light-orange", + "value": 1 + }, + { + "color": "red", + "value": 2 }, { - "matcher": { - "id": "byRegexp", - "options": "/Growth/" - }, - "properties": [ - { - "id": "unit", - "value": "decbytes" - } - ] + "color": "dark-purple", + "value": 3 } ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 3, + "x": 21, + "y": 13 + }, + "id": 224, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "limit": 15, + "values": true + }, + "text": { + "titleSize": 14, + "valueSize": 13 + }, + "textMode": "name" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "gridPos": { - "h": 5, - "w": 4, - "x": 0, - "y": 26 - }, - "id": 225, + "format": "time_series", + "hide": false, + "rawSql": "SELECT top 15 time=isnull(last_check_date,getutcdate()),[check_name] = CASE WHEN LEN([check_name]) > 28 THEN LEFT(check_name,27) + '...' ELSE [check_name] END\n ,status = CASE [last_check_status] \n WHEN 'CRITICAL' THEN 2\n WHEN 'WARNING' THEN 1\n WHEN 'OK' THEN 0\n ELSE 3 END\n FROM (select last_check_date , check_name = (replace(replace([check_name],'Database',''),' failure count',''))\n , last_check_status = case when last_check_status is null then 'CHECK ERROR' else last_check_status end\n from [dbo].[vw_sqlwatch_report_dim_check] with (nolock)\n WHERE [target_sql_instance] = '$sql_instance'\n AND check_enabled = 1\n ) t\n --AND last_check_status <> 'ok'\n --AND $__timeFilter(last_check_date)\n --AND last_check_status IN ($Status)\n order by case when last_check_status = 'OK' then dateadd(month,-12,last_check_date) else isnull(last_check_date,getutcdate()) end desc", + "refId": "A" + } + ], + "title": "Checks", + "transformations": [ + { + "id": "filterFieldsByName", + "options": {} + }, + { + "id": "organize", "options": { - "colorMode": "background", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "text": { - "titleSize": 14, - "valueSize": 16 + "excludeByName": {}, + "indexByName": { + "check_description": 1, + "check_name": 0, + "last_check_value": 3, + "status": 2 }, - "textMode": "value_and_name" + "renameByName": { + "check_description": "Description", + "check_name": "", + "last_check_date": "Check Date", + "last_check_value": "", + "status": "" + } + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 25 + }, + "id": 297, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": " ", + "mode": "html" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "table", - "hide": false, - "rawSql": "select \r\n\t s.servername\r\n\t, 'All Databases' = [Databases]\r\n\t, 'Total Data Size' = [Data Size]\r\n\t, 'Total Growth Per Day' = [Growth per day]\r\n\t, 'All Agent Jobs' = [Jobs]\r\nfrom dbo.sqlwatch_meta_server s\r\n\r\nouter apply (\r\n\tselect\r\n\t [Databases]=count(db.database_name)\r\n\t, [Data Size]=sum([database_size_bytes_current])\r\n\t, [Growth per day]=sum(database_growth_bytes_per_day)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_database] db\r\n\twhere db.sql_instance = s.sql_instance\r\n) dbs\r\n\r\nouter apply (\r\n\tselect \r\n\t\t[Jobs]=count(jb.job_name)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_agent_job] jb\r\n\twhere jb.sql_instance = s.sql_instance\r\n) jbs", - "refId": "Basic Stats" + "queryType": "randomWalk", + "refId": "A" + } + ], + "transparent": true, + "type": "text" + }, + { + "datasource": { + "uid": "$DataSource" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "rgb(51, 51, 51)", + "mode": "fixed" + }, + "decimals": 0, + "links": [], + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/Size/" }, - { - "alias": "", - "format": "table", - "hide": false, - "rawSql": "select \r\n\t s.servername\r\n\t, 'SQLWATCH Data Size' = [Data Size]\r\n\t, 'SQLWATCH Growth Per Day' = [Growth per day]\r\nfrom dbo.sqlwatch_meta_server s\r\n\r\nouter apply (\r\n\tselect\r\n\t [Databases]=count(db.database_name)\r\n\t, [Data Size]=sum([database_size_bytes_current])\r\n\t, [Growth per day]=sum(database_growth_bytes_per_day)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_database] db\r\n\twhere db.sql_instance = s.sql_instance\r\n\tand db.database_name = DB_NAME()\r\n) dbs\r\n", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transformations": [ - { - "id": "seriesToColumns", - "options": { - "byField": "servername" + "properties": [ + { + "id": "unit", + "value": "decbytes" } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "/Growth/" }, - { - "id": "organize", - "options": { - "excludeByName": { - "SQLWATCH Database": false - }, - "indexByName": { - "All Agent Jobs": 4, - "All Databases": 1, - "SQLWATCH Data Size": 5, - "SQLWATCH Growth Per Day": 6, - "Total Data Size": 2, - "Total Growth Per Day": 3, - "servername": 0 - }, - "renameByName": {} + "properties": [ + { + "id": "unit", + "value": "decbytes" } - } - ], - "transparent": true, - "type": "stat" + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 0, + "y": 26 + }, + "id": 225, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, + "text": { + "titleSize": 14, + "valueSize": 16 + }, + "textMode": "value_and_name" + }, + "pluginVersion": "9.4.7", + "targets": [ { - "datasource": "${DataSource}", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": {}, - "decimals": 0, - "mappings": [], - "max": 1, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "dark-green", - "value": null - }, - { - "color": "orange", - "value": 0.8 - }, - { - "color": "red", - "value": 0.95 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "gridPos": { - "h": 5, - "w": 6, - "x": 4, - "y": 26 + "format": "table", + "hide": false, + "rawSql": "select \r\n\t s.servername\r\n\t, 'All Databases' = [Databases]\r\n\t, 'Total Data Size' = [Data Size]\r\n\t, 'Total Growth Per Day' = [Growth per day]\r\n\t, 'All Agent Jobs' = [Jobs]\r\nfrom dbo.sqlwatch_meta_server s\r\n\r\nouter apply (\r\n\tselect\r\n\t [Databases]=count(db.database_name)\r\n\t, [Data Size]=sum([database_size_bytes_current])\r\n\t, [Growth per day]=sum(database_growth_bytes_per_day)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_database] db\r\n\twhere db.sql_instance = s.sql_instance\r\n) dbs\r\n\r\nouter apply (\r\n\tselect \r\n\t\t[Jobs]=count(jb.job_name)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_agent_job] jb\r\n\twhere jb.sql_instance = s.sql_instance\r\n) jbs", + "refId": "Basic Stats" + }, + { + "alias": "", + "datasource": { + "uid": "$DataSource" }, - "id": 293, + "format": "table", + "hide": false, + "rawSql": "select \r\n\t s.servername\r\n\t, 'SQLWATCH Data Size' = [Data Size]\r\n\t, 'SQLWATCH Growth Per Day' = [Growth per day]\r\nfrom dbo.sqlwatch_meta_server s\r\n\r\nouter apply (\r\n\tselect\r\n\t [Databases]=count(db.database_name)\r\n\t, [Data Size]=sum([database_size_bytes_current])\r\n\t, [Growth per day]=sum(database_growth_bytes_per_day)\r\n\tfrom [dbo].[vw_sqlwatch_report_dim_database] db\r\n\twhere db.sql_instance = s.sql_instance\r\n\tand db.database_name = DB_NAME()\r\n) dbs\r\n", + "refId": "A" + } + ], + "transformations": [ + { + "id": "seriesToColumns", "options": { - "displayMode": "basic", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "text": { - "titleSize": 12, - "valueSize": 16 - } - }, - "pluginVersion": "7.4.2", - "targets": [ - { - "alias": "", - "format": "time_series", - "queryType": "randomWalk", - "rawSql": "select time=date_last_seen, left([volume_name],2)+ ' ' + isnull(label,''),1.0-[free_space_percentage]\nfrom [dbo].[vw_sqlwatch_report_dim_os_volume] \nwhere sql_instance = '$sql_instance'\norder by left([volume_name],2)", - "refId": "A" - } - ], - "title": "Disk Space Used %", - "type": "bargauge" + "byField": "servername" + } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} + "id": "organize", + "options": { + "excludeByName": { + "SQLWATCH Database": false }, - "overrides": [] + "indexByName": { + "All Agent Jobs": 4, + "All Databases": 1, + "SQLWATCH Data Size": 5, + "SQLWATCH Growth Per Day": 6, + "Total Data Size": 2, + "Total Growth Per Day": 3, + "servername": 0 + }, + "renameByName": {} + } + } + ], + "transparent": true, + "type": "stat" + }, + { + "datasource": { + "type": "mssql", + "uid": "${DataSource}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 31 + "decimals": 0, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-green", + "value": null + }, + { + "color": "orange", + "value": 0.8 + }, + { + "color": "red", + "value": 0.95 + } + ] }, - "id": 305, - "options": { - "content": " ", - "mode": "html" + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 6, + "x": 4, + "y": 26 + }, + "id": 293, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showUnfilled": true, + "text": { + "titleSize": 12, + "valueSize": 16 + } + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "alias": "", + "datasource": { + "uid": "${DataSource}" + }, + "editorMode": "code", + "format": "time_series", + "queryType": "randomWalk", + "rawQuery": true, + "rawSql": "select time=date_last_seen, disk=left([volume_name],2)+ ' ' + isnull(label,''),1.0-[free_space_percentage]\nfrom [dbo].[vw_sqlwatch_report_dim_os_volume] \nwhere sql_instance = '$sql_instance'\norder by left([volume_name],2) asc", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Disk Space Used %", + "type": "bargauge" + }, + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 31 + }, + "id": 305, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": " ", + "mode": "html" + }, + "pluginVersion": "9.4.7", + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, - "pluginVersion": "7.4.2", - "targets": [ - { - "queryType": "randomWalk", - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "", - "transparent": true, - "type": "text" + "queryType": "randomWalk", + "refId": "A" } ], - "repeat": null, - "title": "$sql_instance: SQL Server Overview", - "type": "row" + "transparent": true, + "type": "text" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 1 + "y": 32 }, "id": 257, "panels": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 6, @@ -2247,19 +2351,25 @@ }, "id": 159, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# SQL Server Blocking Chains\r\n*****\r\nBlocking chains happen when one query is holding back other queries. This happens when poorly written query is holding excessive and exclusive locks on tables. Relational databases are written with ACID properties in mind, \r\nthis means that in order to retain data integrity, only one query at a time can modify the data. To achieve this, a lock is applied so no other queries can even read the data to avoid partially written data being displayed back to the client. When blocking chains happen for long period of time, you will have the impression that the database is slow, even though it isn't. It's just doing its job. It is important to undertand how locking works to avoid blocking chains.\r\n\r\nThese graphs come from data recorded in the Extended Events Session. For this to work, you must enable blocked process monitor: `sp_configure 'blocked process threshold', 5 ; -- set desired value in seconds`", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -2268,19 +2378,11 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "decimals": 0, "description": "", - "fieldConfig": { - "defaults": { - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - } - }, - "overrides": [] - }, "fill": 1, "fillGradient": 0, "gridPos": { @@ -2307,7 +2409,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 3, "points": false, "renderer": "flot", @@ -2324,6 +2426,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT time = $__timeGroup(h.snapshot_time, $aggregation, previous)\r\n ,[Blocking Session Count] = count(session_id)\r\n FROM dbo.sqlwatch_logger_snapshot_header h\r\n left join [dbo].[ufn_sqlwatch_get_blocking_chains] ($__timeFrom(), $__timeTo(),'$sql_instance') r1\r\n on h.snapshot_time = r1.snapshot_time\r\n and h.snapshot_type_id = r1.snapshot_type_id\r\n and h.sql_instance = r1.sql_instance\r\n and blocking_session_id is null -- header only \r\n where $__timeFilter(h.snapshot_time)\r\n and h.snapshot_type_id = 9\r\n group by $__timeGroup(h.snapshot_time, $aggregation, previous), convert(varchar(10),session_id)\r\n \r\n order by time asc", @@ -2331,9 +2436,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Blocking Sessions Count", "tooltip": { "shared": false, @@ -2365,9 +2468,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2376,34 +2477,25 @@ "$$hashKey": "object:1165", "decimals": 0, "format": "short", - "label": null, "logBase": 1, - "max": null, "min": "0", "show": true }, { "$$hashKey": "object:1166", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 2, @@ -2413,31 +2505,33 @@ }, "id": 276, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "The Extended Events Session captures blocking chains according to the time set for the Blocking Process Monitor `select * from sys.configurations where name like 'blocked process threshold%`.\r\nFor example, if the monitor is set to 5 seconds and we have a blocking chain lasting 21 seconds, it will record it 4 times, every 5 seconds. All four occurences will be shown below.", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, { - "datasource": "${DataSource}", - "description": "", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "uid": "${DataSource}" }, + "description": "", "gridPos": { "h": 10, "w": 24, @@ -2446,6 +2540,10 @@ }, "id": 255, "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, "showLabels": false, "showTime": true, "sortOrder": "Descending", @@ -2455,6 +2553,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "${DataSource}" + }, "format": "table", "queryType": "randomWalk", "rawSql": "select time=x.event_time, blocking_tree + ' (' + isnull(x.appname,'') + '; ' + isnull(x.hostname,'') + ') SQL: ' + isnull(x.sql_text,'') \nfrom [dbo].[ufn_sqlwatch_get_blocking_chains] ($__timeFrom(), $__timeTo(),'$sql_instance') x\n\norder by time", @@ -2466,49 +2567,64 @@ "type": "logs" } ], + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "refId": "A" + } + ], "title": "$sql_instance: SQL Server Blocking", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 2 + "y": 33 }, "id": 263, "panels": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 9, "w": 24, "x": 0, - "y": 3 + "y": 58 }, "id": 265, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# SQL Server Requests\r\n*****\r\nList of current requests sampled from `dm_exec_requests`.\r\n\r\n**Runnable** - The session has been assigned a worker thread but it is waiting for CPU to become available.\r\nMany runnable threads would indicate CPU bottleneck.\r\n\r\n**Pending** - The session is awaiting a worker thread to be assigned. Unitil a workthread is assigned the session will not run even if the CPU is available.\r\nIn most cases, the worker will not be assigned due to CPU bottlenecks but in some cases, you may encounter a thread exhaustion.\r\nThis is a scenerio where SQL Server ran out of threads to allocate.\r\n\r\n**Suspended** - The session was running but has been put on hold due to lack of resources. Suspended session will likely have `wait_type` assigned to them.\r\n\r\n**Sleeping** - Sessions that SQL Server has put \"to sleep\" as they are not doing anything or could have ended recently but the connetion is still open. \r\nThis may be often observed with .NET Connection pooling. \r\n\r\nThis data provides a very high level view of the SQL Server Requests and Sessions. Becuase of the data sampling, we could be misssing a lot of the workload that happens between samples. However, this is by design, we do not want to capture too much of meaningless workload. Any transactions that cause trouble will be captured by Extended Events", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -2517,25 +2633,17 @@ "bars": true, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - } - }, - "overrides": [] + "datasource": { + "uid": "$DataSource" }, + "description": "", "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 24, "x": 0, - "y": 12 + "y": 67 }, "hiddenSeries": false, "id": 264, @@ -2556,7 +2664,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -2593,6 +2701,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT time = $__timeGroup(r1.snapshot_time, $aggregation,0)\r\n , background\t= avg(background)\r\n , running = avg(running)\t\r\n , runnable = avg(runnable)\t\r\n , sleeping\t = avg(sleeping)\r\n , suspended\t = avg(suspended)\r\n , waiting_tasks\t = avg(waiting_tasks)\r\n -- , wait_duration_ms = avg(wait_duration_ms)\r\n , type = case when type = 1 then 'User' else 'System' end\r\n FROM [sqlwatch_logger_dm_exec_requests_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n and r1.sql_instance = '$sql_instance'\r\n and type = 1\r\n group by $__timeGroup(r1.snapshot_time, $aggregation,0), case when type = 1 then 'User' else 'System' end\r\n order by time asc", @@ -2600,9 +2711,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "User Requests by Status", "tooltip": { "shared": true, @@ -2631,9 +2740,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2642,56 +2749,53 @@ "$$hashKey": "object:1699", "decimals": 0, "format": "short", - "label": null, "logBase": 1, - "max": null, "min": "0", "show": true }, { "$$hashKey": "object:1700", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 3, "w": 24, "x": 0, - "y": 19 + "y": 74 }, "id": 272, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# SQL Server Sessions\r\n*****\r\nList of current sessions sampled from `dm_exec_sessions`.\r\n", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -2700,25 +2804,17 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", - "description": "", - "fieldConfig": { - "defaults": { - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - } - }, - "overrides": [] + "datasource": { + "uid": "$DataSource" }, + "description": "", "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 24, "x": 0, - "y": 22 + "y": 77 }, "hiddenSeries": false, "id": 271, @@ -2739,7 +2835,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -2773,6 +2869,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT time = $__timeGroup(r1.snapshot_time, $aggregation)\r\n ,[running] = avg(running)\r\n ,[sleeping] = avg(sleeping)\r\n ,[dormant] = avg(dormant)\r\n ,[preconnect] = avg(preconnect)\r\n ,[cpu_time] = avg(cpu_time)\r\n ,[reads] = avg(reads)\r\n ,[writes] = avg(writes)\r\n , type = case when type = 1 then 'User' else 'System' end\r\n FROM [sqlwatch_logger_dm_exec_sessions_stats] r1 (nolock)\r\n\twhere $__timeFilter(r1.snapshot_time)\r\n and r1.sql_instance = '$sql_instance'\r\n and type = 1\r\n group by $__timeGroup(r1.snapshot_time, $aggregation), case when type = 1 then 'User' else 'System' end\r\n order by time asc", @@ -2780,9 +2879,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "User Sessions by Status", "tooltip": { "shared": true, @@ -2828,9 +2925,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2841,7 +2936,6 @@ "format": "short", "label": "", "logBase": 2, - "max": null, "min": "0", "show": true }, @@ -2851,14 +2945,12 @@ "format": "short", "label": "", "logBase": 10, - "max": null, "min": "0", "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { @@ -2866,25 +2958,18 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "-- Dashboard --", - "description": "", - "fieldConfig": { - "defaults": { - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - } - }, - "overrides": [] + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" }, + "description": "", "fill": 1, "fillGradient": 0, "gridPos": { "h": 7, "w": 24, "x": 0, - "y": 29 + "y": 84 }, "hiddenSeries": false, "id": 277, @@ -2905,7 +2990,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -2915,14 +3000,16 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "panelId": 271, "refId": "A" } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "User Sessions by Resource", "tooltip": { "shared": true, @@ -2972,9 +3059,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -2985,7 +3070,6 @@ "format": "short", "label": "Active", "logBase": 1, - "max": null, "min": "0", "show": true }, @@ -2995,60 +3079,73 @@ "format": "short", "label": "Sleeping", "logBase": 10, - "max": null, "min": "0", "show": false } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } } ], + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "refId": "A" + } + ], "title": "$sql_instance: SQL Server Requests and Sessions", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 3 + "y": 34 }, "id": 187, "panels": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 5, "w": 24, "x": 0, - "y": 4 + "y": 92 }, "id": 259, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# SQL Server Activity and Workload\r\n*****\r\n## CPU\r\nThe CPU chart is split into System (OS) and SQL Server. In an ideal scenario, all of the utilistaison should be allocated to SQL Server and only very small amount to system. SQL Server is also licensed per core, the more CPU cores the most expensive the license. You do not want to be paying a lot of money and not use it. [See Long Queries captured during this period](/d/sqlwatch-long-queries/long-queries?${__url_time_range}&var-DataSource=${DataSource}&var-sql_instance=${sql_instance})\r\nIf you are seeing a lot of OS Utilisation but not a lot of SQL Server utilistaion it means there is something else in the OS that uses CPU. It could be that you are running multiple SQL Instances?", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -3057,16 +3154,13 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "description": "", "fieldConfig": { "defaults": { - "custom": {}, - "links": [], - "thresholds": { - "mode": "absolute", - "steps": [] - } + "links": [] }, "overrides": [] }, @@ -3076,7 +3170,7 @@ "h": 7, "w": 24, "x": 0, - "y": 9 + "y": 97 }, "hiddenSeries": false, "id": 258, @@ -3097,7 +3191,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -3143,6 +3237,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT \n [time] = $__timeGroup([snapshot_time], $aggregation, previous)\n ,[min] = min([cntr_value_calculated])\n ,[max] = max([cntr_value_calculated])\n FROM (\n select snapshot_time, [cntr_value_calculated]=sum([cntr_value_calculated])\n from [dbo].[sqlwatch_logger_perf_os_performance_counters] pc (readpast)\n\t\tinner join [dbo].[sqlwatch_meta_performance_counter] mpc (readpast)\n\t\t\ton pc.sql_instance = mpc.sql_instance\n\t\t\tand pc.performance_counter_id = mpc.performance_counter_id \n WHERE $__timeFilter(pc.snapshot_time)\n AND mpc.counter_name = 'Processor Time %' --case when serverproperty('EngineEdition') = 3 then 'CPU usage %' else 'Processor Time %' end\n --and pc.instance_name NOT IN ('internal')\n AND pc.[sql_instance] = '$sql_instance' \n group by snapshot_time\n ) t\n GROUP BY $__timeGroup([snapshot_time], $aggregation)\nORDER BY\n time ASC\n\n ", @@ -3150,6 +3247,9 @@ }, { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT \n [time] = $__timeGroup(pc.[snapshot_time], $aggregation, previous)\n ,metric = case when instance_name = 'system' then 'OS' else 'SQL Server' end\n ,[value] = avg(pc.[cntr_value_calculated])\n FROM [dbo].[sqlwatch_logger_perf_os_performance_counters] pc\n\t\tinner join [dbo].[sqlwatch_meta_performance_counter] mpc\n\t\t\ton pc.sql_instance = mpc.sql_instance\n\t\t\tand pc.performance_counter_id = mpc.performance_counter_id \n WHERE $__timeFilter(pc.snapshot_time)\n AND mpc.counter_name IN ('Processor Time %')\n and pc.instance_name IN ('sql','system')\n AND pc.[sql_instance] = '$sql_instance'\n GROUP BY $__timeGroup(pc.[snapshot_time], $aggregation) , case when instance_name = 'system' then 'OS' else 'SQL Server' end\nORDER BY\n time ASC\n \n ", @@ -3157,9 +3257,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Processor Utilisation", "tooltip": { "shared": true, @@ -3191,9 +3289,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3211,79 +3307,81 @@ { "$$hashKey": "object:192", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 3, "w": 24, "x": 0, - "y": 16 + "y": 104 }, "id": 192, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# Captured Wait Events\r\nWait events longer than 1 second captured by extended events session.\r\n[See captured queries and transactions that have contributed to the wait](/d/sqlwatch-wait-events/wait-events?${__url_time_range}&var-DataSource=${DataSource}&var-sql_instance=${sql_instance})", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 11, "w": 24, "x": 0, - "y": 19 + "y": 107 }, "id": 43, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": " \r\n\r\n## Activity \r\n\r\n**Batch Requests/sec**: The number of batch requests received per second and is a good general indicator for the activity level of the SQL Server. This counter is highly dependent on the hardware and quality of code running on the server. The more powerful the hardware, the higher this number can be, even on poorly coded applications. A value of 1000 batch requests/sec is easily attainable, though a typical 100Mbs NIC can only handle about 3000 batch requests/sec. Many other counter thresholds depend upon batch requests/sec while, in some cases, a low (or high) number does not point to poor processing power. You should frequently use this counter in combination with other counters, such as processor utilization or user connections. In version 2000, \"Transactions/ sec\" was the counter most often used to measure overall activity, while versions 2005 and later use \"Batch Requests/sec\". Versions 2005 before SP2, measure this counter differently and may lead to some misunderstandings. Read the footnote for more details.\r\n\r\n**SQL Compilations/sec**: Number of times that Transact-SQL compilations occurred, per second (including recompiles). The lower this value is the better. High values often indicate excessive ad-hoc querying and should be as low as possible. If excessive ad-hoc querying is happening, try rewriting the queries as procedures or invoke the queries using sp_executeSQL. When rewriting isn’t possible, consider using a plan guide or setting the database to parameterization forced mode.\r\n\r\n**SQL Re-Compilations/sec**: The number of times, per second, that Transact-SQL objects attempted to be executed but had to be recompiled before completion. This number should be at or near zero since recompiles can cause deadlocks and exclusive compile locks. This counter’s value should follow in proportion to \"Batch Requests/sec\" and \"SQL Compilations/ sec\". This needs to be nil in your system as much as possible.\r\n\r\n**Logins/sec**: *You want < 2* The number of user logins per second. Any value over 2 may indicate insufficient connection pooling.\r\n\r\nUser Connections: The number of users currently connected to the SQL Server. This counter should roughly track with \"Batch Requests/Sec\". They should generally rise and fall together. For example, blocking problems could be revealed by rising user connections, lock waits and lock wait time coupled with declining batch requests/sec.\r\n\r\n**Transactions/sec**: Number of transactions started for the database per second.", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -3292,17 +3390,12 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", - "decimals": null, + "datasource": { + "uid": "$DataSource" + }, "description": "", "fieldConfig": { "defaults": { - "color": {}, - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - }, "unit": "short" }, "overrides": [] @@ -3313,7 +3406,7 @@ "h": 7, "w": 24, "x": 0, - "y": 30 + "y": 118 }, "hiddenSeries": false, "id": 231, @@ -3337,7 +3430,7 @@ "alertThreshold": false }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -3348,6 +3441,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "select t.*\n\t --rate calcs\n\t ,[SQL Compilations Rate] = case when [Batch Requests/sec] > 0 then [SQL Compilations/sec] / [Batch Requests/sec] else 0 end\n\t ,[SQL Re-Compilations Rate] = case when [SQL Compilations/sec] > 0 then [SQL Re-Compilations/sec] / [SQL Compilations/sec] else 0 end\nfrom (\n SELECT \n [time] = $__timeGroup([snapshot_time], $aggregation) \n \t\t ,'SQL Compilations/sec' = AVG(case when counter_name = 'SQL Compilations/sec' then [cntr_value_calculated] else null end)\n \t\t ,'SQL Re-Compilations/sec' = AVG(case when counter_name = 'SQL Re-Compilations/sec' then [cntr_value_calculated] else null end)\n \t\t ,'Batch Requests/sec' = AVG(case when counter_name = 'Batch Requests/sec' then [cntr_value_calculated] else null end)\n \t\t ,'Logins/sec' = AVG(case when counter_name = 'Logins/sec' then [cntr_value_calculated] else null end)\n \t\t ,'Transactions/sec' = AVG(case when counter_name = 'Transactions/sec' then [cntr_value_calculated] else null end)\n \t\t ,'User Connections' = AVG(case when counter_name = 'User Connections' then [cntr_value_calculated] else null end)\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_performance_counters]\n WHERE [aggregation_interval_minutes] = 0\n AND $__timeFilter(snapshot_time)\n AND counter_name IN (\n \t\t'SQL Compilations/sec'\n \t\t,'SQL Re-Compilations/sec'\n \t\t,'Batch Requests/sec'\n \t\t,'Logins/sec'\n \t\t,'Transactions/sec'\n \t\t,'User Connections'\n \t\t,'SQL Compilations/sec'\n \t\t,'SQL Re-Compilations/sec')\n AND [sql_instance] = '$sql_instance'\n GROUP BY $__timeGroup([snapshot_time], $aggregation)\n ) t\nORDER BY\n time ASC\noption (keep plan)", @@ -3355,9 +3451,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Activity", "tooltip": { "shared": true, @@ -3398,36 +3492,27 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, "yaxes": [ { "$$hashKey": "object:1758", - "decimals": null, "format": "short", "label": "", "logBase": 1, - "max": null, - "min": null, "show": true }, { "$$hashKey": "object:1759", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": false } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { @@ -3435,16 +3520,13 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "description": "", "fieldConfig": { "defaults": { - "custom": {}, - "links": [], - "thresholds": { - "mode": "absolute", - "steps": [] - } + "links": [] }, "overrides": [] }, @@ -3454,7 +3536,7 @@ "h": 7, "w": 24, "x": 0, - "y": 37 + "y": 125 }, "hiddenSeries": false, "hideTimeOverride": false, @@ -3476,7 +3558,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -3487,6 +3569,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT \n [time] = $__timeGroup([snapshot_time], $aggregation) \n ,metric = [instance_name]\n ,[value] = AVG([cntr_value_calculated])\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_performance_counters]\n WHERE [aggregation_interval_minutes] = 0\n AND $__timeFilter(snapshot_time)\n AND counter_name IN ('Transactions/sec')\n AND instance_name IN ($database)\n AND [sql_instance] = '$sql_instance'\n GROUP BY [instance_name]\n ,$__timeGroup([snapshot_time], $aggregation) \nORDER BY\n time ASC\n option (keep plan)\n ", @@ -3494,9 +3579,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Database Transactions /sec", "tooltip": { "shared": true, @@ -3506,9 +3589,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3519,54 +3600,52 @@ "format": "short", "label": "", "logBase": 1, - "max": null, "min": "0", "show": true }, { "$$hashKey": "object:1841", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 6, "w": 24, "x": 0, - "y": 44 + "y": 132 }, "id": 109, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "SQL Compilations/sec: You want it to be < 10% (of the number of Batch Requests/Sec). Number of times that Transact-SQL compilations occurred, per second (including recompiles). The lower this value is the better. High values often indicate excessive ad-hoc querying and should be as low as possible. If excessive ad-hoc querying is happening, try rewriting the queries as procedures or invoke the queries using sp_executeSQL. When rewriting isn’t possible, consider using a plan guide or setting the database to parameterization forced mode.
\r\n\r\nSQL Re-Compilations/sec: You want it to be < 10% (of the number of SQL Compilations/sec). The number of times, per second, that Transact-SQL objects attempted to be executed but had to be recompiled before completion. This number should be at or near zero since recompiles can cause deadlocks and exclusive compile locks. This counter’s value should follow in proportion to \"Batch Requests/sec\" and \"SQL Compilations/ sec\". This needs to be nil in your system as much as possible.
\r\n", "mode": "html" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -3575,16 +3654,14 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "-- Dashboard --", + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "description": "", "fieldConfig": { "defaults": { - "custom": {}, - "links": [], - "thresholds": { - "mode": "absolute", - "steps": [] - } + "links": [] }, "overrides": [] }, @@ -3594,7 +3671,7 @@ "h": 7, "w": 24, "x": 0, - "y": 50 + "y": 138 }, "hiddenSeries": false, "id": 6, @@ -3615,7 +3692,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -3636,6 +3713,10 @@ "steppedLine": false, "targets": [ { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "panelId": 231, "refId": "A" } @@ -3660,9 +3741,7 @@ "yaxis": "left" } ], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Compilation Rate", "tooltip": { "shared": true, @@ -3698,9 +3777,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3711,69 +3788,79 @@ "format": "percentunit", "label": "", "logBase": 1, - "max": null, "min": "0", "show": true }, { "$$hashKey": "object:1203", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } } ], + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "refId": "A" + } + ], "title": "$sql_instance: SQL Server Activity", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 4 + "y": 35 }, "id": 309, "panels": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 4, "w": 24, "x": 0, - "y": 1 + "y": 93 }, "id": 110, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "# Wait Times\r\n\r\nIf a particular resource is not available, SQL Server will have to wait before it can process the query. For example, if the storage is too slow, SQL Server will have to wait for the disk \"to deliver\" the data. Analogically, if the CPU is too busy, SQL Server will have to wait for it to become available.\r\nAll this means, that if SQL is waiting too much, our queries do not get executed straight away but are put in a queue which makes the system feel slow. This chart is critical in understanding what SQL Server is waiting on. The SQLSkills website is a great resource to learn about waits:\r\n[https://www.sqlskills.com/help/waits/](https://www.sqlskills.com/help/waits/). You can change how the wait types are grouped, either by Type or Category, using the filter on top or link in the chart.", "mode": "markdown" }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "queryType": "randomWalk", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "", "transparent": true, "type": "text" }, @@ -3782,21 +3869,18 @@ "bars": true, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "description": "", "fieldConfig": { "defaults": { - "custom": {}, "links": [ { "title": "Wait Events", "url": "/d/sqlwatchwaits/wait-events?${__url_time_range}" } - ], - "thresholds": { - "mode": "absolute", - "steps": [] - } + ] }, "overrides": [] }, @@ -3806,7 +3890,7 @@ "h": 11, "w": 24, "x": 0, - "y": 5 + "y": 97 }, "hiddenSeries": false, "id": 232, @@ -3839,7 +3923,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 2, "points": false, "renderer": "flot", @@ -3863,6 +3947,9 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "hide": false, "rawSql": "SELECT \n [time] = $__timeGroup([snapshot_time], $aggregation) \n ,metric = case when '$Waits' = 'Category' then [wait_category] else [wait_type] end\n ,[value] = case when '$WaitCalc' = 'ms/sec' then avg([wait_time_ms_per_second]) else avg(wait_time_ms_delta) end\n FROM [dbo].[vw_sqlwatch_report_fact_perf_os_wait_stats]\n WHERE 1=1\n AND $__timeFilter(snapshot_time)\n AND [sql_instance] = '$sql_instance'\n GROUP BY case when '$Waits' = 'Category' then [wait_category] else [wait_type] end\n ,$__timeGroup([snapshot_time], $aggregation) \nORDER BY\n time ASC\n option (keep plan)\n ", @@ -3870,9 +3957,7 @@ } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Wait Time $WaitCalc by Wait $Waits", "tooltip": { "shared": false, @@ -3883,9 +3968,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -3896,23 +3979,19 @@ "format": "ms", "label": "", "logBase": 1, - "max": null, "min": "0", "show": true }, { "$$hashKey": "object:2017", "format": "ms", - "label": null, "logBase": 1, - "max": null, "min": "0", "show": false } ], "yaxis": { - "align": true, - "alignLevel": null + "align": true } }, { @@ -3920,16 +3999,12 @@ "bars": false, "dashLength": 10, "dashes": false, - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "description": "", "fieldConfig": { "defaults": { - "color": {}, - "custom": {}, - "thresholds": { - "mode": "absolute", - "steps": [] - }, "unit": "ms" }, "overrides": [] @@ -3940,7 +4015,7 @@ "h": 5, "w": 24, "x": 0, - "y": 16 + "y": 108 }, "hiddenSeries": false, "id": 191, @@ -3967,7 +4042,7 @@ "alertThreshold": true }, "percentage": false, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "pointradius": 3, "points": true, "renderer": "flot", @@ -3978,15 +4053,16 @@ "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "time_series", "rawSql": "SELECT \n [time]= event_time\n ,[Wait Type] = case when '$Waits' = 'Category' then [wait_category] else [wait_type] end\n ,[Wait Duration] = sum([duration])\n FROM [vw_sqlwatch_report_fact_xes_wait_events]\n \n WHERE $__timeFilter(event_time)\n AND [sql_instance] = '$sql_instance'\n\n group by event_time,case when '$Waits' = 'Category' then [wait_category] else [wait_type] end\nORDER BY\n time ASC\n option (keep plan)", "refId": "A" } ], "thresholds": [], - "timeFrom": null, "timeRegions": [], - "timeShift": null, "title": "Wait Events", "tooltip": { "shared": true, @@ -3997,9 +4073,7 @@ "transparent": true, "type": "graph", "xaxis": { - "buckets": null, "mode": "time", - "name": null, "show": true, "values": [] }, @@ -4007,35 +4081,33 @@ { "$$hashKey": "object:2096", "format": "ms", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true }, { "$$hashKey": "object:2097", "format": "short", - "label": null, "logBase": 1, - "max": null, - "min": null, "show": true } ], "yaxis": { - "align": false, - "alignLevel": null + "align": false } }, { - "datasource": "$DataSource", + "datasource": { + "uid": "$DataSource" + }, "fieldConfig": { "defaults": { "custom": { - "align": null, - "displayMode": "auto", - "filterable": false + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false }, "links": [], "mappings": [], @@ -4132,7 +4204,7 @@ "h": 5, "w": 24, "x": 0, - "y": 21 + "y": 113 }, "id": 194, "links": [ @@ -4143,6 +4215,14 @@ } ], "options": { + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, "showHeader": true, "sortBy": [ { @@ -4151,17 +4231,18 @@ } ] }, - "pluginVersion": "7.4.2", + "pluginVersion": "9.4.7", "targets": [ { "alias": "", + "datasource": { + "uid": "$DataSource" + }, "format": "table", "rawSql": "select \t event_time\t\n\t,wait_type\t\n\t,wait_category\t\n\t--,activity_id = convert(varchar(36),activity_id)\t\n\t--,activity_id_sequence\t\n\t,duration\t\n\t---,signal_duration\t\n\t,session_id\t\n\t,username\t\n\t,client_hostname\t\n\t,client_app_name\t\n\t,database_name\t\n\t--,sql_instance\t\n\t--,snapshot_time\t\n\t--,snapshot_type_id\n\t--,sqlwatch_query_hash = '--0x'+convert(varchar(max),sqlwatch_query_hash,2)\nfrom [dbo].[vw_sqlwatch_report_fact_xes_wait_events] \nWHERE [sql_instance] = '$sql_instance'\nAND $__timeFilter(event_time)", "refId": "A" } ], - "timeFrom": null, - "timeShift": null, "title": "Queries", "transformations": [ { @@ -4191,49 +4272,64 @@ "type": "table" } ], + "targets": [ + { + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, + "refId": "A" + } + ], "title": "$sql_instance: SQL Server Waits", "type": "row" }, { "collapsed": true, - "datasource": null, + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" + }, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 5 + "y": 36 }, "id": 208, "panels": [ { - "datasource": null, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] + "datasource": { + "type": "mssql", + "uid": "EeAYXKY4k" }, "gridPos": { "h": 6, "w": 24, "x": 0, - "y": 35 + "y": 172 }, "id": 112, "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, "content": "SQL Server has its own, internal task mechanism controlled by the SQLOS. Every time we run a query, SQL Server will invoke one or more tasks to run this task, get data from tables etc. SQL Server has one scheduler per CPU thread. More details.
\r\nRunnable Tasks: You want 0. Number of workers, with tasks assigned to them, that are waiting to be scheduled on the runnable queue. If this number is high, it may indicate CPU pressure.
\r\nPending Disk IO: You want 0. Number of pending I/Os that are waiting to be completed.
\r\nFailed To Create Worker: You want 0. Inability to create new work generally occurs because of memory constraints.
\r\nTasks Queue: You want 0. Shows number of tasks awaiting a worker to pick them up.
\r\nCurrent Tasks: Number of tasks assigned to a scheduler. Task can be actively running or waiting.\r\n