-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Expand file tree
/
Copy pathMakingCustomChecks_sample.json
More file actions
116 lines (115 loc) · 6.09 KB
/
MakingCustomChecks_sample.json
File metadata and controls
116 lines (115 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
"schemaVersion": "1.0",
"version": "0.2",
"name": "Custom Checks Ruleset",
"rules":[
{
"target": {
"type": "Database",
"version": "[13.0,)",
"platform": "Windows, Linux",
"engineEdition": "OnPremises, ManagedInstance",
"name": { "not": "/^(master|tempdb|model)$/" }
},
"id": "QueryStoreOn",
"itemType": "definition",
"tags": [ "CustomRuleset", "Performance", "QueryStore", "Statistics" ],
"displayName": "Query Store should be active",
"description": "The Query Store feature provides you with insight on query plan choice and performance. It simplifies performance troubleshooting by helping you quickly find performance differences caused by query plan changes. Query Store automatically captures a history of queries, plans, and runtime statistics, and retains these for your review. It separates data by time windows so you can see database usage patterns and understand when query plan changes happened on the server. While Query Store collects queries, execution plans and statistics, its size in the database grows until this limit is reached. When that happens, Query Store automatically changes the operation mode to read-only and stops collecting new data, which means that your performance analysis is no longer accurate.",
"message": "Make sure Query Store actual operation mode is 'Read Write' to keep your performance analysis accurate",
"helpLink": "https://docs.microsoft.com/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store",
"probes": [ "Custom_DatabaseConfiguration" ],
"condition": {
"equal": [ "@query_store_state", 2 ]
}
},
{
"target": {
"type": "Server",
"platform": "Windows, Linux",
"engineEdition": "OnPremises"
},
"id": "Custom_TF834",
"itemType": "definition",
"tags": [ "CustomRuleset", "TraceFlag", "Performance", "Memory", "ColumnStore" ],
"displayName": "TF 834 enables large-page allocations",
"description": "Trace Flag 834 causes the server to use large-page memory (LPM) model for the buffer pool allocations. Consider enabling TF 834 if you have a server that has a lot of memory, particularly for an analytical or data warehousing workload. Trace flag 834 is NOT recommended on SQL Server instances that use columnstore indexes.",
"message": "Enable trace flag 834 to use large-page allocations to improve analytical and data warehousing workloads.",
"helpLink": "https://support.microsoft.com/help/4465518",
"level": "Information",
"probes": [ "Custom_EnabledGlobalTraceFlags" ],
"condition": {
"in": [ 834, "@TraceFlag" ]
}
},
{
"id": "Custom_TF834",
"itemType": "override",
"targetFilter": {
"version": "(,11.0)"
},
"description": "Trace Flag 834 causes the server to use large-page memory (LPM) model for the buffer pool allocations. Consider enabling TF 834 if you have a server that has a lot of memory, particularly for an analytical or data warehousing workload.",
"message": "Consider enabling trace flag 834 to use large-page allocations to improve analytical and data warehousing workloads.",
"helpLink": "https://support.microsoft.com/help/2964518"
}
],
"probes":{
"Custom_DatabaseConfiguration": [
{
"type": "SQL",
"target": {
"type": "Database",
"version": "(,12.0)",
"platform": "Windows, Linux",
"engineEdition": "OnPremises, ManagedInstance"
},
"implementation": {
"query": "SELECT db.is_auto_create_stats_on, db.is_auto_update_stats_on, 0 AS query_store_state, db.collation_name, (SELECT collation_name FROM master.sys.databases (NOLOCK) WHERE database_id = 1) AS master_collation, db.is_auto_close_on, db.is_auto_shrink_on, db.page_verify_option, db.is_db_chaining_on, NULL AS is_auto_create_stats_incremental_on, db.is_trustworthy_on, db.is_parameterization_forced FROM [sys].[databases] (NOLOCK) AS db WHERE db.[name]=@TargetName"
}
},
{
"type": "SQL",
"target": {
"type": "Database",
"version": "[12.0, 13.0)",
"platform": "Windows, Linux",
"engineEdition": "OnPremises, ManagedInstance"
},
"implementation": {
"query": "SELECT db.is_auto_create_stats_on, db.is_auto_update_stats_on, 0 AS query_store_state, db.collation_name, (SELECT collation_name FROM master.sys.databases (NOLOCK) WHERE database_id = 1) AS master_collation, db.is_auto_close_on, db.is_auto_shrink_on, db.page_verify_option, db.is_db_chaining_on, db.is_auto_create_stats_incremental_on, db.is_trustworthy_on, db.is_parameterization_forced FROM [sys].[databases] (NOLOCK) AS db WHERE db.[name]=@TargetName"
}
},
{
"type": "SQL",
"target": {
"type": "Database",
"version": "[13.0,)",
"platform": "Windows, Linux",
"engineEdition": "OnPremises, ManagedInstance"
},
"implementation": {
"useDatabase": true,
"query": "SELECT db.is_auto_create_stats_on, db.is_auto_update_stats_on, (SELECT CAST(actual_state AS DECIMAL) FROM [sys].[database_query_store_options]) AS query_store_state, db.collation_name, (SELECT collation_name FROM master.sys.databases (NOLOCK) WHERE database_id = 1) AS master_collation, db.is_auto_close_on, db.is_auto_shrink_on, db.page_verify_option, db.is_db_chaining_on, db.is_auto_create_stats_incremental_on, db.is_trustworthy_on, db.is_parameterization_forced FROM [sys].[databases] (NOLOCK) AS db WHERE db.[name]=@TargetName"
}
}
],
"Custom_EnabledGlobalTraceFlags": [
{
"type": "SQL",
"target": {
"type": "Server",
"engineEdition": "OnPremises, ManagedInstance"
},
"implementation": {
"query": "DECLARE @tracestatus TABLE (TraceFlag NVARCHAR(40), [Status] tinyint, [Global] tinyint, [Session] tinyint); INSERT INTO @tracestatus EXEC ('DBCC TRACESTATUS WITH NO_INFOMSGS'); IF NOT EXISTS(SELECT * FROM @tracestatus WHERE Global=1) SELECT 0 AS [TraceFlag], 0 AS [Status] ELSE SELECT [TraceFlag], [Status] FROM @tracestatus WHERE Global=1",
"transform": {
"type": "aggregate",
"map": {
"TraceFlag": "array"
}
}
}
}
]
}
}