Nagios监控Mysql的方法

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

  nagios监控mysql方法

  nagios中添加mysql监控:

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

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

  2.被监控端安装:

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

  添加:

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

  3.监控端服务器:

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

  添加:

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

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

  define service{  
 
  use generic-service  
 
  host_name Stalingrad-server  
 
  service_description check_mysql  
 
  check_command check_nrpe!check_mysql_status  
 
  notifications_enabled 0  
 
  }  
 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 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-24 10:08:39

Nagios监控oracle

2011-03-04 10:47:06

Nagios监控Sphinx

2011-03-28 17:18:57

nagios监控iostat

2011-04-01 15:42:13

CactiNagios

2011-03-21 14:53:27

Nagios监控Linux

2011-03-28 16:37:38

2011-03-24 10:59:10

Nagios监控mysql

2011-03-21 14:43:42

2011-03-22 09:07:12

nagios监控oracle

2012-02-22 22:21:15

nagios开源

2011-03-22 13:00:49

Nagios监控

2011-03-21 13:10:15

Nagios监控

2011-03-23 10:17:24

2011-03-25 15:37:17

Solarisnagios

2011-03-21 15:42:14

LinuxNagios

2011-03-24 10:59:11

NagiosWindows监控

2011-03-04 11:18:15

Nagios监控Sphinx
点赞
收藏

51CTO技术栈公众号