Files
sql-server-samples/samples/manage/sql-assessment-api/notebooks/CustomizationSamples/CustomRuleTSQLProbe.json
T
2023-02-20 19:33:29 +00:00

44 lines
1.5 KiB
JSON

{
"schemaVersion": "1.0",
"version": "1.1",
"name": "Custom Ruleset",
"rules":[
{
"target": {
"type": "Database",
"engineEdition": "OnPremises, ManagedInstance",
"version": [
"[11.0,11.0.7001.0)",
"[12.0,12.0.6259.0)",
"[13.0,)"
],
"platform": [ "Windows", "Linux" ]
},
"id": "DBSpaceAvailable",
"itemType": "definition",
"displayName": "Database files have little free space",
"description": "Average available space in all the database files is less than the threshold.",
"message": "Database has only @{space_available_rel:P0} of free space (threshold is set to @{threshold:P0}). Total space: @{space_total:N2} MB. Free space: @{space_available:N2} MB",
"probes": ["DBSpaceAvailable"],
"threshold": 0.25,
"condition": { "greater": [ "@space_available_rel", "@threshold" ] }
}
],
"probes":{
"DBSpaceAvailable": [
{
"type": "SQL",
"target": {
"type": "Database",
"engineEdition": "OnPremises, ManagedInstance",
"platform": [ "Windows", "Linux" ]
},
"implementation": {
"useDatabase": true,
"query": "SELECT (total - used)/total AS space_available_rel, total as space_total, used as space_used, total - used as space_available FROM ( SELECT SUM(a.size)/128.0 AS total, SUM(fileproperty(a.name,'SpaceUsed'))/128.0 AS used FROM dbo.sysfiles a WHERE groupid <> 0)data;"
}
}
]
}
}