Here is a simple PHP script to monitor you MySQL servers.
It monitors questions and slow queries (classical) but also the 4.x Query Cache feature.
To use it simply create a script data input method with command line:
Code:
php -f <path_cacti>/scripts/mysql_monitoring.php
Note: you need to modify the script to set your login, pass and host. You
should create a user with only process privileges.
Output fields:
Code:
Questions................ Questions
Slow_queries............. Slow Queries
Qcache_queries_in_cache.. Number of queries registered in the cache
Qcache_inserts........... Number of queries added to the cache
Qcache_hits.............. Number of cache hits
Qcache_not_cached........ Number of non-cached queries
Qcache_free_memory....... Amount of free memory for query cache
Qcache_total_blocks...... Total number of blocks in query cache
Qcache_free_blocks....... Number of free memory blocks in query cache
Qcache_lowmem_prunes..... Requests removed from cache
This script can be easily modified to monitor other STATUS variables like threads and others.
Hope this helps!
Guillaume