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

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.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

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

Post 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.
Last edited by abrist on Thu May 30, 2013 3:44 pm, edited 2 times in total.
Reason: Please do not double post. We see everyones threads and get to them as soon as possible.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

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

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

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

Post 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.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

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

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
imran_khan
Posts: 196
Joined: Mon May 27, 2013 3:16 pm

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

Post by imran_khan »

Hello,

Within seconds get reply. Not getting socket error with other command except check_mysql.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked