As an example, this section shows how to create a data item for
monitoring the amount of free InnoDB tablespace. You can have
multiple items in your custom.xml
file,
just specify additional class
entries. A
sample entry is provided in the custom.xml
file that is included during installation. You can replace, or
add the following definition to the file:
<?xml version="1.0" encoding="utf-8"?> <classes> <class> <classname>innodb_min_free</classname> <namespace>mysql</namespace> <query><![CDATA[SELECT MIN(substring_index(substring_index(table_comment," ",3)," ",-1)/1024/1024) as Free FROM INFORMATION_SCHEMA.TABLES WHERE engine = 'InnoDB']]></query> </class> </classes>
After saving the file, ensure that the
agent-item-files
parameter within the
configuration includes the custom.xml
file.
For example:
[mysql-proxy] ... agent-item-files = share/mysql-proxy/items/quan.lua,share/mysql-proxy/items/items-mysql-monitor.xml,» share/mysql-proxy/items/agent-allocation-stats.lua,share/mysql-proxy/items/custom.xml ...
For this change to take effect you must restart the agent. To do this see:
Once the agent has restarted, you will find the new data item in
the Data Item
drop down list box on the
Rule Definition
page. Its fully qualified
name is mysql:table:innodb_min_free
.