How ping works in nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ceh
Posts: 12
Joined: Thu Jul 04, 2013 2:53 am

How ping works in nagios

Post by ceh »

Hello,

Here I am confused with how nagios pings the devices.

1)Check host alive:
# 'check-host-alive' command definition
define command{
command_name check-host-alive
command_line $USER1$/check_ping -4 -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}

what is -w 3000.0,80% -c 5000.0,100% -p 5 in the above command

2)# 'check_ping' command definition
define command{
command_name check_ping
command_line $USER1$/check_ping -4 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}

What is -w $ARG1$ -c $ARG2$ -p 5 in the above command.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How ping works in nagios

Post by jdalrymple »

This isn't "How ping works in nagios" - this is "How monitoring works in nagios"
ceh wrote:check_ping -4 -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
This is the literal check run by the Nagios monitoring box.

In the following usage, note the bottom where it describes how the thresholds work:

Code: Select all

[root@localhost libexec]# ./check_ping --help
check_ping v2.0.3 (nagios-plugins 2.0.3)
Copyright (c) 1999 Ethan Galstad <[email protected]>
Copyright (c) 2000-2014 Nagios Plugin Development Team
        <[email protected]>

Use ping to check connection statistics for a remote host.

Usage:
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
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
 -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 <rta>,<pl>% where <rta> is the round trip average travel
time (ms) which triggers a WARNING or CRITICAL state, and <pl> 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 http://www.nagios.org/

Send email to [email protected] if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
[email protected]
In your second example you're demonstrating a command that allows you to specify arguments in the service. In this case you would define your check_command in your service as follows to mimic the check-host-alive command:

Code: Select all

     check_command     check_ping!3000.0,80%!5000.0,100%
Make sense? I suggest going over the quick start material:

https://assets.nagios.com/downloads/nag ... start.html
ceh
Posts: 12
Joined: Thu Jul 04, 2013 2:53 am

Re: How ping works in nagios

Post by ceh »

Hello,

Here I am putting check command as "check_ping -4 -H $HOSTADDRESS$ -w 300.0,80% -c 500.0,100% -p 5" so does the nagios pings only 5 times per minute. The check interval I defined is for 1 minute.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How ping works in nagios

Post by Box293 »

-5 means send 5 packets (it all happens in a matter of microseconds). In relation to the 80% and 100% warning and critical thresholds this is how they are determined. Losing 4 packets equals 80%.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ceh
Posts: 12
Joined: Thu Jul 04, 2013 2:53 am

Re: How ping works in nagios

Post by ceh »

Hello,

Its very clear now thank you all.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How ping works in nagios

Post by tmcdonald »

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked