Creating a Ping Script

When troubleshooting network problems one of the first tools that I typically use is PING. On MPE/iX, PING is buried several levels deep in NETTOOL.NET.SYS, making it cumbersome to use compared to HP-UX. Linux, or a Windows based workstation.

Try the following command file to give you a command line PING that behaves similarly to other operating systems. More importantly, its easy to use.

 
parm IPAddress='help'
if '!IPAddress' = 'help'
echo Usage :ping [IP ADDRESS]
echo [Node Name]
echo
echo Example :ping 192.168.44.12
echo :ping www.beechglen.com
echo
else
purge pingwrk >$null
build pingwrk;rec=-80,,f,ascii
file pingwrk,old;dev=disc
nettool.net.sys "ping;ping !ipaddress;quit" >*pingwrk
reset pingwrk
setvar filelen,finfo("pingwrk","EOF")
print pingwrk;start=17;end=![!filelen - 2]
deletevar filelen
purge pingwrk >$null
endif

Example 1:



:ping 192.168.44.12
Sending -----------------------------------------
5 packets of 64 bytes to 192.168.44.12
------------------------------------------

------------- FINAL STATISTICS -------------
5 packets transmitted, 0 packets received,100 % packet loss

Example 2:


:ping 192.168.1.254
Sending -----------------------------------------
5 packets of 64 bytes to 192.168.1.254
------------------------------------------

64 bytes from 192.168.1.254 : icmp_seq= 1 time= 5 ms
64 bytes from 192.168.1.254 : icmp_seq= 2 time= 3 ms
64 bytes from 192.168.1.254 : icmp_seq= 3 time= 3 ms
64 bytes from 192.168.1.254 : icmp_seq= 4 time= 4 ms
64 bytes from 192.168.1.254 : icmp_seq= 5 time= 6 ms

------------- FINAL STATISTICS -------------
5 packets transmitted, 5 packets received,0 % packet loss
 round-trip (ms) min/avg/max = 3/4/6