Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_time_ping

Rating
0 votes
Favoured:
1
Current Version
1
Last Release Date
2014-05-28
Compatible With
  • Nagios 3.x
License
GPL
Hits
22231
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This script will check the ping time off what you want.
Hello,

This script will check the ping time off what you want.

check_time_ping

#!/bin/bash

HOST2=$1
TimePingWarning=$2
TimePingCritical=$3

if [ $# -lt 3 ]
then echo "utilisation : ./check_time_ping @IpHost TimePingWarning TimePingCritical"
exit 3
fi

TIME=$(ping -c 1 $HOST2 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
TIME1=${TIME%.*}

if [ $TIME1 -ge $TimePingCritical ]
then echo "TimePing Critical = $TIME1|Time = $TIME1;${TimePingWarning};${TimePingCritical}"
exit 2

elif [ $TIME1 -lt ${TimePingWarning} ]
then echo "TimePing Ok = $TIME1|Time = $TIME1;${TimePingWarning};${TimePingCritical}"
exit 0

else echo "TimePing warning = $TIME1|Time = $TIME1;${TimePingWarning};${TimePingCritical}"
exit 1
fi

---------------------------------------------------------

In service :

define service {
hostname ( what you want )
service_description Current Users
check_command check_time_ping!25!35
use generic-service
notification_interval 0
}

---------------------------------------------------------

In command :

#Check time ping
define command{
command_name check_time_ping
command_line sh /usr/lib/nagios/plugins/check_time_ping $HOSTADDRESS$ $ARG1$ $ARG2$
}