'''What is "Pinger"?''' Pinger is a smallish Tcl/Tk script for doing ping testing of an IP computer network. ---- '''What is it for?''' Both UNIX and Windoze have a built-in command called "ping" which sends an ICMP ECHO message to a specified host and listens for a reply. This makes it simple to check basic IP connectivity between two hosts. I created Pinger to solve a different problem: Troubleshooting ''intermittent'' connectivity problems. The specific problem I am having involves a particular server periodically not talking to me. My first response was to run an endless ping loop to try to detect when it goes off. But if you walk away from your desk, the text scrolls off the screen. So I redirected output to a file. But now * There is no visible output on the screen. * Several KB of log is generated every minute - must of it containing utterly identical text. So I wrote a tool (imaginitively named "Pinger") which calls the OS ping program and then only logs the information I'm actually interested in. ---- '''What exactly does it do?''' It started from humble beginnings, but Pinger has now become moderately complicated. It's designed to solve my particular problem, but somebody suggested to me that others may find a use for it. Anyway, you give Pinger a target to ping, and it pings it forever. While it's doing this, it gives both real-time graphical feedback using Tk, and also logs everything to a log file. (The name is automatically generated and includes the target name and today's date.) I'd post a screenshot if I knew how... how here's a sample of the log output, which hopefully makes it clear what the program is all about: 09:59:00 AM on Tue 29-Aug-2006 Pinger 1.21: Now pinging 'www.google.co.uk' (72.14.203.99) 0 packet(s) failed. 09:59:00 AM on Tue 29-Aug-2006 Successful ping! 200 packets successful and counting... 100 ms round trip (minimum). 111.02 ms round trip (arithmatic mean). 160 ms round trip (maximum). 7.59799973677 ms standard deviation. 10:06:09 AM on Tue 29-Aug-2006 387 packet(s) successful. 100 ms round trip (minimum). 110.988326848 ms round trip (arithmatic mean). 160 ms round trip (maximum). 7.93283208454 ms standard deviation. 10:12:54 AM on Tue 29-Aug-2006 Failed ping! 1 packet(s) failed. 10:12:56 AM on Tue 29-Aug-2006 Successful ping! 200 packets successful and counting... 100 ms round trip (minimum). 111.135 ms round trip (arithmatic mean). 160 ms round trip (maximum). 8.45557656225 ms standard deviation. ...snipped a bit... 04:59:04 PM on Tue 29-Aug-2006 Failed ping! 1 packet(s) failed. 04:59:07 PM on Tue 29-Aug-2006 Successful ping! 32 packet(s) successful. 100 ms round trip (minimum). 109.21875 ms round trip (arithmatic mean). 111 ms round trip (maximum). 2.88026013365 ms standard deviation. 05:00:15 PM on Tue 29-Aug-2006 User abort. 4819 ping packet(s) sent. 4810 reply packet(s) received. 9 reply packet(s) lost. Pinger attempts to do a ping every 2 seconds (roughly). Instead of recording the exact details of every individual ping attempt, it aggregates the information into a (hopefully) more useful form. It splits the ping results into ''runs'' of successful or failed pings, and shows how many packets are in each run. It also shows some statistics for round trip times on successful pings. (Note also that it ''flushes'' the log when it has logged something interesting, so that under Windoze at least, you can see what's in the log file without stopping the program.) The GUI has a big "stop" button on it - which also cunningly functions as a status light. (It turns red when a ping is sent, and turns green when a reply arrives.) When you stop the program, it dumps the last stats and quits. ---- '''Known Problems''' * '''Not very portable!''' This script calls the OS "ping" command, and does some crude parsing of the output to determin what the result was. ''It works on my Windoze NT 4.0 workstation'', but probably won't work on anything else. (I know for a fact Windoze XP has a different output format.) The part that does the parsing is neatly seperated out from the rest of the code, so should be easy to alter... * The source code is very messy and is 0% commented. (I wasn't expecting anybody else to ever see it.) * Very little error checking is done. (It works on my PC, but...) * The time statistics are only calculated against the last 256 packets, not all packets. (The stats reset at the start of each run - by design. But the stats still don't include all the packets in the current run. I couldn't think of a better way to get a moving average.) I am also not 100% convinced the standard deviation is calculated correctly, but it seems to give plausible numbers... * Minor: The problem uses the default TTL, Timeout, etc. It wouldn't be hard to change that if you cared about such things. * Minor: I said "it pings every 2 seconds". What I ''really'' ment is "it waits 2 seconds between each call to PING". That means that if pings are failing, there is rather more than a 2 second delay between packets being sent. (2 seconds of wait + whatever the default timeout period is.) ('''I am still editing this page...''')