Nagios插件check_ping用法

Nagios的check_ping是Nagios用来ping远程主机的一个插件,用法如下:

check_ping -H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%
 [-p packets] [-t timeout] [-4|-6]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 -4, --use-ipv4
    Use IPv4 connection
 -6, --use-ipv6
    Use IPv6 connection
 -H, --hostname=HOST
    host to ping
 -w, --warning=THRESHOLD
    warning threshold pair
 -c, --critical=THRESHOLD
    critical threshold pair
 -p, --packets=INTEGER
    number of ICMP ECHO packets to send (Default: 5)
 -L, --link
    show HTML in the plugin output (obsoleted by urlize)
 -t, --timeout=INTEGER
    Seconds before connection times out (default: 10)

例子
 ./check_ping -H 8.8.8.8 -w 200,20% -c 300,50% -p 3 -t 2

-H 目标主机
-w 延时200丢包20%
-c 延时300丢包50%

延时有3个范围
1. 延时 小于 200
2. 延时 在 200 - 300 范围内
3. 延时 大于 300

小于则输出 OK 正常
范围内则输出 WARNING 警告
大于则输出 CRITICAL 宕机


1、OK 正常:
[root@204 plugins]# ./check_ping -H 8.8.8.8 -w 200,20% -c 300,50% -p 3 -t 2
PING OK - Packet loss = 0%, RTA = 96.45 ms|rta=96.449997ms;200.000000;300.000000;0.000000 pl=0%;20;50;0

2、WARNING 警告 :
[root@204 plugins]# ./check_ping -H 8.8.8.8 -w 100,20% -c 200,50% -p 3 -t 2
PING WARNING - Packet loss = 0%, RTA = 106.00 ms|rta=106.003998ms;100.000000;200.000000;0.000000 pl=0%;20;50;0

3、CRITICAL 宕机 :
[root@204 plugins]# ./check_ping -H 8.8.8.8 -w 50,20% -c 100,50% -p 3 -t 2
PING CRITICAL - Packet loss = 0%, RTA = 128.41 ms|rta=128.410995ms;50.000000;100.000000;0.000000 pl=0%;20;50;0

你可能感兴趣的:(职场,nagios,休闲,nagios插件,check_ping)