Files
sql-server-samples/samples/manage/sql-assessment-api/notebooks/CustomizationSamples/CustomRuleTSQLProbe.json
T
Alex Protsenko c5c98ba49e Brought back CLR probe stuff
Added a CLR probe section to the notebook, put 2 dlls and 1 json in the CustomizationSamples folder
2019-11-04 17:23:56 +03:00

47 lines
1.7 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 @{SPACEAVAILABLEPERC}% of free space (threshold is set to @{threshold}%). Total space: @{SPACETOTALMB} MB. Free space: @{SPACEAVAILABLEMB} MB",
"probes": ["DBSpaceAvailable"],
"threshold": 25,
"condition": [
{"greater": ["@SPACEAVAILABLEPERC", "@threshold"]}
]
}
],
"probes":{
"DBSpaceAvailable": [
{
"type": "SQL",
"target": {
"type": "Database",
"engineEdition": "OnPremises, ManagedInstance",
"platform": "/Windows|Linux/"
},
"implementation": {
"useDatabase": true,
"query":
"SELECT convert(decimal(12,2),((sum (convert(decimal(12,2),round(a.size/128.000,2))) - sum(convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)))) /sum (convert(decimal(12,2),round(a.size/128.000,2)))*100)) as SPACEAVAILABLEPERC , SUM(convert(decimal(12,2),round(a.size/128.000,2))) as SPACETOTALMB , SUM(convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2))) as SPACEUSEDMB , SUM(convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2))) as SPACEAVAILABLEMB FROM dbo.sysfiles a WHERE groupid <> 0;"
}
}
]
}
}