check_mysql

--------

NagiOS-Monitor MySQL/MariaDB Using check_mysql Plugin CentOS 7

Configure Steps on Client Machine :

Step 1:

Install Dependency

yum install perl-DBI perl-DBD-MySQL perl-GD

Step 2:

Method 1:

Check Plugin "check_mysql”  in “/usr/lib/nagios/plugins/” if did’nt found

Install nagios-plugins*

yum install nagios-plugins*

OR

Method 2:

Download “check_mysql” from “https://exchange.nagios.org/directory/Plugins/Databases/MySQL

Or

https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=174&cf_id=24

keep it on "/usr/lib/nagios/plugins/"

chmod +x /usr/lib/nagios/plugins/check_mysqld.pl

Step 3:

Create Database User of Monitor

mysql -u root –p

mysql> grant select on mysql.* to [email protected] identified by 'password';

mysql> flush privileges;

Step 4:

Go to Nagios Server

## Add Service on webserver.linuxtopic.cfg

vi /usr/local/nagios/etc/servers/webserver.linuxtopic.cfg

define service{

       use                           generic-service         ; Inherit default values from a template

       host_name               webserver.linuxtopic.com

       service_description  MySQL

       check_command      check_mysqld

       check_interval          1

       retry_interval            1

       }

Step 5:

### commands.cfg

vi /usr/local/nagios/etc/objects/commands.cfg

define command{

   command_name   check_mysqld

   command_line      $USER1$/check_mysql -H $HOSTADDRESS$ -u nagios -ppassword -f -T -a uptime,threads_connected,questions,slow_queries,open_tables -w ",,,," -c ",,,,"

}

Step 6:

Check plugin “check_mysql” if not found copy from “172.17.20.103” and keep on “/usr/local/nagios/libexec/”

rsync -ave 'ssh -p22' [email protected]:/usr/lib64/nagios/plugins/check_mysql /usr/local/nagios/libexec/

Step 7:

Test Mysql_check Plugin

cd /usr/local/nagios/libexec

./check_mysql -H 172.17.20.103 -u nagios -ppassword

Restart Nagios Service

   

systemctl restart nagios

Step 7:

Check on Nagios on Web Browser.

http://172.17.20.100/nagios

========================

---------