I do exactly that. The test is pretty trivial, inasmuch as it connects to a custom database called
nagios and selects from a table that contains just a single numeric value, alerting if that value isn't
74581 - but I figure if
mysql works well enough to retrieve that exact number from a table, it's probably fine. You could run more complex queries, though.
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql_query -H 127.0.0.1 -d nagios -u user -p pass -q "select * from nagioscheck;" -c 74581:74581 -w 74581:74581
This is invoked by NRPE (hence the format of the above, which is from
check_mysql_query plugin is a standard nagios plugin, at least in my distro (CentOS 6 with the
nagios-plugins package from RPMForge). It can also be found here (with thanks to the OP for the link).