2.3.5

Ping test: include ping and traceroute results to make it really useful

Hi all,

I would like for the Ping test to be able to include ping and traceroute results in an email notifier. This would make the ping test way more useful.

I've been corresponding with Simon's author David via email and he said this needs to be done using a custom (Shell) Script-based service. The problem is I'm not a shell script expert and the script would basically require an shell script expert to write (I think).

I'm not a programmer but it would seem to me the script would need to (thanks to David for helping me understand a bit more about the exit values):

1. run a ping command (e.g. ping -c 10 {ServerName})
2. find the average ping time value (from ping results using probably grep) and compare against {TimeThreshold}
3. if average ping time value is greater than {TimeThreshold}, then run traceroute command (traceroute {ServerName}), "mark" test as "failed" (exit result value 1) and end script, otherwise continue script...
4. find packet loss value (from ping results above) and compare against {PacketLossThreshold}
5. if packet loss value is greater than {PacketLossThreshold}, then run traceroute command (traceroute {ServerName}), "mark" test as "failed" (exit result value 1) and end script, otherwise "mark" test as "success" (exit result value 0)

If the test fails, I basically would like to get the following automatically emailed to me by using an email notifier (and to use variables to include the date/time the test was done):

sh:~ admin$ ping sample.server.com
PING sample.server.com (202.64.69.151): 56 data bytes
64 bytes from 202.64.69.151: icmp_seq=0 ttl=111 time=244.432 ms
64 bytes from 202.64.69.151: icmp_seq=1 ttl=111 time=221.971 ms
64 bytes from 202.64.69.151: icmp_seq=2 ttl=111 time=243.018 ms
64 bytes from 202.64.69.151: icmp_seq=3 ttl=111 time=220.99 ms
64 bytes from 202.64.69.151: icmp_seq=4 ttl=111 time=232.624 ms
64 bytes from 202.64.69.151: icmp_seq=5 ttl=111 time=243.936 ms
64 bytes from 202.64.69.151: icmp_seq=6 ttl=111 time=215.623 ms
64 bytes from 202.64.69.151: icmp_seq=7 ttl=111 time=208.475 ms
64 bytes from 202.64.69.151: icmp_seq=8 ttl=111 time=244.549 ms
64 bytes from 202.64.69.151: icmp_seq=9 ttl=111 time=236.922 ms
64 bytes from 202.64.69.151: icmp_seq=10 ttl=111 time=268.634 ms
64 bytes from 202.64.69.151: icmp_seq=11 ttl=111 time=236.311 ms
64 bytes from 202.64.69.151: icmp_seq=12 ttl=111 time=231.318 ms
64 bytes from 202.64.69.151: icmp_seq=13 ttl=111 time=250.657 ms
64 bytes from 202.64.69.151: icmp_seq=14 ttl=111 time=176.762 ms
64 bytes from 202.64.69.151: icmp_seq=15 ttl=111 time=243.854 ms
64 bytes from 202.64.69.151: icmp_seq=17 ttl=111 time=244.334 ms
64 bytes from 202.64.69.151: icmp_seq=18 ttl=111 time=196.518 ms
64 bytes from 202.64.69.151: icmp_seq=19 ttl=111 time=244.092 ms
64 bytes from 202.64.69.151: icmp_seq=20 ttl=111 time=264.856 ms
64 bytes from 202.64.69.151: icmp_seq=21 ttl=111 time=244.243 ms
64 bytes from 202.64.69.151: icmp_seq=22 ttl=111 time=243.095 ms
^C
--- sample.server.com ping statistics ---
23 packets transmitted, 22 packets received, 4% packet loss
round-trip min/avg/max = 176.762/234.418/268.634 ms
sh:~ admin$
sh:~ admin$
sh:~ admin$ traceroute sample.server.com
traceroute to sample.server.com (202.64.69.151), 30 hops max, 40 byte packets
1 172.20.232.1 (172.20.232.1) 1.01 ms 0.342 ms 0.345 ms
2 58.246.73.49 (58.246.73.49) 1.606 ms 1.334 ms 1.372 ms
3 210.22.67.61 (210.22.67.61) 1.304 ms 1.331 ms 1.647 ms
4 8ge0-gsr1-sh2-chj1.sh.cncnet.net (210.22.66.81) 1.927 ms 1.739 ms 2.054 ms
5 4p0-gsr1-sh2-sb1.sh.cncnet.net (210.22.66.37) 1.794 ms 1.745 ms 1.744 ms
6 210.22.66.145 (210.22.66.145) 2.059 ms 1.849 ms 1.914 ms
7 219.158.21.249 (219.158.21.249) 12.038 ms 2.008 ms 2.154 ms
8 219.158.3.249 (219.158.3.249) 39.635 ms 28.577 ms 28.331 ms
9 219.158.3.250 (219.158.3.250) 237.894 ms 226.613 ms 196.421 ms
10 219.158.3.238 (219.158.3.238) 179.074 ms 157.957 ms 151.504 ms
11 219.158.3.98 (219.158.3.98) 145.615 ms 148.245 ms 159.414 ms
12 i-6-4.iadv02.net.reach.com (134.159.100.233) 172.865 ms 188.722 ms 203.844 ms
13 i-4-0.tmh-core04.net.reach.com (202.84.153.225) 199.425 ms 202.71 ms 194.779 ms
14 unknown.net.reach.com (134.159.161.82) 185.01 ms 223.107 ms 190.598 ms
15 v152.tmhc1.pacific.net.hk (202.64.4.1) 180.6 ms 184.963 ms 200.309 ms
16 v203.tmhs3503.pacific.net.hk (202.64.147.234) 207.249 ms 207.062 ms 212.337 ms
17 * 220.232.190.178 (220.232.190.178) 183.834 ms 156.79 ms
18 220.232.190.212 (220.232.190.212) 162.474 ms 166.743 ms 176.873 ms
19 * * *
20 * * *
21 * * *
^C

Would very much appreciate if any shell script gurus could help to create such a script. If the 2 tests (ping time and packet loss) are difficult to do, then if just packet loss could be done, that would great!

Thanks in advance for any feedback.

Have a great weekend y'all!

Cheers,
Derek

Syndicate content