Nagios下check_mysql_health插件的安装
Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设备,打印机等。在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。本博客是Nagios下check_mysql_health插件的安装及错误解决.
到http://www.olinux.org.cn/ 下载check_mysql_health-2.2.2.tar.gz
#tar -zxvf check_mysql_health-2.2.2.tar.gz
#cd check_mysql_health-2.1
#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-perl=/usr/bin/perl
#make && make install
#/usr/local/nagios/libexec/check_mysql_health --hostname 192.168.106.22 --port 3306 --username root --password root --mode threads-connected --warning 700 --critical 1000
报错:
Perhaps the DBD::mysql perl module hasn't been fully installed 错误原因:系统没有按安装DBI组件。DBI(Database Interface)是perl连接数据库的接口
需要执行:yum install perl-DBI perl-DBD-MySQL -y
报冲突错误:
file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.73-7.el6.x86_64 conflicts with file from package MySQL-server-5.6.34-1.linux_glibc2.5.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.73-7.el6.x86_64 conflicts with file from package MySQL-server-5.6.34-1.linux_glibc2.5.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.73-7.el6.x86_64 conflicts with file from package MySQL-server-5.6.34-1.linux_glibc2.5.x86_64
这时候千万不要删除yum -y remove MySQL-server-5.6.34-1.linux_glibc2.5.x86_64
应该:到http://downloads.mysql.com/archives/community/下载MySQL-shared-compat-5.6.34-1.linux_glibc2.5.x86_64.rpm (注意版本的选择要根据报错来,注意是待compat的那个rpm)
rpm -ivh MySQL-shared-5.6.34-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.34-1.linux_glibc2.5.x86_64.rpm
然后在执行yum install perl-DBI perl-DBD-MySQL -y
#/usr/local/nagios/libexec/check_mysql_health --hostname 192.168.106.33 --port 3306 --username root --password root --mode slave-io-running --warning 700 --critical 1000
connection-time (Time to connect to the server)
uptime (Time the server is running)
threads-connected (Number of currently open connections)线程数
threadcache-hitrate (Hit rate of the thread-cache)慢查询
slave-lag (Seconds behind master)
slave-io-running (Slave io running: Yes)主从热备
slave-sql-running (Slave sql running: Yes)主从热备
qcache-hitrate (Query cache hitrate)
qcache-lowmem-prunes (Query cache entries pruned because of low memory)
keycache-hitrate (MyISAM key cache hitrate)
bufferpool-hitrate (InnoDB buffer pool hitrate)
bufferpool-wait-free (InnoDB buffer pool waits for clean page available)
log-waits (InnoDB log waits because of a too small log buffer)
tablecache-hitrate (Table cache hitrate)
table-lock-contention (Table lock contention)锁表率
index-usage (Usage of indices)
tmp-disk-tables (Percent of temp tables created on disk)
slow-queries (Slow queries)
long-running-procs (long running processes)
cluster-ndbd-running (ndnd nodes are up and running)
sql (any sql command returning a single number)