MySQL Database Size Collector

DPA does not collect database sizes out of the box, but we can use a custom alert (that never triggers) as a method for collecting this data.

Querying Alert Results to get Database Sizes

The data is stored in the DPA alert tables and this information can be retrieved with a query similar to this:

DECLARE @CollectorAlertID int, @InstanceID int;

-- Change this query to match the name you used for the collector alert name, this is the default
SELECT @CollectorAlertID = id FROM ignite.con_alert WHERE alertname='MySQL Collect Database Sizes';

SELECT d.name instance_name, ah.actiondate timestamp,
ahr.parametername database_name, convert(float, replace(ahr.levelvalue,',','')) db_size_mb
FROM ignite.con_alert a
INNER JOIN ignite.con_alert_history ah on ah.alertid=a.id
INNER JOIN ignite.con_alert_history_results ahr on ahr.historyid=ah.historyid
INNER JOIN ignite.cond d ON d.id = ah.db_id
WHERE a.id = @CollectorAlertID
AND ah.actiondate >= current_timestamp - 14.0
ORDER BY d.name, ah.actiondate, ahr.parametername

Create the DPA Alert

To create the collector alert, create a Custom SQL Multiple Numeric Return and make it look similar to this example. Note that the execution frequency should be set to once a day like this example, or no more than once an hour as databases do not typically grow quickly.