nagios监控mysql
本监控为基于nagios服务器主动监控方法,利用check_mysql_health实现多种监控模式:
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)
具体步骤如下:
1、安装
#wget http://labs.consol.de/wp-content/uploads/2009/10/check_mysql_health-2.1.tar.gz
#tar -zxvf check_mysql_health-2.1.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
2、命令测试
#cd /usr/local/nagios/libexec
#./check_mysql_health --hostname 192.168.0.1 --port 3306 --username myname --password mypassword --mode threads-connected --warning 700 --critical 1000
当出现Can't locate DBI.pm的错误时:
#yum install perl-DBI perl-DBD-MySQL -y
再次执行,结果如下:
OK - 607 client connection threads | threads_connected=607;700;1000
命令参数:
–hostname <hostname>
Der Datenbankserver, der überwacht werden soll. Im Falle von "localhost" kann dieser Parameter weggelassen werden.
–username <username>
Der Datenbankuser.
–password <password>
Dessen Passwort.
–mode <modus>
Mit dem mode-Parameter teilt man dem Plugin mit, was es tun soll.
–name <objektname>
Hier kann die Prüfung auf ein einziges Objekt begrenzt werden.
–name2 <string>
Verwendet man –mode=sql, dann erscheint das SQL-Statement in der Ausgabe und den Performancedaten.
–warning <range>
–critical <range>
–environment <variable>=<wert>
–method <connectmethode>
Mit diesem Parameter teilt man dem Plugin mit, wie es sich zur Datenbank verbinden soll.
–units <%|KB|MB|GB>
3、nagios命令、服务配置
#vi /usr/local/nagios/etc/objects/commands.cfg
...
#'check_mysql_health'
define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$
--warning $ARG6$ --critical $ARG7$
}
...
#vi /usr/local/nagios/etc/objects/servers/localhost.cfg
...
define service{
use local-service ; Name of service template to use
host_name myhostname
service_description check_mysql_connections
check_command check_mysql_health!192.168.0.1!3306!myname!mypassword!threads-connected!1000!1500
}
define service{
use local-service ; Name of service template to use
host_name myhostname
service_description check_mysql_table_lock
check_command check_mysql_health!192.168.0.1!3306!myname!mypassword!table-lock-contention!1!2
}
...
4、重启nagios服务
#service nagios restart
nagios监控mysql的更多相关文章
- nagios监控mysql及邮件报警
1.使用默认监控命令check_http命令+相关的参数来实现,如下: 在command.cfg添加如下关键词监控命令:check_http_word,参数解析:-I指定IP或者主机名,-u指定URL ...
- Nagios监控mysql主从复制
因为公司的nagios用了很久监控项目很多,也在zabbix迁移中,也就先临时用nagios监控mysql主从了 mysql> show slave status\G 查看其输出,即可判定主从复 ...
- nagios监控mysql主机,nginx,磁盘IO,网卡流量
http://blog.chinaunix.net/uid-28685162-id-3506260.html nagios安装完成,打开/usr/local/nagios/etc/nagios.cfg ...
- Nagios 监控 Mysql
被监控机的Mysql监控创建专用数据库.专用数据库账户mysql -uroot -pcreate database nagios_monitor;grant select on nagios_moni ...
- nagios监控mysql主从状态
看了网上很多mysql主从监控的,大部分都是shell的,就算是python的,也是在python下跑shell语句.我写了一个python的监控脚本,用到了mysqldb这个包.脚本如下: [roo ...
- nagios系列(七)nagios通过自定义脚本的方式监控mysql主从同步
nagios监控mysql主从同步 起因:nagios可能监控到mysql服务的运行情况,但确不能监控mysql的主从复制是否正常:有时候,同步已经停止,但管理人员却不知道. 登陆mysql从服务器, ...
- Nagios监控平台搭建
Nagios是一款开源的免费网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员, ...
- 一步步实现Nagios监控linux主机及飞信报警
一步步实现Nagios监控linux主机及飞信报警 上篇文章介绍了在linux主机上架设nagios监控服务,并对windows主机进行服务状态变化的监控,这次我们继续上次内容. 首先实现n ...
- Nagios监控mongodb分片集群服务实战
1,监控插件下载 Mongodb插件下载地址为:git clone git://github.com/mzupan/nagios-plugin-mongodb.git,刚開始本人这里没有安装gitpu ...
随机推荐
- eclipse memory内存溢出
eclipse 跑web程序时候 内存溢出..解决方式 设置 jvm内存分配方案: -Xms800m -Xmx800m -XX:MaxNewSize=256m -XX:MaxPermSize=256m
- VC 与Matlab混合编程之引擎操作详解
Visual C++ 是当前主流的应用程序开发环境之一,开发环境强大,开发的程序执行速度快.但在科学计算方面函数库显得不够丰富.读取.显示数据图形不方便. Matlab 是一款将数值分析.矩阵计算.信 ...
- css3和jquery实现的可折叠导航菜单(适合手机网页)
之前为大家介绍了好几款css3导航,今天为大家在介绍的是一款适合放在手机网页的导航菜单.点击列表图标以下拉式的形式显示菜单,单击关闭,动画关闭.效果相当不错.效果图如下: 在线预览 源码下载 这个 ...
- [转]关闭word进程
命名空间 :System.Diagnostics 以前在word的时候,经常碰到word进程产生一大堆,怕关错了,把用户自己打开的word也关闭,一直搞忽悠,今天上网花了10块钱,下了个文件,给我了一 ...
- PKU OJ Exponentiation
ExponentiationTime Limit: 500MS Memory Limit: 10000KTotal Submissions: 155886 ...
- WIFEXITED/WEXITSTATUS/WIFSIGNALED
WIFEXITED/WEXITSTATUS/WIFSIGNALED If the exit status value (*note Program Termination::) of the chil ...
- linux 内核参数调整优化网络
Linux系统内核设置优化tcp网络,# vi /etc/sysctl.conf,添加以下内容 net.ipv4.tcp_syncookies = 1 表示开启SYN Cookies.当出现SYN等待 ...
- java多线程面试题整理及回答
1)现在有T1.T2.T3三个线程,你怎样保证T2在T1执行完后执行,T3在T2执行完后执行? 这个线程问题通常会在第一轮或电话面试阶段被问到,目的是检测你对”join”方法是否熟悉.这个多线程问题比 ...
- GSM错误代码表
转:http://blog.csdn.net/renjwjx/article/details/2290667 GSM device: AT+CMEE=1 AT&W CME ERROR's ...
- 丰富您设计的10个CSS3效果库
Magic CSS3 Animations Magic CSS3 Animations是一个CSS3动画包,拥有一些特效可以你的Web项目中免费使用.拥有像金光闪闪,角度,旋转,炸弹等特殊效果.使用简 ...