LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   error with check_mysql nagios (https://www.linuxquestions.org/questions/linux-newbie-8/error-with-check_mysql-nagios-4175456507/)

sarah allali 04-02-2013 07:52 AM

error with check_mysql nagios
 
i have configured check_mysql on my server :

#'check_mysql'command definition
define command{
command_name check_mysql
command_line $USER$/check_mysql -H $HOSADDRESS$ -u $ARG1$ -p $ARG2$
}
service definition:
define service{
use generic-service
host_name hostname
service_description mysql
check_command check_mysql!root!password
( root is user of mysql and 'nagios' is the password )

on NRPE server :
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H $ARG1$ -u $ARG2$ -p password
and i also did this :
mysql>grant all privileges on *.* to root@localhost Identified by 'nagios';
mysql>flush priviliges;

when i :
/usr/local/nagios/libexec/check_mysql -H 192.168.1.10 -u root -p nagios
Uptime: 350 Threads: 1 Questions: 104 Slow queries: Opens:99 Flush tables: 1 Open tables: 11 Queries per second avg: 0.709

but when i check_mysql via check nrpe i get:

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.10 -c check_mysql -u root -p nagios
i get this : Incorrect command line arguments supplied

so what did i do wrong because i tried everything and i tried changing arguments and everything but It won't work :)
thanx in advance

TB0ne 04-02-2013 09:44 AM

Quote:

Originally Posted by sarah allali (Post 4923440)
i have configured check_mysql on my server :
#'check_mysql'command definition
define command{
command_name check_mysql
command_line $USER$/check_mysql -H $HOSADDRESS$ -u $ARG1$ -p $ARG2$
}
service definition:
define service{
use generic-service
host_name hostname
service_description mysql
check_command check_mysql!root!password
( root is user of mysql and 'nagios' is the password )

on NRPE server :
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H $ARG1$ -u $ARG2$ -p password
and i also did this :
mysql>grant all privileges on *.* to root@localhost Identified by 'nagios';
mysql>flush priviliges;

when i :
/usr/local/nagios/libexec/check_mysql -H 192.168.1.10 -u root -p nagios
Uptime: 350 Threads: 1 Questions: 104 Slow queries: Opens:99 Flush tables: 1 Open tables: 11 Queries per second avg: 0.709

but when i check_mysql via check nrpe i get:

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.10 -c check_mysql -u root -p nagios
i get this : Incorrect command line arguments supplied

so what did i do wrong because i tried everything and i tried changing arguments and everything but It won't work :)
thanx in advance

Spell out your words. And if you referenced ANY of the NRPE documentation you've been given several times now, you'd see you're calling the command incorrectly.
Code:

define service{
        use                    generic-service
        host_name              hostname
        service_description    mysql
        check_command          check_nrpe!check_mysql
}


sarah allali 04-04-2013 08:35 AM

1 Attachment(s)
Code:

Spell out your words. And if you referenced ANY of the NRPE documentation you've been given several times now, you'd see you're calling the command incorrectly.
Code:
define service{
        use                    generic-service
        host_name              hostname
        service_description    mysql
        check_command          check_nrpe!check_mysql
}

i don't think this is the problem because i did the same thing with other services like tomcat and ping and i did what you told me i would get this message "check_mysql is not defined",
and i already defined check_nrpe in my file :
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOTSADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
}

and check_mysql on web interface of nagios as you can see is working it gives me okey : (all other services as well )
Attachment 12212
but when i launch the command line => /usr/local/nagios/libexec/check_nrpe -H 192.168.1.10 -c check_mysql -u root -p nagios
i get this : Incorrect command line arguments supplied

thank you for reply :)

TB0ne 04-04-2013 08:56 AM

Quote:

Originally Posted by sarah allali (Post 4924985)
Code:

Spell out your words. And if you referenced ANY of the NRPE documentation you've been given several times now, you'd see you're calling the command incorrectly.
Code:
define service{
        use                    generic-service
        host_name              hostname
        service_description    mysql
        check_command          check_nrpe!check_mysql
}

i don't think this is the problem because i did the same thing with other services like tomcat and ping and i did what you told me i would get this message "check_mysql is not defined", and i already defined check_nrpe in my file:
Code:

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOTSADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$
}


Great...check_nrpe is defined. However, your problem is with check_mysql. THAT is what you need to define correctly, which you haven't.
Quote:

and check_mysql on web interface of nagios as you can see is working it gives me okey : (all other services as well )
Attachment 12212
but when i launch the command line => /usr/local/nagios/libexec/check_nrpe -H 192.168.1.10 -c check_mysql -u root -p nagios
i get this : Incorrect command line arguments supplied
Right, because you need to define the host and other parameters for check_mysql in the service definition, and since you're passing them TWICE, that would give you the INCORRECT COMMAND LINE ARGUMENTS.

Again, you need to read/understand the check_nrpe documentation, and perhaps try researching this plugin, because there are MANY examples on how to configure it, such as this one, pulled from the Nagios forums:
Code:

nrpe.conf file info
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql -H xxxx -u xxxx -p *****
--------------
Service template for Nagios box
define service{
use generic-service
host_name xxxxxxxxxxxx
service_description MySQL Check
check_command check_nrpe!check_mysql
}

Again, all of this is covered in the Nagios documentation, and the plugin documentation. If you read it and pay attention to the errors that you're getting (which are VERY clear), it will tell you how to fix it.

And when posting follow-ups about check_mysql, it is rather pointless to post the check_nrpe configuration, isn't it??


All times are GMT -5. The time now is 07:31 PM.