Problems with check_mysql

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Problems with check_mysql

Post by nathanplatt »

Hi,

I'm trying to configure check_mysql but when Nagios checks I get this error;

(No output on stdout) stderr: execvp(Check_mysql, ...) failed. errno is 2: No such file or directory

Any ideas?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mysql

Post by lmiltchev »

Can you show us the actual command that you are running from the command line, along with the output of it? What is the version of the check_mysql plugin that you are currently using?

Code: Select all

./check_mysql -V
Be sure to check out our Knowledgebase for helpful articles and solutions!
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Problems with check_mysql

Post by nathanplatt »

I'm using the student edition i brought, it has gui that i configure everything through. See the image for what it shows
Attachments
Capture.JPG
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mysql

Post by lmiltchev »

Can you show us how the "Check_mysql" command is defined? You can probably see it under the CCM > Commands.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Problems with check_mysql

Post by nathanplatt »

Check_mysql Check_mysql -H $HOSTADDRESS$
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mysql

Post by lmiltchev »

Hmm, usually the command would be defined as such:

Code: Select all

check_mysql $USER1$/check_mysql -H $HOSTADDRESS$
where $USER1$ is the path to your plugins directory, for example "/usr/local/nagios/libexec".

Also, filenames in Linux are case-sensitive. Are you sure that your plugin is called "Check_mysql", not "check_mysql"?

Can you provide us with a download link to the plugin or post it on the forum?

Run the following commands from the command line, and show the output in code wraps:

Code: Select all

/usr/local/nagios/libexec/Check_mysql -h
/usr/local/nagios/libexec/check_mysql -h
Note: Change the path to the plugins directory if yours is different.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Problems with check_mysql

Post by nathanplatt »

So i updated the command as you said, correcting the capital letter

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_mysql -h
check_mysql v2.0.2 (nagios-plugins 2.0.2)
Copyright (c) 1999-2014 Nagios Plugin Development Team
        <devel@nagios-plugins.org>

This program tests connections to a MySQL server


Usage:
 check_mysql [-d database] [-H host] [-P port] [-s socket]
       [-u user] [-p password] [-S] [-l] [-a cert] [-k key]
       [-C ca-cert] [-D ca-dir] [-L ciphers] [-f optfile] [-g group]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
 -H, --hostname=ADDRESS
    Host name, IP Address, or unix socket (must be an absolute path)
 -P, --port=INTEGER
    Port number (default: 3306)
 -n, --ignore-auth
    Ignore authentication failure and check for mysql connectivity only
 -s, --socket=STRING
    Use the specified socket (has no effect if -H is used)
 -d, --database=STRING
    Check database with indicated name
 -f, --file=STRING
    Read from the specified client options file
 -g, --group=STRING
    Use a client options group
 -u, --username=STRING
    Connect using the indicated username
 -p, --password=STRING
    Use the indicated password to authenticate the connection
    ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==
    Your clear-text password could be visible as a process table entry
 -S, --check-slave
    Check if the slave thread is running properly.
 -w, --warning
    Exit with WARNING status if slave server is more than INTEGER seconds
    behind master
 -c, --critical
    Exit with CRITICAL status if slave server is more then INTEGER seconds
    behind master
 -l, --ssl
    Use ssl encryptation
 -C, --ca-cert=STRING
    Path to CA signing the cert
 -a, --cert=STRING
    Path to SSL certificate
 -k, --key=STRING
    Path to private SSL key
 -D, --ca-dir=STRING
    Path to CA directory
 -L, --ciphers=STRING
    List of valid SSL ciphers

 There are no required arguments. By default, the local database is checked
 using the default unix socket. You can force TCP on localhost by using an
 IP address or FQDN ('localhost' will use the socket as well).

Notes:
 You must specify -p with an empty string to force an empty password,
 overriding any my.cnf settings.

Send email to help@nagios-plugins.org if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
devel@nagios-plugins.org

[root@localhost ~]#
Still getting error in nagios, let me check... is this command checking if mysql is running or is it checking for a particular database?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mysql

Post by lmiltchev »

is this command checking if mysql is running or is it checking for a particular database?
In the usage (help menu) says:
This program tests connections to a MySQL server
You can run your check with or without specifying a db.

Example of a check, run from the CLI:

Code: Select all

/usr/local/nagios/libexec/check_mysql -H x.x.x.x -u <username> -p <password> -d <dbname>
Uptime: 3222142  Threads: 78  Questions: 53103835  Slow queries: 17  Opens: 67706  Flush tables: 1  Open tables: 64  Queries per second avg: 16.480|Connections=3449962c;;; Open_files=117;;; Open_tables=64;;; Qcache_free_memory=0;;; Qcache_hits=0c;;; Qcache_inserts=0c;;; Qcache_lowmem_prunes=0c;;; Qcache_not_cached=0c;;; Qcache_queries_in_cache=0;;; Queries=53103835c;;; Questions=53103832c;;; Table_locks_waited=54072c;;; Threads_connected=78;;; Threads_running=1;;; Uptime=3222142c;;;
Example command:

Code: Select all

define command {
    command_name    check_mysql
    command_line     $USER1$/check_mysql -H $HOSTADDRESS$ $ARG1$
}
Example service:

Code: Select all

define service {
    host_name                x.x.x.x
    service_description      Check MySQL
    use                      mytemplate
    check_command            check_mysql!-u username -p password -d dbname!!!!!!!
    register                 1
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
nathanplatt
Posts: 267
Joined: Thu May 07, 2015 4:59 am

Re: Problems with check_mysql

Post by nathanplatt »

So if i just pass the command -H ip address, it should work?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems with check_mysql

Post by scottwilkerson »

nathanplatt wrote:So if i just pass the command -H ip address, it should work?
yes
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked