Page 1 of 2

How to monitor MySQL in Nagios with enabled networking.....

Posted: Tue May 28, 2013 1:23 pm
by imran_khan
Hello All,

I have installed and configured NRPE agent on Linux box (Server A) and configured all the services in Nagios system and its working fine expect MySQL database service, it showing error “Can't connect to MySQL server on 'Server A' (111)” in Nagios monitor system (Server B). I have already added user and grant the Nagios server host to that user. Please find the details for the same.

NRPE file setting (Server A):-
root@example.com [~]# cat /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1, Server B IP Address
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql -H localhost -u xyz -p user_password

Database user:-

| xyz | *844736F9FFBEFB8FB25ED19 | Server B IP Address

In the MySQL configuration file of (Server A) networking is enabled for security purpose but I want to monitor MySQL database service without removing/disabling networking (skip- networking) option from configuration file. How can I do, please suggest me.

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 1:31 pm
by abrist
Have you tried running the check from the cli (on the remote host running the mysql db)?

Code: Select all

/usr/lib64/nagios/plugins/check_mysql -H localhost -u xyz -p user_password

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 1:36 pm
by imran_khan
Hello,

This command is working fine on remote database server. Please find the details for the same.

/usr/lib64/nagios/plugins/check_mysql -H localhost -u xyz -p user_password
Uptime: 3200215 Threads: 5 Questions: 661109334 Slow queries: 68665 Opens: 39224251 Flush tables: 1 Open tables: 64 Queries per second avg: 206.582

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 2:28 pm
by sreinhardt
Great to see that the local check is working, can you now show us what your check_nrpe command looks like on the nagios server side of things?

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 2:32 pm
by abrist
Does you password or username include any nasty meta chars? (#,%,!,@,etc?)
Lets try the check from the Nagios Server now:

Code: Select all

/usr/lib64/nagios/plugins/check_nrpe -H <server A ip> -c check_mysql

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 2:42 pm
by imran_khan
Hello,

Getting below error.

[root@example2.com]# /usr/lib64/nagios/plugins/check_nrpe -H <Server A IP> -c check_mysql
CHECK_NRPE: Socket timeout after 10 seconds.
[root@example2.com]# /usr/lib64/nagios/plugins/check_nrpe -H <Server A IP> -c check_mysql
CHECK_NRPE: Socket timeout after 10 seconds.

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 2:48 pm
by imran_khan
Hello,

Other command is working fine except check_mysql.

[root@example2.com]# /usr/lib64/nagios/plugins/check_nrpe -H 69.64.43.172 -c check_ssh
SSH OK - OpenSSH_5.3 (protocol 2.0) | time=0.006040s;;;0.000000;10.000000
[root@example2.com]# /usr/lib64/nagios/plugins/check_nrpe -H 69.64.43.172 -c check_load
OK - load average: 7.09, 6.31, 7.48|load1=7.090;30.000;40.000;0; load5=6.310;25.000;35.000;0; load15=7.480;20.000;31.000;0;
[root@example2.com]# /usr/lib64/nagios/plugins/check_nrpe -H 69.64.43.172 -c check_swap
SWAP OK - 86% free (1755 MB out of 2047 MB) |swap=1755MB;409;204;0;2047

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 3:00 pm
by abrist
When you run it locally, how long does the check take to run? Have you looked over the nrpe common solutions document for the socket timeout error?
http://assets.nagios.com/downloads/nagi ... utions.pdf

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 3:12 pm
by imran_khan
Hello,

Within seconds get reply. Not getting socket error with other command except check_mysql.

Re: How to monitor MySQL in Nagios with enabled networking..

Posted: Tue May 28, 2013 3:24 pm
by abrist
Does you password or username include any nasty meta chars? (#,%,!,@,etc?)
Also, check permissions on the remote host:

Code: Select all

ls -la /usr/lib64/nagios/plugins