1.[root@bjjk ~]# vi /usr/local/nagios/etc/objects/commands.cfg
成都創(chuàng)新互聯(lián)公司主要從事網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)嘉善,十載網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):13518219792添加新內(nèi)容:
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.[root@bjjk ~]# vi /usr/local/nagios/etc/objects/services.cfg
添加監(jiān)控服務(wù)項(xiàng):
##############################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.客服端添加監(jiān)控項(xiàng)
[root@tomcat-076 tomcat]#vi /usr/local/nagios/etc/nrpe.cfg log_facility=daemon pid_file=/var/run/nrpe.pid server_port=5666 nrpe_user=nagios nrpe_group=nagios allowed_hosts=127.0.0.1,X.X.X.X dont_blame_nrpe=0 debug=0 command_timeout=60 connection_timeout=300 command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_mem]=/usr/local/nagios/libexec/check_mem 70 80 command[check_disks]=/usr/local/nagios/libexec/check_disks 70 80 command[check_ipcons]=/usr/local/nagios/libexec/check_ipcons 3000 5000 command[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.啟動(dòng)nrpe
[root@tomcat-076 tomcat]#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
6.重啟nagios服務(wù)端
service nagios reload
7.查看是否成功
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。