hcwzwx 发表于 2019-1-16 08:25:10

nagios 监控mysql

  安装nrpe-2.13.tar.gz   nagios-plugins-1.4.15.tar.gz
vim commands.cfg
加入:
#vim'check_mysql'command definition

define command {
  command_name    check_mysql
  command_line$USER1$/check_mysql-H $HOSTADDRESS$-u nagios-d nagios
  vimlocalhost.cfg (没有采用自定配置文件service.cgf这类的。我的是本机监控)
加入
define service{
  use          local-service    ;Name of service template touse      host_name    192.168.1.204
  service_description    MYSQL
  check_command   check_mysql
  notifications_enabled    0
  }
  (或者check_nrpe!check_mysql 这个根据自己来,我本机上加上了check_nrpe就不能运行{看到有文章用 check_nrpe!check_mysql })
  nrpe.cnf配置 pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,192.168.1.204
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command=/usr/local/nagios/libexec/check_mysql-m connection-time -u xxxx -p xxxxxx-P 3306-H 192.168.1.204(在本地不需要添加-H选项)
停止nrpeps -ef | grepnrpe      kill (-9)pid启动nrpe: /usr/local/nagios/libexec/bin/nrpe-c /usr/local/nagios/etc/nrpe.cfg -d
  重启nagiosservicenagiosrestart



页: [1]
查看完整版本: nagios 监控mysql