Hacking PingPlotter, Part 1

071414 gibbs primary
Credit: Mark Gibbs

While PingPlotter can be scripted, it’s easier to drive it via its Web interface.

Last week I wrote about PingPlotter and my quest to diagnose AT&T U-verse’s flaky service. As I explained, it looks like AT&T default DNS servers are behaving badly and I’m waiting to hear back from the “powers that be” at AT&T.

PingPlotter is, as I discussed, extremely useful for this kind of problem or, indeed, as just a general host availability monitor, and in its bag of tricks is the ability to be scripted. This latter facility would be great except for the fact that it uses the Windows Scripting host, which is not a platform I particularly care for, and the API isn't documented except by a number of scripts (decoding them seemed like a lot of work).

But wait! The Pro version of PingPlotter (cheap at $199.95) has a built-in Web server. This nifty addition lets you expose the PingPlotter display, albeit in a slightly condensed form, to a Web browser or to be used with simple command line tools to get data and configure the application. Here’s what the default Web output looks like:

071414 gibbs1

Ah! If you can set a new host to trace through the UI then you can add that and anything else the UI permits from a command line with curl, an incredibly rich tool that lets you make protocol-based requests including HTTP and is available for just about every platform other than vacuum cleaners and toasters.

Nessoft, bless their hearts, haven’t documented the RESTful calls that can be made to PingPlotter’s Web server, so we’re just going to have to poke around a bit. Let’s use Chrome’s DevTools: Go to the top right and click on the “hamburger” (that’s the icon of three horizontal bars) to open the Chrome menu and select Tools | Developer Tools.

Next, in Chrome go to the PingPlotter page, right click, and bring up the context menu and select Inspect Element and you’ll get something a lot like this:

071414 gibbs2 Mark Gibbs

Chrome’s DevTools in Elements mode.

Now enter a target site in PingPlotter’s New Target to Trace field (say, nessoft.com), then in the DevTools window click on the Network tab and then click on the Stop icon at the top left; that will clear the display because the PingPlotter UI keeps reloading that data to update the display and we don’t need to wade through so much cruft. Now, click on the New Target button in the PingPlotter display and voila! Your DevTools Network display should look like this:

071414 gibbs3 Mark Gibbs

Chrome’s DevTools in Network mode.

The second entry from the top is what you’re looking for.  Click on that entry and you can see the detail of the request:

071414 gibbs4 Mark Gibbs

Chrome’s DevTools in Network mode examining a single entry.

Here’s the data at the start of the headers section more clearly:

Remote Address:192.168.1.127:81

Request URL:http://192.168.1.127:81/cmd.asp?ID=NEWTARGET&target=nessoft.com
&targetstats=1&alltargets=1&columns=1
&async=false&TraceCount=Unlimited
&Interval=10000&SamplesToInclude=10
&SettingsName=Default+Settings
&_=1405127455784

Request Method:GET

Status Code:200 OK

You can see in the request URL the parameters that are passed and it turns out that the only ones we need are the ID key NEWTARGET and, for the value, the IP address or domain name of the target. The polling frequency as well as all other parameters will default to whatever is set in PingPlotter’s application UI (note that if you wanted to use a specific polling frequency you’d use the Interval key and give a value in milliseconds).

So, over to the command line. If you’re on a number of operating systems that includes OS X then curl will already be installed (if you’re not sure whether curl is on your machine just type “curl”at the command prompt and if you get something like “command not found”you need to go to the curl download page).

Note for OS X Mavericks users: See Important note for curl users on OS X Mavericks 10.9 on the curl site.

So, with curl installed all you need to do to add a target, say, 192.168.1.254, is enter:

RedQueen:~ mgibbs$ curl ‘http://192.168.1.127:81/cmd.asp?ID=NEWTARGET&target=192.168.1.254'

And the new target will be added to the target list. Now, let’s say you want to add a range of IP addresses. Turns out that curl know how to iterate over a range; just put the beginning and end IP addresses in square brackets like this:

RedQueen:~ mgibbs$ curl
‘http://192.168.1.127:81/cmd.asp?
ID=NEWTARGET&target=192.168.1.[1-254]'

Neat, eh? We’ve just added in all the IP addresses for a Class C network. Want a Class B network? Luckily curl is smart enough to iterate an iteration:

RedQueen:~ mgibbs$ curl
‘http://192.168.1.127:81/cmd.asp
ID=NEWTARGET&target=192.168.[1-254].[1-254]'

Removing a PingPlotter target is tricky because once added targets are identified by a PingPlotter-assigned ID. To get that ID you’d have to parse the contents of the PingPlotter Web page which .

But there’s a problem with adding too many targets: PingPlotter won’t be able to display so many graphs (they’ll all be squished up) and at some point the program will run out of memory or exhaust processor cycles. So, we need to be picky about which targets to add…we’ll figure out an answer in the next part.

Insider Tip: 12 easy ways to tune your Wi-Fi network
Editors' Picks
Join the discussion
Be the first to comment on this article. Our Commenting Policies