温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

nagios通过check_http监控tomcat

发布时间:2020-07-09 23:08:53 来源:网络 阅读:994 作者:YU文武貝 栏目:移动开发

1.[root@bjjk ~]# 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.[root@bjjk ~]# 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.客服端添加监控项

[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.启动nrpe

[root@tomcat-076 tomcat]#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

6.重启nagios服务端

service nagios reload

7.查看是否成功

nagios通过check_http监控tomcat

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI