Monitor mysql options
After installing mysql, You need to monitor the mysql service.
The check_mysql provided by nagios open-source is good for mysql Server Load balancer. However, the monitoring of database hosts is insufficient. Use a monitoring plug-in: check_mysql_health download and usage see: http://exchange.nagios.org/directory/MySQL/check_mysql_health/details specific monitoring: for slave machines, use the check_mysql monitoring command [check_mysql_slave] =/usr/local/nagios/libexec/check_mysql-H localhost-s/tmp/mysql that comes with nagios. sock-u root-p xxx-S-w 1-c 3 where the user and password may be changed. 1 second delay warning, 3 seconds delay alarm. Check_mysql_health monitoring mysql master server/usr/local/nagios/libexec/custom/check_mysql_health -- hostname localhost -- socket/tmp/mysql. sock -- username root -- password xxxxxx -- mode xxxxx -- warning xxxxx -- criticalxxxxx mode:
Connection-time (Time to connect to the server)
Uptime (Time the server is running)
Threads-connected (Number of currently open connections)
Threadcache-hitrate (thread cache hit rate)
Slave-lag (Seconds behind master)
Slave-io-running (Slave io running: Yes)
Slave-SQL-running (Slave SQL running: Yes)
Qcache-hitrate (query hit rate. If this value is close to 100%, the server select optimization will be better)
Qcache-lowmem-prunes (because the memory is small, the number of cache queries deleted from the memory can increase query_cache_size, reduce lowmem, and increase the hit rate)
Keycache-hitrate (MyISAM key cache hit rate. If the hit rate is too low, increase key_buffer_size)
Bufferpool-hitrate (InnoDB buffer pool hit rate)
Bufferpool-wait-free (page on which InnoDB buffer pool is waiting for cleaning)
Log-waits (InnoDB log wait write time, if this wait time is too large, increase the size of the log Buffer Pool)
Tablecache-hitrate (Table cache hit rate)
Table-lock-contention (Table lock rate)
Index-usage)
Tmp-disk-tables (number of temporary tables created)
Slow-queries)
Long-running-procs (long-running process)
Cluster-ndbd-running (mysql cluster Monitoring)
SQL (execute an SQL statement that returns a number and check whether mysql can be linked for query)
Example: nrpe. cfg: command [check_mysql_health] =/usr/local/nagios/libexec/custom/check_mysql_health -- hostname localhost -- socket/tmp/mysql. sock -- username xxxxx -- password xxxxx -- mode $ ARG1 $ -- warning $ ARG2 $ -- critical $ ARG3 $ xxx. cfg: define service {use xxxxxx host_name xxxxxx service_description mysql database connections check_command check_nrpe_args! Check_mysql_health! Threads-connected! 80! 120} define service {use xxxxx host_name xxxxx service_description mysql database innodb cache hit check_command check_nrpe_args! Check_mysql_health! Bufferpool-hitrate} define service {use xxxxx host_name xxxxx service_description the page on which the innodb buffer pool of the mysql database is waiting for cleaning check_command check_nrpe_args! Check_mysql_health! Bufferpool-wait-free} define service {use xxxxx host_name xxxxx service_description mysql database innodblog write wait time check_command check_nrpe_args! Check_mysql_health! Log-waits} define service {use xxxxx host_name xxxxx service_description mysql database lock table rate check_command check_nrpe_args! Check_mysql_health! Table-lock-contention} define service {use xxxxx host_name xxxxx service_description number of files opened in mysql database check_command check_nrpe_args! Check_mysql_health! Open-files! 80! 90} define service {use xxxxx host_name xxxxx service_description mysql database slow query rate check_command check_nrpe_args! Check_mysql_health! Slow-queries! 5! 10. PS: For warnging and critical values: 10 is greater than 10% alarm, 10 is less than 10% alarm, is not filled is the default value. Mode: Only one statement can be run. -- mode xxx1 xxx2: xxx1 takes effect -- mode xxx1 -- mode xxx2: xxx2 takes effect.