2,在nagios客户端添加脚本监控
先测试下脚本
[root@wgq_idc_dbm_3_61 binlog]# /usr/local/nagios/libexec/check_trx -w 30 -c 60
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
OK- TRANSACTIONS RAN successfully.
[root@wgq_idc_dbm_3_61 binlog]#
在nrpe.cfg里面添加监控命令
[root@wgq_idc_dbm_3_61 binlog]# vim /usr/local/nagios/etc/nrpe.cfg
command[check_mysql_trx]=/usr/local/nagios/libexec/check_trx -w 30 -c 60
之后重启nagios客户端监控, service nrpe restart
4,在nagios主监控服务器上面添加配置选项
先去nagios服务器上面check一下
[root@localhost etc]# /usr/local/nagios/libexec/check_nrpe -H10.254.3.61 -c check_mysql_trx
OK- TRANSACTIONS RAN successfully.
[root@localhost etc]#
在services.cfg里面添加事务监控选项:
define service{
host_name mysqlserver
service_description Check mysql transctions
check_command check_nrpe!check_mysql_trx
max_check_attempts 5
check_command check_nrpe!check_mysql_trx
max_check_attempts 5
normal_check_interval 3
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups opsweb
}
在commands.cnf里面添加事务监控命令:
# add by tim.man on 20141201
define command{
command_name check_mysql_trx
command_line $USER1$/check_mysql_trx -w $ARG1$ -c $ARG2$
}
邮件短信报警电话报警已经添加,所以无需重新配置。
然后重新加载nagios
[root@localhost objects]# service nagios reload
Running configuration check...
Reloading nagios configuration...
done
[root@localhost objects]#
5,去nagios主监控界面查看监控效果
正常监控效果:
严重监控效果:
在Ubuntu下配置Mrtg监控Nginx和服务器系统资源
在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2)
CentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南