Metrics install automatically if you have Redgate Monitor installed.
If you are using Redgate’s SQL Server monitoring tool, Redgate Monitor, you can instantly install and run this metric on your servers.
This metric reports the total space used by database files in GB. This includes data files but excludes log files.
This lets you track the growth of the databases over time so you can be aware of future space requirements.
Alternatively, the following T-SQL can be used for SQL Server 2012 and higher:
1 2 |
SELECT CAST(SUM(allocated_extent_page_count * 8.0 / 1024. / 1024.) AS DECIMAL(18,6)) AS Allocated_GB FROM sys.dm_db_file_space_usage; |
Metric definition
Name
Space used by Database objects in GB
Description
Monitors the total space used by data files in the database. This excludes log files.
The T-SQL query that will collect data
Instances to collect from
The instance that contains the database you're interested in.
Databases to collect from
The database you're interested in.
Collection frequency
86400
Use collected or calculated values
Leave the Use a calculated rate of change between collections check box unchecked
Metric collection
Enabled
Alert definition
An alert is not required