nagios 命令解释

 

 

check_ssh

                 界面拼装参数格式如下共3个元素:

                         命令!端口!连接超时时间

                         check_ssh!22!10

                       

check_http

                 界面拼装参数格式如下共4个元素:

                 命令!告警时延!严重告警时延!连接超时时间

                 check_http!0.0020!0.0050!10

               

check_imap

check_ftp

check_nntp

check_pop

check_udp

check_tcp

                 界面拼装参数格式如下共4个元素:

                         命令!端口!告警时延!严重告警时延!连接超时时间

                         check_tcp!23!0.0020!0.0050!10

 

                         备注:

                         check_imap=check_tcp!143

                         check_ftp=check_tcp!21

                         check_nntp=check_tcp!119

                         check_pop=check_udp!110

                         check_udp=check_tcp

                         check_telnet=check_tcp!23

check_smtp

 

                 界面拼装参数格式如下共4个元素:

                         命令!告警时延!严重告警时延!连接超时时间

                         check_smtp!0.0020!0.0050!10

check_ping

                 界面拼装参数格式如下共5个元素:

                         命令!告警时延,丢包率!严重告警时延,丢包率!检测数据包个数!连接超时时间

                         check_ping!3000.0,80%!5000.0,100%!5!10

二、命令检测详细描述

check_ssh

         Usage:check_ssh [-46] [-t   <timeout>] [-r   <remote version>] [-p   <port>]   <host>

                 参数:

                 -h, --help

                         帮助

                 -V, --version

                         列出版本信息

                 -H, --hostname=ADDRESS

                         主机名称,IP地址,或者UNIX套接字(必须有绝对路径)

                 -p, --port=INTEGER

                         端口号(默认:22)

                 -4, --use-ipv4

                         使用IPV4协议连接

                 -6, --use-ipv6

                         使用IPV6协议连接

                 -t, --timeout=INTEGER

                         连接超时秒数(默认:10)

                 -r, --remote-version=STRING

                         不匹配服务器版时警告字符串,如对方的版本为OpenSSH_3.9p1

                 -V, --verbose

                         列出详细的命令调试行

                 举例

                 ./check_ssh -H 192.168.2.220 -p 22 -t 10 -r OpenSSH_3.0pl

                 SSH WARNING - OpenSSH_3.8.1p1 Debian-8.sarge.6 (protocol 2.0) version mismatch, expected 'OpenSSH_3.0pl'

                 ./check_ssh -H 192.168.2.220 -p 22 -t 10   

                 SSH OK - OpenSSH_3.8.1p1 Debian-8.sarge.6 (protocol 2.0)

                 check_ssh -H $HOSTADDRESS$ -p 22 -t 10

       

                 界面拼装参数格式如下共3个元素命令!端口!连接超时时间

                 check_ssh!22!10

 

               

                       

