Nagios监控Mysql的方法

运维 系统运维
Nagios监控Mysql的方法:Nagios是一个监控系统运行状态和网络信息的监控系统。Nagios能监控所指定的本地或远程主机以及服务,同时提供异常通知功能等。这篇文章讲述的是Nagios监控Mysql的方法。

  nagios监控mysql方法

  nagios中添加mysql监控:

  1.在要监控的数据库服务器新建库和用户:

  1.   CREATE DATABASE nagdb DEFAULT CHARSET=utf8;  
  2.  
  3.   GRANT SELECT ON nagdb.* TO ‘nagios’@'192.168.100.%’;  
  4.  
  5.   UPDATE mysql.user SET `Password` = PASSWORD(‘********’) WHERE `User` = ‘nagios’  
  6.  
  7.   FLUSH PRIVILEGES;  
  8.  

  2.被监控端安装:

  1.   apt-get install libmysqlclient15-dev  
  2.  
  3.   ./configure –with-mysql=/opt/mysql or /var/mysql/ #针对每台数据库服务器的路径不同  
  4.  
  5.   make  
  6.  
  7.   make distclean  
  8.  
  9.   make all  
  10.  
  11.   vi /usr/local/nagios/etc/nrpe.cfg  
  12.  

  添加:

  1.   command[check_mysql_status]=/usr/local/nagios/libexec/check_mysql -H 192.168.100.200 -u nagios -d nagdb -p ‘nagios_4_dxy!’  
  2.  

  3.监控端服务器:

  1.   vi /usr/local/nagios/etc/objects/commands.cfg  
  2.  

  添加:

  1.   #check_mysql  
  2.  
  3.   define command{  
  4.  
  5.   command_name check_mysql  
  6.  
  7.   command_line $USER1$/check_Mysql -H $HOSTADDRESS$ -u nagios -d nagdb -p *******  
  8.  
  9.   }  
  10.  

  4.在监控端服务器的*.cfg中添加:

  1.   define service{  
  2.  
  3.   use generic-service  
  4.  
  5.   host_name Stalingrad-server  
  6.  
  7.   service_description check_mysql  
  8.  
  9.   check_command check_nrpe!check_mysql_status  
  10.  
  11.   notifications_enabled 0  
  12.  
  13.   }  
  14.  

  5.重启nagios。Nagios监控Mysql就可以啦。

【编辑推荐】

Nagios飞信Linux系统免费短信报警配置

20分钟内在Ubuntu上实现Nagios的主机监控

Nagios监控oracle

责任编辑:zhaolei 来源: nagiostutorial
相关推荐

2011-03-21 13:10:13

NagiosWindows

2011-03-24 10:59:08

Nagios监控数据库

2011-03-23 10:17:26

2011-03-04 10:47:06

Nagios监控Sphinx

2011-03-24 10:08:39

Nagios监控oracle

2011-03-28 16:37:38

2011-03-28 17:18:57

nagios监控iostat

2011-03-21 14:53:27

Nagios监控Linux

2011-04-01 15:42:13

CactiNagios

2011-03-24 10:59:10

Nagios监控mysql

2012-02-22 22:21:15

nagios开源

2011-03-21 14:43:42

2011-03-22 09:07:12

nagios监控oracle

2011-03-22 13:00:49

Nagios监控

2011-03-21 13:10:15

Nagios监控

2011-03-23 10:17:24

2011-03-21 14:53:27

Nagios监控Linux

2011-04-06 14:24:21

Nagios监控Linux

2011-03-21 14:53:36

Nagios监控Linux

2011-04-06 14:24:20

Nagios监控Linux
点赞
收藏

51CTO技术栈公众号