20.2.4 Variables

When MySQL Enterprise Monitor evaluates an expression, it replaces variables with values. For example, part of the expression for the MyISAM Key Cache Has Sub-Optimal Hit Rate rule calculates the hit rate as follows:

100-((%Key_reads% / %Key_read_requests%)*100)

If the current value of %Key_reads% is 4522 and the current value of %Key_read_requests% is 125989, the hit ratio is 96.4%:

100 -((4522 / 125989) * 100)

By convention, the Advisors supplied by MySQL use ‘%’ as the delimiter, for example, %Key_reads%. This makes variables more readily identifiable.

Variables can be used in the Description, Advice, Action, and Links attributes of a rule, as well as in expressions. This lets you report the current value of an expression. For instance, you can add the message, The current value of Key_reads is %Key_reads%. to the Advice text box. When this is displayed on the screen, the value of %Key_reads% is substituted into the text. If %Key_reads% has a value of 4522, the message becomes The current value of Key_reads is 4522.