- 被监控机的Mysql监控
创建专用数据库、专用数据库账户
mysql -uroot -p
create database nagios_monitor;
grant select on nagios_monitor.* to [email protected]‘%‘ identified by ‘nagiosMonitor‘;
flush privileges;
exit;
测试check_mysql脚本运行是否正常
cd /usr/lib64/nagios/plugins
./check_mysql -unagios -pnagiosMonitor
编辑nrpe.cfg文件
vi /usr/local/nagios/etc/nrpe.cfg 添加如下一行
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql -unagios -pnagiosMonitor
回到nagios监控服务器
修改services.cfg文件
vi /etc/nagios/objects/services.cfg
添加如下代码define service{ use generic-service host_name Nagios_Centos_Client1 service_description Mysql Monitoring check_command check_nrpe!check_mysql }
check_mysql Code
nagios -v nagios.cfg 检查nagios配置文件是否正确
重启nagios服务即可
时间: 2024-11-08 18:22:09