Monitor MySql Services in Nagios on LINUX/CENTOS

Nagios is a good observance to keep up MySQL Database server information by employing a plugin “check_mysql_health”. This plugin permits you to monitor MySQL Database server information and keep track of mysql server data like uptime, temp tables, table cache hit rate, connected threads, slow-queries and additional. To configure mysql plugin in nagios on linux/centos follow the step-by-step method.

Installation and Configuration of check_mysql_health plugin in Nagios:

Step 1 : Install perl packages and check_myssql_health
Step 2 : Mysql database permission
Step 3 : Create new file and add services in nagios
Step 4 : login to Nagios web page to check the mysql services

Now you can proceed with the configuration:

Step 1 :
i. To monitor MySQL services in Nagios, you need to deliver some packages that are essential to configure MySQL in Nagios.

#yum install perl asciidoc

ii. Download and configure the latest version of MySQL Health Check plugin from the Nagios site.

#wget http://labs.consol.de/download/shinken-nagios-plugins/check_mysql_health-2.1.8.2.tar.gz

#tar -zxvf check_mysql_health-2.1.8.2.tar.gz

#cd check_mysql_health-2.1.8.2

#./configure

#make

#make install

Step 2 : Create user and password in mysql so the user can monitor all the admin service.

i. login to mysql:

#mysql -p

#mysql> CREATE USER nagios@nagios server IP address IDENTIFIED BY ‘password’;

ii. Provide the info about the new file in nagios.cfg:

#vi /usr/local/nagios/etc/nagios.cfg

Add this command to accept the mysql monitoring with Nagios:

#cfg_file=/usr/local/nagios/etc/objects/mysqlmonitor.cfg

iii. Open the command.cfg file to add the command in service command definition

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

Add

Step 3 : Create a new file i.e. mysqlmonitor.cfg in the path provided /usr/local/nagios/etc/object

#vi /usr/local/nagios/etc/objects/mysqlmonitor.cfg

define service{
use local-service
host_name               linux-server
service_description     MySQL Open Files
check_command           check_mysql_health!nagios!password!Open Files!192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL connection-time
check_command           check_mysql_health!nagios!password!connection-time!192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL Uptime
check_command           check_mysql_health!nagios!password!uptime!192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL thread-connected
check_command           check_mysql_health!nagios!password!threads-conne
cted!192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL tmp-disk-tables
check_command           check_mysql_health!nagios!password!tmp-disk-
ables                                ! 192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL slow-queries
check_command           check_mysql_health!nagios!password!slow-queries!
192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL long-running-procs
check_command           check_mysql_health!nagios!password!long-running-
procs! 192.168.1.4!3306
}
define service{
use local-service
host_name               linux-server
service_description     MySQL table-lock-contention
check_command           check_mysql_health!nagios!nagios!table-lock-contention!192.168.1.4!3306
}

Step 4 : After completion of all the above steps login to Nagios website and you can determine the mysql services that are monitored by Nagios.

reload or restart nagios demon for changes to require result

#service nagios reload

 

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk