This section documents the steps to create a rule. Before creating a rule, review the preceding sections of this chapter.
This example is based on the bundled Excessive Disk Temporary Table Usage Detected rule that checks the frequency MySQL stores temporary tables on disk instead of memory. We decide that 50% or less of the table hits to disk should trigger a critical alert, and lesser numbers should produce informational and warning level alerts.
Begin by navigating to the Advisors tab and
clicking the manage rules link. Then choose
the create rule button.
Create your custom rule by following these steps:
Using the Rule Name text box, give the
rule an appropriate name, in this case something such as
"My Excessive Temporary Table Disk Usage".
From the Advisor drop down list box,
choose an advisor group for your rule. The
Performance group of rules might be
suitable but if you wish, create your own group of
advisors. For instructions on doing this, see
Section 4.1.1, “Creating Advisors”.
Enter the following expression in the Expression text area:
100-((%tmp_disk_tables% / %tmp_tables%)*100) < THRESHOLD
Set the Thresholds.
Set the Info Alert level to
50.
Set the Warning Alert level to
75.
Set the Critical Alert level to
90.
Define your first variable in the Variable
Assignment frame.
In the Variable text box, enter
%tmp_tables%, the variable used in
the Expression text box above. The
variable name can be whatever you choose to use in
your expression.
In the Data Item drop down list
box, find and select the
mysql:status:Created_tmp_tables
entry. (For a description of all the data items
available, see Appendix D, Data Collection Items.) This
dynamic MySQL Enterprise Monitor value will be applied to the variable
name you chose above, which is
%tmp_tables% in our example.
In the Instance text box, enter
local.
To add another variable, click Add
row and define your second variable in the
Variable Assignment frame as done
above.
In the Variable text box, enter
%tmp_disk_tables%, the variable
used in the Expression text box
above. The variable name can be whatever you choose to
use in your expression.
In the Data Item drop down list
box, find and select the
mysql:status:Created_tmp_disk_tables
entry. (For a description of all the data items
available, see Appendix D, Data Collection Items.) This
dynamic MySQL Enterprise Monitor value will be applied to the variable
name you chose above, which is
%tmp_disk_tables% in our example.
In the Instance text box, enter
local.
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 variables you defined above, such as
%tmp_tables% and
%tmp_disk_tables% in our example, in
these text areas.
Save the rule.
After you create the rule, schedule it against the server that you want to monitor. For instructions on scheduling rules, see Section 2.3.2, “Scheduling Rules”.
