Nagios check_ping Command Examples

Source: Internet
Author: User

check_ping command is a Nagios plugin this is used to check the ping output of a remote server.

Based on the ping output, you can decide to set certain warning and critical threshold level, Based on which Nagios can SE nd notifications to you.

If you've installed Nagios from source, you'll find all the default plugins under/usr/local/nagios/libexec directory.

This tutorial explains how can use check_ping command with some basic examples.

If you don't pass any arguments to the check_ping command, it'll show all available options as shown below.

# cd/usr/local/nagios/libexec#./check_pingcheck_ping:could not parse Argumentsusage:check_ping-h 
1. Basic Usage

USE-H option to specify the hostname, or the ip-address of the server for which, you like to check the ping command output.

You should also pass both warning and critical threshold limit. If not, you'll get an error.

Threshold limit for check_ping should is passed as a Threshold pair, which has both parts:

    1. Round trip average, which is called as RTA. This is specified in MS
    2. Percentage of packet loss, which is called pl. This should is specified as%age.

In the following example, we is checking the ping output for 192.168.1.1 host. The warning limit is 10ms RTA or 2% packet-loss. The critical limit is 20ms or 5% packet loss.

#./check_ping-h 192.168.1.1-w 10,2%-c 20,5%ping ok-packet loss = 0, RTA = 0.11 ms|rta=0.110000ms;1.000000;2.000000; 0.000000 pl=0%;10;20;0

Note:you should specify "%" after the second number in the threshold limit pair.

2. Specify the number of ECHO Packets

By default the check_ping command would send 5 ICMP ECHO packets. Use-p option.

In the following example, it sends ICMP ECHO packets to the remote host before its output is measured.

#./check_ping-h 192.168.1.1-w 10,2%-C 20,5%-P 10PING ok-packet loss = 0, RTA = 0.13 ms|rta=0.129000ms;10.000000;20 .000000;0.000000 pl=0%;2;5;0
3. Specify the Connection Timeout

By default the check_ping command would do the connection time out (if it's unable to reach the destination host) after 10 Seconds. USE-T option.

In the following example, it'll wait for 5 seconds before the connection time-out of the remote host.

#./check_ping-h 192.168.101.49-w 10,2%-C 20,5%-T 5critical-host unreachable (192.168.101.49)
4. Use IPv4 of IPV6

By default, it'll use IPV4. So, you really don ' t need to specify "-4" (which is optional).

#./check_ping-h 192.168.1.1-w 1,10%-C 2,20% -4ping ok-packet loss = 0, RTA = 0.14 ms|rta=0.142000ms;1.000000;2.0000 00;0.000000 pl=0%;10;20;0

But if you use the IPV6 address, you should use-6 as shown below.

#./check_ping-h 2002:4559:1fe2::4559:1fe2-w 1,2%-C 2,5%-6
5. check_ping Error Messages

The following is some possible error messages that's might get when you try to use check_ping command.

Error 1:if you don't specify warning threshold limit, you ll get the following error message:

#./check_ping-h 192.168.1.1<wrta> was wasn't setcheck_ping:could not parse arguments

Error 2:if you don't specify% at the end of the threshold limit pair and you'll get the following error message:

#./check_ping-h 192.168.1.1-w 1,10check_ping:%s:warning threshold must be integer or percentage! -1,10

Error 3:if You don't specify critical threshold limit, you ll get the following error message:

#./check_ping-h 192.168.1.1-w 1,10%<crta> is not set

Error 4:if The warning threshold limit values are greater than the critical limit value, you'll get the following error me Ssage:

#./check_ping-h 192.168.1.1-w 10,10%-C 2,20%<wrta> (10.000000) cannot be larger than <crta> (2.000000)

Error 5:if the specify-6 and give a IPv4 address, you ll get the following error message:

#./check_ping-h 192.168.1.1-w 1,10%-C 2,20% -6check_ping:invalid hostname/address-192.168.1.1

Nagios check_ping Command Examples

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.