zoukankan      html  css  js  c++  java
  • 【转】nagios使用带url的check_http检测主机

      前一段时间在Cu论坛发现一个提问,问题是nagios关于检测主机http服务的.原帖地址http://bbs.chinaunix.net /forum.php?mod=viewthread&tid=4079340&page=1#pid23860101.楼主刚开始想实 现的是检测主机的url是否正常,后来有回复用自定义脚本的.经过搜索,发现nagios自带的check_http命令可以使用-u url的方式来检测url的.经过试验,确实是可行的,发帖纪录下.
       1.先运行check_http命令看下是否支持-u参数,注意返回的显示里面有没有
        点击(此处)折叠或打开

    1. /usr/local/nagios/libexec/check_http
    2. check_http: Could not parse arguments
    3. Usage:
    4. check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]
    5. [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L] [-a auth]
    6. [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]
    7. [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]
    8. [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]
    9. [-A string] [-k string] [-S <version>] [--sni] [-C <warn_age>[,<crit_age>]]
    10. [-T <content-type>] [-j method]

    2.自定义一个command,名字随便起,我这里是check_http_u,当然了,我写的简单,你也可以加-w和-c等参数

    点击(此处)折叠或打开

    1. define command{
    2.         command_name check_http_u
    3.         command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
    4.         }

    3.给已经定义过的主机添加一个自定义服务,我这里写成URL1,你可以根据需要修改成其他的.

    点击(此处)折叠或打开

    1. define service{
    2.         use local-service ; Name of service template to use
    3.         host_name xxx ;前面定义好的主机名
    4.         service_description URL1 ;
    5.             check_command check_http_u!'/path/index.html' ;
    6.             notifications_enabled 1;
    7. }

    4. 重启nagios服务,重启没有错误的话,浏览器访问你的nagios服务,过一段时间,就可以看到检测的结果了.

    转自:blog.chinaunix.net/uid-1730385-id-3683735.html

  • 相关阅读:
    安全
    请求
    使用 Fetch
    安全
    script
    PWA
    link(外部资源关系)
    base(根URL)
    缓存
    IndexedDB基本概念
  • 原文地址:https://www.cnblogs.com/nhlinkin/p/3629774.html
Copyright © 2011-2022 走看看