Page 1 of 2

Status is showing Unknown when monitoring MySQL 5.7

Posted: Sat Jun 09, 2018 7:24 am
by cssp
Dear Team,

I tried to monitor MySQL 5.7 but the Status is Unknow and all are working as expected.

Nagios Core is installed in CentOS 7 with check_mysql_health plugin.

Command.cfg file

define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health -H $ARG4$ --username $ARG1$ --password $ARG2$ --port $ARG5$ --mode $ARG3$
}

localhost.cfg file

define service{
use local-service
host_name ubuntu
service_description MySQL slave-sql-running
check_command check_mysql_health!nagios!nagios!slave-sqlrunning!A.B.C.D!3306!
}

MySQL is installed in Ubuntu 16.04 with the check_mysql plugin.

User for nagios in MySQL
grant all privileges on *.* to 'nagios'@'Nagios-Server-IP-Address' identified by 'nagios';

Please let me know, What is wrong or need to do some extra tasks.

Thanks in advanced
Somnath Pandey

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Mon Jun 11, 2018 2:14 pm
by cdienger
What are the results if you try running the command from the command line:

/usr/local/nagios/libexec/check_mysql_health -H A.B.C.D --username nagios --password nagios --port 3306 --mode slave-sqlrunning

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Tue Jun 12, 2018 9:52 am
by cssp
Hi cdienger,

Please check the Output(error) of the /usr/local/nagios/libexec/check_mysql_health -H A.B.C.D --username nagios --password nagios --port 3306 --mode slave-sql-running

[root@localhost objects]# /usr/local/nagios/libexec/check_mysql_health -H A.B.C.D --username nagios--password nagios --port 3306 --mode slave-sql-running
CRITICAL - unable to get replication info


Firewall disable on BOTH SYSTEM

Ubuntu Client

root@Ubuntu-MySQL-Server:~# netstat -at | grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
tcp6 0 0 [::]:nrpe [::]:* LISTEN

CentOS Server

[root@localhost libexec]# netstat -at | grep nrpe
tcp6 0 0 [::]:nrpe [::]:* LISTEN

Thanks
Somnath Pandey

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Wed Jun 13, 2018 10:21 am
by scottwilkerson
Is the Ubuntu machine listening for remote connections on 3306?

Code: Select all

netstat -lnp|grep 3306
cssp wrote:MySQL is installed in Ubuntu 16.04 with the check_mysql plugin.
check_mysql_health doesn't use additional plugins, it connects directly to the server on 3306

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Wed Jun 13, 2018 12:17 pm
by cssp
Hi Scottwilkerson,

root@Ubuntu-MySQL-Server:~# netstat -lnp | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1269/mysqld

Also, I can able to connect MySQL server with MySQL Workbench(which is installed on my Windows 10 machine).

Please help me with this issue.

Thanks.

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Wed Jun 13, 2018 1:35 pm
by scottwilkerson
Can you run any of the other modes?

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Thu Jun 14, 2018 11:12 am
by cssp
Hi scottwilkerson,

You want to say with other user or something different?

cssp@Ubuntu-MySQL-Server:~$ netstat -lnp | grep 3306
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

Please check and update me.

Thanks

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Thu Jun 14, 2018 11:40 am
by scottwilkerson
cssp wrote:You want to say with other user or something different?
With a different mode, such as the following (changing our A.B.C.D and the username/password)

Code: Select all

/usr/local/nagios/libexec/check_mysql_health -H A.B.C.D --username nagios --password nagios --port 3306 --mode uptime

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Thu Jun 14, 2018 11:48 am
by cssp
Yes, I already checked but the error is showing same.

CRITICAL - unable to get replication info

Re: Status is showing Unknown when monitoring MySQL 5.7

Posted: Thu Jun 14, 2018 11:56 am
by scottwilkerson
cssp wrote:Yes, I already checked but the error is showing same.

CRITICAL - unable to get replication info
It doesn't make sense that you are getting a replication info error when asking for uptime.

Are you sure this is the error you received?