Comments - MONyog Table Alert

7 years, 7 months ago Sibin AS

One problem is that the 'table size' (size of data + indexes) and the 'table size on disk' is not necessarily the same. There may be unused space inside the tablespace (details depends on storage engine). MySQL data folder may be mounted to another disk system than the system disk (like a RAID system/rack) and even the InnoDB tablespace may be stored at a third place.

It is actually very difficult to provide meaningful alerts. It will also result in one more background thread running (more CPU-load, more I/O).

So it is important to understand WHY you want this, WHAT you want to achieve and WHAT EXACTLY should be the alert condition.

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

 
7 years, 7 months ago palash harchandani

So when we are inserting data into a particular table the max limit to insert the data is 4.6 GB after that it starts giving errors. We want alerts when a particular table is reaching this limit so that we can take the necessary actions. Alert condition should be to monitor the table size and display the value of it.

 
7 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 = obj.select();
    var results = '';
    for (i in obj) {
        if (results.length >0)
            results+='<br>';

        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 >> http://monyogkb.webyog.com/article/67-new-csos-and-cscs

You may write to support@webyog.com 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.