31.1.3 Overview of Advisor Creation

To create a new Advisor, click the Create Advisor button on the Advisors page. To create an Advisor based on an existing one, select Copy Advisor menu item from the Advisor menu. You can edit any Advisor element during the copying process, unlike editing an existing Advisor. To delete custom Advisors, select Delete Advisor from the Advisor menu.

Important

Unlike the expression-based advisors, it is not possible to copy one of the GUI-based advisors to use as the basis for a custom advisor.

You can change the Advisor name, change the Advisor category that an Advisor belongs to, set your own version number, and alter the threshold and frequency of an Advisor.

Note

If you do not specify a version number for the new Advisor, the version 1.0 is automatically added.

You can also edit an Advisor's expression. For more information on Advisor expressions, see Chapter 19, Advisors. An expression can be as simple as a single server parameter or can be complex, combining multiple parameters with mathematical operations.

An expression has two main characteristics:

  • An expression tests whether a best practice is being violated.

  • The result of an expression must always be 1 or 0 (corresponding to true or false).

For example, if enabling binary logging is a best practice for a production server (as Oracle recommends), then this best practice is violated if log_bin is OFF. Consequently, the expression for the Binary Logging Not Enabled advisor is %log_bin% == OFF. If this evaluates to 1, an event is raised because the best practice is not being followed.

An expression is made up of one or more variables and zero or more mathematical operators. MySQL Enterprise Monitor uses the Java Expression Parser. The operators and functions consist of:

  • The IN() operator.

  • The MySQL functions LEAST(), LOCATE(), ABS(), MOD(), NOW() (returns time since Unix epoch UTC in seconds), UNIX_TIMESTAMP (technically a no-op), and INTERVAL [n] SECOND, MINUTE, HOUR, WEEK, MONTH.

  • The operators functions listed on this page: http://www.singularsys.com/jep/doc/html/operators.html.

  • Comparisons with MySQL timestamps and datetimes collected by the agent in the standard MySQL format 'YYYY-MM-DD hh:mm:ss[.nanos]'.

  • The IF function: IF (condition, true_expression, false_expression) returns either true_expression or false_expression, depending on whether condition is true or false. This function uses short-circuit evaluation, so only one of the return expressions is evaluated.

  • The LEFT(string, length) and RIGHT(string, length) functions.

  • The NUM(string) function.

    Note

    The CAST(expression as type) function is not implemented. Instead, use NUM(string) to use strings as numbers.

For a complete list of the built-in variables used to create Advisors, see Server Option, System Variable, and Status Variable Reference.

Creating an expression is dependent on variables defined in the Variable Assignment frame. This frame links variables used in the expression field with data gathered from the target MySQL server instance: server status variables, operating system status information, and table information. Variable names are associated with elements in the Data Item drop-down menu. To define more than one variable, click the add row button.

The remaining fields determine the information that you receive in a notification email or the informational pop-up window associated with each advisor.

Note

When saving a new Advisor, choose a unique name not used by any existing Advisor.