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. The custom.xml file in the
installation includes a sample entry. You can replace that
entry, or add the following definition to the file:
<?xml version="1.0" encoding="utf-8"?>
<classes>
<class>
<namespace>mysql</namespace>
<classname>innodb_min_free</classname>
<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-monitor-agent/items/quan.lua,share/mysql-monitor-agent/items/items-mysql-monitor.xml, share/mysql-monitor-agent/items/agent-allocation-stats.lua,share/mysql-monitor-agent/items/custom.xml ...
Restart the agent to put this change into effect. To do this, see:
Once the agent has restarted, the new data item is in the
Data Item drop down list box on the
Rule Definition page. Its fully qualified
name is mysql:innodb_min_free:Free.