31.1.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 advisor calculates the hit rate as follows:

100-((%Innodb_buffer_pool_reads% / %Innodb_buffer_pool_read_requests%)*100)

If the current value of %Innodb_buffer_pool_reads% is 4522 and the current value of %Innodb_buffer_pool_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 advisor, 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 Innodb_buffer_pool_reads is %Innodb_buffer_pool_reads%. to the Advice text box. When this is displayed on the screen, the value of %Innodb_buffer_pool_reads% is substituted into the text. If %%Innodb_buffer_pool_reads%% has a value of 4522, the message becomes The current value of Innodb_buffer_pool_reads is 4522.