{ "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;" } } ] } }