This program checks a Mysql query result against threshold levels.
You need a mysql connector jar file in the same directory that this plugin is installed.
In the following example, we will check the result of a simple query (select count(*) from users_table).
<command name="check_mysql_query" plugin_name="CHECK_MYSQL_QUERY"> <arg name="hostname" value="$ARG1$" /> <arg name="port" value="$ARG2$" /> <arg name="database" value="$ARG3$" /> <arg name="user" value="$ARG4$" /> <arg name="password" value="$ARG5$" /> <arg name="query" value="$ARG6$" /> <arg name="warning" value="$ARG7$" /> <arg name="critical" value="$ARG8$" /> </command>
check_mysql_query:CHECK_MYSQL_QUERY --check-slave --hostname $ARG1$ --port $ARG2$ --database $ARG3$ --user $ARG4$ --password $ARG5$ --query $ARG6$ --warning $ARG7$ --critical $ARG8$
The following will query the number of rows in a the table "users_table". It will send a warning if it takes 10 seconds or more to execute the query and a critical if it takes 30 seconds or more:
check_nrpe -H 127.0.0.1 -c check_mysql_query -n -a localhost 3306 database username password "select count(*) from users_table" 30 10