View previous topic :: View next topic |
Author |
Message |
CHRISman
Joined: 17 Aug 2004 Posts: 2 Location: Bulgaria
|
Posted: Sat Aug 21, 2004 5:15 am Post subject: RMA and PING ? |
|
|
Hello , I've installed RMA for linux and one for Windows...
Why windows RMA have much more test to perform than Linux...
And the most important is why PING test does not work in Linux ?
I've enabled it , and tryed to reconfigure the RMA form remote manager, but there is no PING option to switch on/off... why ???
Thank you in advance |
|
Back to top |
|
 |
KS-Soft
Joined: 03 Apr 2002 Posts: 12649 Location: USA
|
Posted: Sat Aug 21, 2004 2:41 pm Post subject: |
|
|
Quote: | Why windows RMA have much more test to perform than Linux...
And the most important is why PING test does not work in Linux ?
|
Because its very easy to implement custom checks on UNIX using scripts. RMA for UNIX supports Shell Script test method, HostMonitor has about 15 preconfigured scripts for this method.
For example simple ping script may look like
Code: | #!/bin/sh
ping -c $2 -w $3 $1 1> /dev/null 2> /dev/null
if [ $? -eq 0 ]
then
echo "ScriptRes:Host is alive:"
else
echo "ScriptRes:No answer:"
fi |
It has 3 parameters: <host> <retries> <timeout>
Regards
Alex |
|
Back to top |
|
 |
oakyuz
Joined: 08 Feb 2007 Posts: 74
|
Posted: Wed Jun 22, 2011 12:37 am Post subject: |
|
|
Hi Alex
I used this script and worked. However, it does not return any reply, i.e., the time for ping operation in ms, for example. It just says "Host is alive" or "No answer". This would be useful for us when analyzing the network by looking at ping time. How can I modify this script to return ping time?
Thanks,
Oguzhan |
|
Back to top |
|
 |
KS-Soft
Joined: 03 Apr 2002 Posts: 12649 Location: USA
|
Posted: Wed Jun 22, 2011 2:28 pm Post subject: |
|
|
Scripts can be different depending on version of your ping utility...
You may try this one
Code: |
#!/bin/sh
png=$(ping -c $2 -w $3 $1 | grep 'min/avg/max' | awk -F'/' '{ print $5}'|awk '{print int($1+0.5)}')
if [ "$png" = "" ]
then
echo "ScriptRes:No answer:"
else
echo "ScriptRes:Host is alive:"$png" ms"
fi |
Regards
Alex |
|
Back to top |
|
 |
oakyuz
Joined: 08 Feb 2007 Posts: 74
|
Posted: Thu Jun 23, 2011 12:14 am Post subject: |
|
|
Alex
Thanks for quick and useful response, as always. The code you sent meets my need.
Regards
Oguzhan |
|
Back to top |
|
 |
|