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 nagios@172.17.20.103 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' root@172.17.20.103:/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
Part 1: Nagios Core 4.X configuration in Linux
Part 2: Add Remote hosts and service in Nagios
Part 3: Monitor MySQL/MariaDB Using check_mysql Plugin
Part 4: Monitor Tomcat using check_tomcat Plugin
Great article. Thanks for updating this.
ReplyDeletetest
ReplyDeleteEver wondered how a baby Best Monitor can help you look after your newborn baby in the early weeks and months? Our article will introduce one of the most useful baby monitors out there, the baby breathing monitor.
ReplyDelete