Databases Reference
In-Depth Information
{
MYSQL_DAEMON_PLUGIN,
&monitoring_plugin,
"monitoring",
"Andrew Hutchings",
"Daemon monitoring example, monitors MySQL",
PLUGIN_LICENSE_GPL,
monitoring_plugin_init,
monitoring_plugin_deinit,
0x0100,
NULL,
NULL,
NULL
}
mysql_declare_plugin_end;
The plugin called monitoring is declared exactly as before, nothing new here.
When we install this plugin, run a few connections, and then uninstall the plugin, we
should see in the file monitor.log something similar to the following:
Monitoring started at 2009-08-01 22:22:57
2009-08-01 22:23:02: 2 of 151 clients connected, 7 connections made
2009-08-01 22:23:07: 2 of 151 clients connected, 8 connections made
2009-08-01 22:23:12: 3 of 151 clients connected, 9 connections made
2009-08-01 22:23:17: 3 of 151 clients connected, 9 connections made
2009-08-01 22:23:22: 4 of 151 clients connected, 10 connections made
2009-08-01 22:23:27: 3 of 151 clients connected, 10 connections made
2009-08-01 22:23:32: 2 of 151 clients connected, 10 connections made
2009-08-01 22:23:37: 2 of 151 clients connected, 10 connections made
Monitoring stopped at 2009-08-01 22:23:41
System Status Variables plugin
At the end of the chapter, let's try to create a different Daemon plugin. This plugin,
called sys_status , does not start any threads and does not do anything in the
background. It uses the status variables to provide access to the getrusage()
statistics. The getrusage() system call returns information about the process
resource usage such as number of page faults, number of signals received, and
number of context switches. How could we let MySQL users see this information?
 
Search WWH ::




Custom Search