check_http

                 Usage: check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]

                             [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]

                                 [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]

                                 [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]

                                 [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string] [-k string]

 

                 -h, --help

                         帮助

                 -V, --version

                         列出版本信息

                 -H, --hostname=ADDRESS

                         虚拟主机名加端口(:excamle.com:5000)

                 -I, --IP-address=ADDRESS

                         IP地址或名称(如果无需DNS的查找,使用十进制的地址)

                 -p, --port=INTEGER

                         端口数(默认: 80)

                 -4, --use-ipv4

                         使用IPV4连接

                 -6, --use-ipv6

                         使用IPV6连接

                 -e, --expect=STRING

                         把服务器反馈的第一行(状态)转换成指定的字符串(默认是:HTTP/1.   如果指定跳跃了所有其它逻辑状态行)

                 -s, --expect=STRING

                         指定内容

                 -u, --url=PATH

                         获取或发送的URL(默认:/)

                 -P, --post= STRING

                         URL进行POSTHTTP数据

                 -N, --no-body

                         不等待文档正文:获取报头后停止读取。

                         (注意,这是一个HTTP的获取和发送,而不是报头)

                 -M, --max-age=SECONDS

                         如果文档超过生存期则警告。数据是如下形式的:分数是"10m",小时数是"10h",天数是 "10d"

                 -T, --content-type=STRING

                         在传输的时候指定容器类型媒体类型

                 -l, --linespan

                         允许正则表达式跨越新行(必须在前面使用 R -r)

                 -r, --regex,   ,--ereg=STRING

                         用正则表达式字符串搜索页

                 -R, --eregi=STRING

                         用正则表达式字符串搜索页,允许模糊查找

                 --invert-regex

                         如果找到返回CRITICAL,找不到返回OK

                 -a, --authorization=AUTH_PAIR

                         用户名:在站点最基本的密码认证

                 -A, --useragent=STRING

                         转换成字符串放在HTTP报头里发送,"用户代理"

                 -k, --header=STRING

                         任何其它的标签被放在HTTP报头里发送。可以被附加的报头使用多次。

                 -L, --link=URL

                         HTML 链接里隐藏发送包 

                 -f, --onredirect

                         怎样解决重定向页

                 -m, --pagesize=INTEGER<:INTERGER>

                         最小最大页大小要求(BYTES)

                 -w, ----warning=DOUBLE

                         告警状态的返回时间()

                 -c,--critical=DOUBLE

                         严重状态的返回时间()

                 -t, --timeout=INTEGER

                         指定超时前的时间(默认10)

                 -v , --verbose

                         列出详细的命令调试行

 

                 举例

                 ./check_http   -H 192.168.2.220 -p 80

                 HTTP OK HTTP/1.1 200 OK - 5553 bytes in 0.057 seconds |time=0.057428s;;;0.000000 size=5553B;;;0

                 ./check_http   -H 192.168.2.220 -p 80 -w 0.0020 -c 0.0060

                 HTTP WARNING: HTTP/1.1 200 OK - 0.003 second response time |time=0.003068s;0.002000;0.006000;0.000000 size=5553B;;;0

                 ./check_http   -H 192.168.2.220 -p 80 -w 0.0030 -c 0.0040

                 HTTP OK HTTP/1.1 200 OK - 5553 bytes in 0.003 seconds |time=0.002673s;0.003000;0.004000;0.000000 size=5553B;;;0

                 ./check_http   -H 192.168.2.220 -p 80 -w 0.0009 -c 0.0040 -t 10

                 HTTP WARNING: HTTP/1.1 200 OK - 0.002 second response time |time=0.002102s;0.000900;0.004000;0.000000 size=5553B;;;0

       

                 界面拼装参数格式如下共4个元素命令!告警时延!严重告警时延!连接超时时间

                 check_http!0.0020!0.0050!10

check_clamd

check_imap

check_ftp

check_nntp

check_pop

check_udp

check_tcp

 

                 Usage:check_tcp -H host -p port [-w <warning time>] [-c <critical time>] [-s <send string>]

                                 [-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]

                                 [-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]

                                 [-D <days to cert expiry>] [-S <use SSL>] [-E]

 

                 -h, --help

                         帮助

                 -V, --version

                         列出版本信息

                 -H, --hostname=ADDRESS

                         主机名,IP地址,或则UNIX套接字 (必须是绝对路径)

                 -p, --port=INTEGER

                         端口数 (默认: )

                 -4, --use-ipv4

                         使用IPV4连接

                 -6, --use-ipv6

                         使用IPV6连接

                 -E, --escape

                         可以用\n,\r,\t or \发送或跳出字符串

                         默认情况下不加东西,\r\n加在退出的时候

                 -s, --send=STRING

                         发送服务器的字符串

                 -e, --expect = STRING

                         转换为服务器返回的字符串

                 -q, --quit= STRING

                         关闭的连接时发送给服务器的字符串

                 -r, --refuse=OK|warn|crit

                         允许 TCP 拒绝的状态 k,warn,crit (默认:warn)

                 -M, --mismatch= OK|warn|crit

                         允许预期的字符串,当发现不匹配状态 k,warn,crit (默认:warn)

                 -j, --jail

                         隐藏TCP套接字的输出 

                 -m, --maxbytes=INTEGER

                         当接收数据包大于指定的大小时,关闭连接。

                 -d, --delay

                         支持在发送数据流和轮询反馈间等待的延迟

                 -w, ----warning=DOUBLE

                         告警状态的返回时间()

                 -c,--critical=DOUBLE

                         严重状态的返回时间()

                 -t, --timeout=INTEGER

                         指定超时前的时间(默认10)

                 -v , --verbose

                         列出详细的命令调试行

                 举例

                 ./check_tcp -H 192.168.2.220 -p 22 -w 0.0023 -c 0.0067 -t 10

                 TCP OK - 0.002 second response time on port 22|time=0.002289s;0.002300;0.006700;0.000000;10.000000

                 ./check_tcp -H 192.168.2.220 -p 22 -w 0.0003 -c 0.0006 -t 10

                 TCP WARNING - 0.000 second response time on port 22|time=0.000318s;0.000300;0.000600;0.000000;10.000000

                 界面拼装参数格式如下共4个元素:

                         命令!端口!告警时延!严重告警时延!连接超时时间

                         check_tcp!23!0.0020!0.0050!10

 

                         备注:

                         check_imap=check_tcp!143

                         check_ftp=check_tcp!21

                         check_nntp=check_tcp!119

                         check_pop=check_udp!110

                         check_udp=check_tcp

                         check_telnet=check_tcp!23