Skip to content

Commit 1ef94bd

Browse files
Updated description of MakingCustomChecks_sample.json
Explained json format for probes
1 parent 779aff4 commit 1ef94bd

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

samples/manage/sql-assessment-api/README.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,31 @@ Demonstrates how to make a custom rule set containing two checks. The sample con
3737
`Probes`, in fact, describe how and where get required data to perform a check. For this, you can use T-SQL queries as well as methods from assemblies. The probe below uses a T-SQL query.
3838
```
3939
"probes":{
40-
"DatabaseConfiguration": [
40+
"DatabaseConfiguration": [ //Probe name that is used to reference the probe from a check.
41+
//Probe can have a few implementations that will be used for different targets.
42+
//This probe has two implementations for different version of SQL Server.
4143
{
42-
"type": "SQL",
43-
"target": {
44-
"type": "Database",
45-
"version": "(,12.0)",
46-
"platform": "Windows"
44+
"type": "SQL", //Probe uses a T-SQL query to get the required data
45+
"target": {
46+
"type": "Database", //Targets at database
47+
"version": "(,12.0)", //This implementation is for SQL Server before 2014
48+
"platform": "Windows" //Targets at SQL on Windows
49+
},
50+
"implementation": { //Implementation object with a T-SQL query.
51+
//sys.databases of SQL Server before 2014 doesn't have the field is_query_store_on so we replace it with 0.
52+
"query": "SELECT db.[is_auto_create_stats_on] AS is_auto_create_stats_on, db.[is_auto_update_stats_on] AS is_auto_update_stats_on, 0 AS is_query_store_on FROM sys.databases AS db WHERE db.[name]='@DatabaseName'"
53+
}
4754
},
48-
"implementation": {
49-
"query": "SELECT db.[is_auto_create_stats_on] AS is_auto_create_stats_on, db.[is_auto_update_stats_on] AS is_auto_update_stats_on, 0 AS is_query_store_on FROM sys.databases AS db WHERE db.[name]='@DatabaseName'"
50-
}
51-
},
52-
{
53-
"type": "SQL",
54-
"target": {
55-
"type": "Database",
56-
"version": "[12.0,)",
57-
"platform": "Windows"
58-
},
59-
"implementation": {
60-
"query": "SELECT db.[is_auto_create_stats_on] AS is_auto_create_stats_on, db.[is_auto_update_stats_on] AS is_auto_update_stats_on, db.[is_query_store_on] AS is_query_store_on FROM sys.databases AS db WHERE db.[name]='@DatabaseName'"
61-
}
55+
{ //Second implementation
56+
"type": "SQL",
57+
"target": {
58+
"type": "Database",
59+
"version": "[12.0,)", //This implementation is for SQL Server 2014 and up.
60+
"platform": "Windows"
61+
},
62+
"implementation": { //Query of the second implementation.
63+
"query": "SELECT db.[is_auto_create_stats_on] AS is_auto_create_stats_on, db.[is_auto_update_stats_on] AS is_auto_update_stats_on, db.[is_query_store_on] AS is_query_store_on FROM sys.databases AS db WHERE db.[name]='@DatabaseName'"
64+
}
6265
}
6366
]
6467
}

0 commit comments

Comments
 (0)