標籤:監控 nagios
1.[[email protected] ~]# vi /usr/local/nagios/etc/objects/commands.cfg
添加新內容:
define command{ command_name check_tomcat_8080 command_line $USER1$/check_http -I $HOSTADDRESS$ -p $PORT$ -u $URL$ -e $N200$ -w $Warning$ -c $Cri$ }
2.[[email protected] ~]# vi /usr/local/nagios/etc/objects/services.cfg
添加監控服務項:
##############################tomcat-076 check_tomcat_8080#####################################define service{ host_name tomcat-076 service_description check_tomcat_8080 check_command check_nrpe!check_tomcat_8080 max_check_attempts 5 normal_check_interval 5 retry_check_interval 2 check_period 24x7 notification_interval 10 notification_period 24x7 notification_options w,u,c,r contact_groups yunwei}
3.檢查是否正確
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
4.客服端添加監控項
[[email protected] tomcat]#vi /usr/local/nagios/etc/nrpe.cfg log_facility=daemonpid_file=/var/run/nrpe.pidserver_port=5666nrpe_user=nagiosnrpe_group=nagiosallowed_hosts=127.0.0.1,X.X.X.Xdont_blame_nrpe=0debug=0command_timeout=60connection_timeout=300command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20command[check_mem]=/usr/local/nagios/libexec/check_mem 70 80command[check_disks]=/usr/local/nagios/libexec/check_disks 70 80command[check_ipcons]=/usr/local/nagios/libexec/check_ipcons 3000 5000command[check_tomcat_8080]=/usr/local/nagios/libexec/check_http -I 192.168.1.77 -p 80 -u /AdCollectT/ok.html -e 200 -w 5 -c 10
5.啟動nrpe
[[email protected] tomcat]#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
6.重啟nagios服務端
service nagios reload
7.查看是否成功
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M00/89/9E/wKiom1gYR_2xaS0qAABRigv-yRo023.png-wh_500x0-wm_3-wmp_4-s_3269637443.png" title="QQ20161101154408.png" alt="wKiom1gYR_2xaS0qAABRigv-yRo023.png-wh_50" />
本文出自 “echo xiayun” 部落格,請務必保留此出處http://linuxerxy.blog.51cto.com/10707334/1868121
nagios通過check_http監控tomcat