Doubts Regarding check_mysql plugin


We have installed nagios-2.8 in our fc6 system with official plugins( nagios1.4.11) except check_mysql plugin. So we have iinstallled check_mysql plugin alone from the nagiosplugin website. All the plugins are in the location /usr/local/nagios/libexec/libexec.
We have no problem with other plugins. But when executing check_mysql plugin, we are facing the following error:

    [root@localhost libexec]# ./check_mysql
   bash: ./check_mysql: cannot execute binary file

CFG files:


‘check_mysql’ command definition

define command{
command_name check_mysql
command_line $USER1$/check_mysql -H $ARG1$ -d $ARG2$ -u $ARG3$ -p $ARG4$

define service{
use generic-service ; Name of service template to use
host_name server
service_description Database
max_check_attempts 10
max_check_attempts 10
normal_check_interval 5
retry_check_interval 1
contact_groups nagios
notification_interval 960
notification_options w,u,c,r
check_command check_mysql!!nagios!mysql!mysqladmin


define service{
use local-service ; Name of service template to use
host_name localhost
check_command check_mysql!!nagios!mysql!mysqladmin
service_description Database

We have already installled mysql-server using yum. Kindly help us to solve this problem.



no need for the CFG files: the lines:
"[root@localhost libexec]# ./check_mysql
bash: ./check_mysql: cannot execute binary file"
are the problem: your plugin doesn’t seem to be working.

You should try to compile it again (and make sure there are no error messages during the compilation).

Apart from that, I can’t help you further; sorry :wink:


I assume that it was faulty install of mysql plugin. Try to reinstall official plugin package with the mysql plugin and try then. I assume so, because it won’t execute from shell.

Or maybe it’s a case of execution rights for that file.


Thanx for your immediate response. Now my problem was solved. But now i am facing another issue. When executing check_mysql plugin, the following error occurs:

[root@localhost libexec]# ./check_mysql
Access denied for user ‘root’@‘localhost’ (using password: NO)

Kindly help me to fix this issue.


When executing from terminal you should also include arguments, like this
./check_mysql -H db_host_address -d database -u db_username -p db_password


The problem with check_mysql plugin was solved. Thanx for your reply. But When Executing check_mysql_query, the following problem occurs:

./check_mysql_query -qselect output from nagios_hoststatus where hoststatus_id=1 -dnagios -hlocalhost -umysql -pmysqladmin
check_mysql_query v1590 (nagios-plugins 1.4.11)
Copyright © 2006 Nagios Plugin Development Team

This program checks a query result against threshold levels

Usage:check_mysql_query -q SQL_query -w warn] -c crit]
-d database] -H host] -P port] -u user] -p password]

-h, --help
Print detailed help screen
-V, --version
Print version information
-q, --query=STRING
SQL query to run. Only first column in first row will be read
-w, --warning=RANGE
Warning range (format: start:end). Alert if outside this range
-c, --critical=RANGE
Critical range
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-P, --port=INTEGER
Port number (default: 3306)
-d, --database=STRING
Database to check
-u, --username=STRING
Username to login with
-p, --password=STRING
Password to login with

A query is required. The result from the query should be numeric.
For extra security, create a user with minimal access.

Send email to if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to

It does not show the result of the query.

CFG files:

define service{
use local-service ; Name of service template to use
host_name localhost
check_command check_mysql_query!‘select output from nagios_hoststatus where hoststatus_id=1’!nagios!mysql!mysqladmin
service_description MySQL

‘check_mysql_query’ command definition

define command{

    command_name    check_mysql_query

    command_line    $USER1$/check_mysql_query -q $ARG1$ -d $ARG3$ -H $HOSTALIAS$ -u $ARG4$ -p $ARG5$


Kindly help me to fix this issue.


./check_mysql_query -q “select output from nagios_hoststatus where hoststatus_id=1” -d nagios -H localhost -u mysql -p mysqladmin

it should work better :slight_smile:



Thanx for your reply. Now my problem was solved.

Is there any plugin available to capture performance characteristics like average network traffic flow between one system to another ?

Kindly help me.