nagios监控mysql5.6.17-1.docx_第1页
nagios监控mysql5.6.17-1.docx_第2页
nagios监控mysql5.6.17-1.docx_第3页
nagios监控mysql5.6.17-1.docx_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

在mysql服务器安装check_mysql_health首先在mysql被监控机安装nagios-plugins以及nrpe-2.15,过程不在详细描述。安装check_mysql_healthtarzxvfcheck_mysql_health-2.1.1.tar.gz-C./software/./configure -prefix=/usr/local/nagios/ -with-mysql=/var/lib/mysql/make & make installyum install perl-DBI perl-DBD-MySQL y 这两个必须安装 否则运行check_mysql_health命令的时候,会报错在安装perl-DBD-MySQL的过程中 遇到了一个问题 在装好mysql的机器里,没有mysql-libs包,在yum安装的时候,会报错,因为mysql版本为5.6.17-1,但是yum装的mysql-libs版本为mysql-libs-5.1.73-3.el6_5.x86_64,我采取了强制安装的方法yum install -y yum-downloadonly 安装yum下载功yum install perl-DBD-MySQL -y -downloadonly -downloaddir=/opt 下载perl-DBD-MySQL的依赖包rpm -ivh mysql-libs-5.1.73-3.el6_5.x86_64.rpm -force nodeps 强制安装mysql-libsrpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpm -force nodeps 强制安装perl-DBD因为mysql的机器开启了防火墙,mysql用的是3307端口,所以在防火墙中打开3307端口iptables -I INPUT -p tcp -dport 3307 -j ACCEPT 防火墙打开3307端口/etc/init.d/iptables save 保存防火墙设置/etc/init.d/iptables restart 重启防火墙测试命令/usr/local/nagios/libexec/check_mysql_health -hostname 127.0.0.1 -username nagios -password 123456 -port 3307 -mode threads-connectedOK - 1 client connection threads | threads_connected=1;10;20-hostname 被监控端(数据库所在机器)的地址-username 要监控的database用户的名称-database 要监控的database的名称 默认为information_schema-password 要监控的databases密码-port 数据库端口 如不写就是默认3306-mode 后边跟的是要监控的内容贴出来官方给的可以监控的数据the mode of the plugin. select one of the following keywords: 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) threads-created (Number of threads created per sec) threads-running (Number of currently running threads) threads-cached (Number of currently cached threads) connects-aborted (Number of aborted connections per sec) clients-aborted (Number of aborted connections (because the client died) per sec) 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) table-fragmentation (Show tables which should be optimized) open-files (Percent of opened files) 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)在mysql机器中的nrpe.conf中 添加一行commandcheck_mysql=/usr/local/nagios/libexec/check_mysql_health hostname 127.0.0.1 -username nagios -password 123456 -port 3307 -mode threads-connected -warning 3 -critical 5运行结果/usr/local/nagios/libexec/check_mysql_health -hostname 127.0.0.1 -username nagios -password 123456 -port 3307 -mode threads-connected -warning 3 -critical 5CRITICAL - 6 client connection threads | threads_connected=6;3;5在监控端添加以下参数define service use srv-pnp host_name mysql-linux154 service_description connect check_command check_nrpe!check_mysql max_check_attempts 5 normal_check_interval 3 retry_check_interval 2 check_period 24x7 notification_interval 10 notification_period 24x7 notification_options w,u,c,r contact_groups yunying 在nagios服务器安装check_mysql_health安装过程与上边基本相同Nagios相关配置配置commands.cfg文件define commandcommand_name check_mysql_healthcommand_line $USER1$/check_mysql_health -hostname $ARG1$ -port $ARG2$ -username $ARG3$ -password $ARG4$ -mode $ARG5$ -warning $ARG6$ -critical $ARG7$配置mysql.cfg文件define serviceuse local-service ; Name of service template to usehost_name myhostnameservice_description check_mysql_connectionscheck_command check_mysql_health!192.168.0.1!3306!myname!mypassword!threads-connected!1000!1500define serviceuse local-service ; Name of service template to usehost_name myhostnameservice_description check_mysql_table_lockcheck_command check_mysql_health!192.168.0.1!3306!myname!mypassword!table-lock

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论