how to ping instead of check_ping.

prabhu.anandh at wipro.com prabhu.anandh at wipro.com
Tue Mar 2 13:58:34 CET 2004


Hi fredrik,
The option -w 2 I gave has got a reason.if I give a wrong address or if the host is down,it wont exit the shell script.and that must not be the case.so I gave that option to exit from the ping mode .i think you understand my answer.you try pinging some invalid address with and without -w option.it will give you the reason ,why I am giving -w option.
And moreover,I am not doing this for learning.I have some ipv6 only machines and I am not able to ping using the ping command,so I have to use ping6 for that.i am testing whether it works for ping or not and I need your help in solving this problem.
I am putting this problem in mailing list ,since I feel this will be a important subject.
Thanks in advance.
 
Thanks for Mailing Me.....Keep Mailing.
regards,
Prabhu Anandh S.


-----Original Message-----
From: Fredrik Wänglund [mailto:fredrik.wanglund at mobeon.com] 
Sent: Tuesday, March 02, 2004 5:52 PM
To: Prabhu Anandh (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS)
Subject: Re: [Nagios-users] how to ping instead of check_ping.


The -w flag to ping should make it exit after the specified time.. Why not use the check_ping plugin? If you are doing this just to learn, 
then ping is probably the worst start because it's quite 'noicy' and the 
output is not so easy to parse in a script...


prabhu.anandh at wipro.com wrote:

> Hi fredrik,
> Thanks a lot.what you have sent to me is working and I need one more 
> favour.if one of the host is down,it keeps on pinging till 2 packets 
> and still it doesn't exit.i want to come out of the shell script if it 
> is unable to ping to that machine. I tried various possibilities and 
> none of them seem to work.i have even tried to write a perl script.but 
> it is of no use. Can you give me  a suggestion. Thanks in advance.
> 
> 
> regards,
> Prabhu Anandh S.
> 
> 
> -----Original Message-----
> From: Fredrik Wänglund [mailto:fredrik.wanglund at mobeon.com]
> 
> Sent: Tuesday, March 02, 2004 2:04 PM
> To: Prabhu Anandh (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS)
> Subject: Re: [Nagios-users] how to ping instead of check_ping.
> 
> 
> OK, very simple.. An example that Pings a host;
> 
> Create this script in Nagios libexec-directory (Its not necessary to 
> put
> 
> it there, but it keeps things easier) and call i check_test
> 
> #!/bin/sh
> 
> if [ $# -lt 3 ]; then
>      echo "Usage: $0 <IP-address> <count> <interval>"
>      exit 3
> fi
> 
> HOST=$1
> COUNT=$2
> INTERVAL=$3
> 
> RES=`ping -i $INTERVAL -c $COUNT -w 10 -q $HOST`
> RET=$?
> 
> 
> echo $RES
> exit $RET
> 
> Make the script executable by Nagios:
> 
> chmod +x check_test
> 
> 
> Add a check-command to Nagios (in checkcommands.cfg):
> 
> define command {
> command_name                   check_test
> command_line                   /usr/local/nagios/libexec/check_test
> 
> $HOSTADDRESS$ $ARG1$ $ARG2$
> }
> 
> Add a service to a host:
> 
> define service {
> host_name                      server01
> service_description            Test
> check_command                  check_test!5!1
> notifications_enabled          1
> normal_check_interval          3
> use                            generic-service
> }
> 
> 
> Maybe you need more parameters in the service-definition depending on
> 
> your templates.
> 
> The example will ping server01 five times with 1 second interval every 
> 3
> 
> minutes.
> 
> 
> 
> 
> /Fredrik Wänglund.
> Happy hacking :-)
> 
> 
> 
> 
> 
> prabhu.anandh at wipro.com wrote:
> 
> 
>>Hi Fredrik,
>>Can you give me a small example of how to do it...........thanks in
> 
> 
>>advance.
>>
> 
> 
> 
>>regards,
>>Prabhu Anandh S.
>>
> 
> 
> 
>>-----Original Message-----
>>From: Fredrik Wänglund [mailto:fredrik.wanglund at mobeon.com]
>>
> 
> 
>>Sent: Monday, March 01, 2004 5:40 PM
>>To: Prabhu Anandh (WT01 - TELECOM & INTER-NETWORKING SOLUTIONS)
>>Cc: nagios-users at lists.sourceforge.net
>>Subject: Re: [Nagios-users] how to ping instead of check_ping.
>>
> 
> 
> 
>>Create a script, make it executable for the Nagios-user and add a
>>
> 
> 
>>command-definition (usually to checkcommands.cfg). Done.
>>
> 
> 
>>/FredrikW
>>
> 
> 
> 
>>prabhu.anandh at wipro.com wrote:
>>
> 
> 
> 
>>>Hi folks,
>>>Can anyone help me how to run a shell script for ping instead of 
>>>using
>>
> 
> 
>>>the check_ping command. Just give me the idea whether it can be done
>>
> 
> 
>>>or not.I just wanted to execute some of the unix commands along with
>>
> 
> 
>>>nagios. If anyone experimented this ,share your experience.I am new 
>>>to
>>
> 
> 
>>>shell programming.I wanted to learn and any help will be greatly
>>
> 
> 
>>>appreciated. Thanks in advance.
>>>Regards,
>>>Prabhu Anandh
>>>
>>
> 
> 
>>>    
> 
> 
> 
> 
> 
> 
>>>-------------------------------------------------------
>>>SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and
>>
> 
> 
>>>deploy apps & Web services for Linux with a free DVD software kit 
>>>from
>>
> 
> 
>>>IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click
>>>_______________________________________________
>>>Nagios-users mailing list
>>>Nagios-users at lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/nagios-users
>>>::: Please include Nagios version, plugin version (-v) and OS when
> 
> 
>>>reporting any issue.
>>
> 
> 
>>>::: Messages without supporting info will risk being sent to 
>>>/dev/null
>>
> 
> 
> 
>>Confidentiality Notice
>>
> 
> 
> 
>>The information contained in this electronic message and any
> 
> 
>>attachments to this message are intended for the exclusive use of the
> 
> 
>>addressee(s) and may contain confidential or privileged information.
> 
> 
>>If you are not the intended recipient, please notify the sender at
> 
> 
>>Wipro or Mailadmin at wipro.com immediately and destroy all copies of
> 
> 
>>this message and any attachments.
> 
> 
> 
> Confidentiality Notice
> 
> 
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of the 
> addressee(s) and may contain confidential or privileged information. 
> If you are not the intended recipient, please notify the sender at 
> Wipro or Mailadmin at wipro.com immediately and destroy all copies of 
> this message and any attachments.



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list