nagios监控mysql

说明:被监控客户端要先安装mysql,必须安装mysql-devel,再安装nagios-plugins,nrpe

a、进入mysql,新建一个nagiosdb数据库,并授权

mysql �Curoot �Cp123456

create database nagiosdb;

grant all on nagiosdb.* tonagios@'localhost' identified by "123";

b、被监控客户端192.168.1.153,nrpe.cfg添加命令

vim /usr/local/nagios/etc/nrpe.cfg添加

command[check_mysql_status]=/usr/local/nagios/libexec/check_mysql-H localhost -d nagiosdb -uroot -p123

wKiom1YT1TSy3TkWAAGivkX_WBw035.jpg

c、监控服务器上的commands.cfg中定义如下配置:

define command{

   command_name check_nrpe

command_line$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

       }

   然后在监控服务器上配置文件中定义监控项目(192.168.1.153.cfg):

define service{

   use                           local-service

   host_name                    192.168.1.153

   service_description            mysql server

   check_command              check_nrpe!check_mysql_status

        }

check_mysql_status引用被监控端nrpe.cfg的命令

 监控成功显示如下:wKioL1YT1ajwK2buAAExQhVhdAc559.jpg


你可能感兴趣的:(mysql,监控,nagios)