Comments - MONyog Table Alert

6 years, 7 months ago Sibin AS

You can create a Custom SQL Object (CSO) in MONyog to monitor the table size of a particular table. You may use the below query to create a CSO,

SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size_in_MB` FROM information_schema.TABLES WHERE table_schema = "$DB_NAME" AND table_name = "$TABLE_NAME";

Please specify the database_name and table_name you would wish to monitor in place of ‘$DB_NAME’ and ‘$TABLE_NAME’ in the above query.

You may also create a CSC for the above CSO and use the below javascript, please ensure you write the CSO name in place of '<name of the CSO>' in the below query,

function() {
    var obj = MONyog.UserObject('<name of the CSO>');
    if(!obj) {
        return "Custom SQL Object doesn't exist. Click <a target='_blank' class='link' href=''>here</a> to add.";

    if(!obj.isEnabled()) {
     return 'Custom SQL object for this monitor is not enabled.<br>Click <a target="_blank" class="link" href="">here</a>  to enable it.</br>';

    if (!obj || !MONyog.MySQL.Custom.Available)
        return '(n/a)';

    obj =;
    var results = '';
    for (i in obj) {
        if (results.length >0)

        results += obj[i].Table + '&nbsp;&nbsp;&nbsp;' + obj[i].Size_in_MB;

    if (results.length == 0)
        results = 'None';
    return results;

You may refer our documentation on creating new CSO and CSC (Custom SQL Counter for the new CSO), here >>

You may write to if you have any queries in MONyog. Sibin (Webyog)

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.