6.2.8 Creating a New Advisor: An Example

This section documents the steps to create an Advisor.

To create an Advisor, you first need to select the Create Advisor button from the General Advisors Control. It will then display a new page like:

Figure 6.2 MySQL Enterprise Monitor User Interface: Creating a New Advisor

MySQL Enterprise Monitor User Interface: Creating a New Advisor

This example creates an Advisor that checks the number of rows in a table. We decide that having 50,000 rows in this table triggers a critical alert. Lesser numbers produce informational and warning level alerts.

Create your custom rule by following these steps:

  1. Using the Advisor Name text box, give the Advisor an appropriate name, in this case something such as "Excessive number of records in table_name table".

  2. From the Advisor Category drop down list box, choose an Advisor category for your Advisor. The Administration category of Advisors might be suitable but if you wish, create your own group of advisors. For instructions on doing this, Advisors Categories .

  3. Enter the following expression in the Expression text area.

    Note

    Replace table_name with the name of the table to monitor. Note that the variable %table_name_num_rows% is not yet defined.

    
    '%table_name_num_rows% > THRESHOLD'
    
                
  4. Set the Thresholds:

    1. Set the Critical Alert level to 50000.

    2. Set the Warning Alert level to 10000.

    3. Set the Notice Alert level to 5000.

  5. Define your variable in the Variable Assignment frame.

    1. In the Variable text box, enter '%table_name_num_rows%, the variable used in the Expression text box.

    2. In the Data Item drop down list box, find and select the mysql:table:numrows entry.

      For a description of all the data items available, see Appendix F, Data Collection Items.

    3. In the Instance text box, enter database_name.table_name.

  6. Add appropriate entries for the Problem Description, the Advice, and the Links text areas. Optionally, use Wiki markup for these text areas. You can also reference the %table_name_num_rows% variable in these text areas.

    For example, you can display the current number of rows with a message such as 'table_name currently has %table_name_num_rows% rows.'

  7. Save the Advisor

After you create the Advisor, schedule it against the MySQL server that contains the database table to monitor. For instructions on Configure Advisor, see Configure Advisors .