首先下载目前最高的版本
http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download(会有mysql_check)
http://labs.consol.de/wp-content/uploads/2010/06/check_mysql_health-2.1.2.tar.gz(mysql_check_health check_mysql_query)
http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.017.tar.gz  (如果有安装可以省略,安装mysql_check_health需要,如果你是rpm的可以直接yum如果缺少perl-DBD-Pg也可以yum)
1、tar xvzf nagios-plugins-1.4.15.tar.gz
cd  nagios-plugins-1.4.15
./configure –with-nagios-user=nagios –with-nagios-group=nagios –prefix=/usr/local/nagios –with-mysql=/usr/local/mysql
make && make install
chwon -R nagios.nagios /usr/local/nagios
2、vim commands.cfg
加入:
define command {
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$  -P $ARG1$ -u $ARG2$  -p $ARG3$
}
vim localhost.cfg
加入
define service{
        use                             local-service         ; Name of service template to use
        host_name                       test-linux
        service_description             MYSQL
        check_command                   check_mysql!3306!root!password
        notifications_enabled           0
        }
检查语法后重启。
3、tar xvzf  DBD-mysql-4.017.tar.gz
perl Makefile.PL –libs=”-L/usr/local/mysql/lib/mysql -lmysqlclient -lz” –cflags=-I/usr/local/mysql/include/mysql –testhost=127.0.0.1
例子:
# perl Makefile.PL –testdb=数据库 –testuser=用户 –testpassword=密码
make
make test
make install
4、tar xvzf check_mysql_health-2.1.2.tar.gz
cd  check_mysql_health-2.1.2
./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios –with-perl –with-statefiles-dir=/tmp
make && make install
cd /usr/local/nagios/libexec/
./check_mysql_health: yes: bad interpreter: No such file or directory
解决方法因为check_mysql_health是用perl写的,将check_mysql_health的第一行由原来的#! yes -w修改为#!/usr/bin/perl,这样就OK
./check_mysql_health –hostname 192.168.169.123 –port 3306 — username root –password linuxtone –mode threadcache-hitrate
返回:OK – thread cache hitrate 91.30% | thread_cache_hitrate=91.30%;90:;80: thread_cache_hitrate_now=91.30%

connections_per_sec=0.00 就成功了,我有看到很多文章给这个用户开个权限账户和root一样的权限,不明白是为什么,就是迷惑一下人?我的root也可以正常使用,也许是为了安全。
vi commands.cfg
输入:
#check_health_mysql
define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health –hostname $ARG1$ –port $ARG2$ –username $ARG3$ –password $ARG4$ –mode $ARG5$
}
vim localhost.cfg
加入
define service{
host_name dbss-slave
service_description threads-connected
check_command check_mysql_health!192.168.169.123!3306!root!linuxtone!threads-connected
}
检测配置文件后重启。
查询线程缓存命中率状态:threadcache-hitrate
查询命中率:qcache-hitrate
查看锁表率:table-lock-contention
查看数据库服务器当前连接数量:threads-connected

转载于:https://blog.51cto.com/lxsym/484763

nagios监控mysql相关推荐

  1. nagios监控mysql(check_mysql)及内存使用率(check_mem)

    一.监控本地(localhost)内存 1.上传监控脚本 check_mem 到/usr/local/nagios/libexec # chown -R nagios.nagios check_mem ...

  2. nagios监控mysql服务_nagios监控mysql及邮件报警

    1.使用默认监控命令check_http命令+相关的参数来实现,如下: 在command.cfg添加如下关键词监控命令:check_http_word,参数解析:-I指定IP或者主机名,-u指定URL ...

  3. nagios监控mysql主从

    为什么80%的码农都做不了架构师?>>>    nagios监控mysql的主从,我这里介绍两种方法,一种是用nagios自带监控mysql 的插件实现,另一种是自己写脚本,下面是两 ...

  4. nagios监控mysql服务_nagios监控mysql服务

    配置被监控端 1.安装check_mysql插件 nagios 监控 mysql 需要用到 check_mysql 和 check_mysql_query 两个插件. 安装完成 nagios 后,发现 ...

  5. nagios监控mysql主机,nginx,cpu,网卡流量

    nagios安装完成,打开/usr/local/nagios/etc/nagios.cfg去掉cfg_dir=/usr/local/nagios/etc/servers前面的#号,并创建/usr/lo ...

  6. nagios监控mysql主从复制

    环境: Centos5.6 mysql只做同步指定库,没有同步mysql库用户数据 登陆从服务器mysql,添加验证的用户 grant replication client on *.* to 'sl ...

  7. nagios监控 mysql 表结构

    引言 为了给客户演示对mysql表结构的监控,在搜了很久之后发现不得不自己写一个脚本了.percona这么牛B的公司竟然没有提供一个这方面的工具,看来客户的要求有点花儿不实啊...这个问题一共花费了我 ...

  8. nagios 监控 mysql 读写比 R/W

    为什么80%的码农都做不了架构师?>>>    #!/usr/bin/python2.7 # -*- coding:utf-8 -*- from optparse import Op ...

  9. nagios使用check_mysql监控mysql

    nagios监控mysql服务器: 在被监控机上 1.建立专用数据库: [root@svr3 ~]# /usr/local/webserver/mysql/bin/mysql -u root -p E ...

最新文章

  1. php 函数 变量,PHP函数中变量的说明
  2. django_2.0_请求处理
  3. 百度ueditor 拖文件或world 里面复制粘贴图片到编辑中 上传到第三方问题
  4. js中同时得到整数商及余数_苏教版小学数学二年级下册1.1有余数的除法讲解
  5. Mysql 5.5 源码安装
  6. Flask--SQLAlchemy
  7. 字符串暴力匹配算法+思路分析
  8. (一)深入浅出TCPIP之理解TCP报文格式和交互流程
  9. SQL Server 轻松解决令你头疼的sa登录
  10. 在网页中引用DWG控件,交互绘图,和响应鼠标点击对象的方法
  11. 网络_Wake-on-Lan(WoL)软件推荐, 让你不在局域网也能实现网络唤醒
  12. 【合同】产品设计:ID与MD设计合同模板
  13. 第十八章 计算机取证
  14. 【算法分析】回溯法解数独(九宫格)算法
  15. 二级公立医院绩效考核病案首页上报系统
  16. 仿win10系统UI界面纯html网页网站后台UI界面
  17. 低代码里程碑版—JeecgBoot 3.4.3 版本发布,低代码功能专项升级
  18. SQL归纳总结(1)
  19. 跟刀客一起追寻昨日的足迹
  20. 【Linux】树状目录结构

热门文章

  1. [BZOJ4815][CQOI2017]小Q的表格 数论+分块
  2. Altium Designer 09 (Protel)总线使用方法(解决导入PCB无网络标号问题)
  3. MariaDB mysql 比较区别 选择
  4. JavaScript call,apply和prototype的介绍,区别
  5. Android -- PullToRefresh应用
  6. Aspose.Word 的常见使用(不用模板创建)
  7. Android多线程之同步锁的使用
  8. Java、Android—零碎难记笔试考点(持续更新)
  9. mysql-nt.exe w3wp.exe cpu 100%_认识w3wp.exe进程,从根本上解决占用资源较大问题
  10. mysql快速入门_MySQL快速入门(三)