资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

nagios的check_ping插件学习-创新互联

(nagios插件:nagios-plugins-1.4.12/plugins/check_ping.c)

创新互联公司是一家以重庆网站建设公司、网页设计、品牌设计、软件运维、成都网站营销、小程序App开发等移动开发为一体互联网公司。已累计为卫生间隔断等众行业中小客户提供优质的互联网建站和软件开发服务。

[root@datacenter libexec]# ./check_ping --help

check_ping v1.4.15 (nagios-plugins 1.4.15)

Copyright (c) 1999 Ethan Galstad <>

Copyright (c) 2000-2007 Nagios Plugin Development Team

<>

Use ping to check connection statistics for a remote host.

Usage:

check_ping -H -w ,% -c ,%

[-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)

THRESHOLD is ,% where is the round trip average travel

time (ms) which triggers a WARNING or CRITICAL state, and is the

percentage of packet loss to trigger an alarm state.

This plugin uses the ping command to probe the specified host for packet loss

(percentage) and round trip average (milliseconds). It can produce HTML output

linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in

the contrib area of the downloads section at

Send email to if you have questions

regarding use of this software. To submit patches or suggest improvements,

send email to

[root@datacenter libexec]#

用法:

Usage: check_ping -H -w ,% -c ,%

[-p packets] [-t timeout] [-L] [-4|-6]

具体如下:

-H   主机地址

-w   WARNING 警告状态:  响应时间(毫秒),丢包率 (%)  阀值

-c   CRITICAL 危险状态:  响应时间(毫秒),丢包率 (%)  阀值

-p   发送的包数    默认5个包

-t   超时时间     默认10秒

-4|-6          使用ipv4|ipv6 地址   默认ipv4

示例:

复制代码 代码如下:

./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

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享标题:nagios的check_ping插件学习-创新互联
本文来源:http://cdkjz.cn/article/egcdp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220