4.1.3 Overview of Rule Creation

You create rules using the same screen seen in Figure 2.5, “MySQL Enterprise Monitor User Interface: Editing Rules”. To create a new rule with all-new settings, click the create rule button. To create a rule similar to an existing one, click the copy rule button. You can edit any rule element during the copying process, unlike editing an existing rule.

You can change the rule name, change the advisor group that a rule belongs to, and set your own version number. In Figure 2.5, “MySQL Enterprise Monitor User Interface: Editing Rules”, you have already seen how to alter the threshold and frequency of a rule.


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

Most importantly, you can alter a rule's expression. Expressions are the core of a MySQL Enterprise Advisors and define the scenario being monitored. 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:

If an expression evaluates to true for a specific server, an alarm is raised, indicating that a best practice is not being followed. If an expression evaluates to false, the best practice is being followed and no alarm is raised.

For example, if you decide that 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 rule is %log_bin% == OFF. If this evaluates to 1, an alarm 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. The MySQL Enterprise Monitor product uses the Java Expression Parser. The operators and functions consist of:

For a complete list of the built-in variables used to create rules, see Server Option and 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 list. To define more than one variable, click the add row button. For a complete listing of the data collection items used in creating rules, see Appendix D, Data Collection Items.

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


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