说明:被监控客户端要先安装mysql,必须安装mysql-devel,再安装nagios-plugins,nrpe
a、进入mysql,新建一个nagiosdb数据库,并授权
mysql –uroot –p123456
create database nagiosdb;
grant all on nagiosdb.* [email protected] 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
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的命令
监控成功显示如下:
原文:http://9040429.blog.51cto.com/9030429/1700525