Simon icon Simon
Flexible server monitoring

Check for connection

David, is there any way for Simon to check if the machine Simon's running on has an internet connection? I know Simon itself checks, but I'd like to have a notification when it fails.

(BTW, anything new on a "Simon Lite" that we discussed two years ago? Oh, and a "shout out" to a fellow Drupal user.)

Don

David Sinclair's picture

Re: Check for connection

Sure. As you know, Simon checks that it has an internet connection before each test's check, and goes into an offline state if not. This behavior can be disabled via the "Can check when offline" checkbox in the Checking Options section of the Edit Test window. If that box is selected, Simon will perform the check whether or not there's an internet connection, and thus will fail if the test requires one.

As for Simon Lite, it is still planned, perhaps with version 2.6, which is due in January. Was it really two years ago?! Time flies (like an arrow; fruit flies like a banana... had to be said).

Solution found

Sorry for not replying earlier, but that's not quite what I was looking for. I have a couple Macs that occasionally lose their connection to my wireless router -- it's probably the router's fault -- and turning Airport on, then off, fixes the problem. I'd like to do that automatically.

Having all of my tests fail when Simon goes offline isn't the answer, but I did find one:

I created a script service "Internet Connection" with this Applescript:

set intcon to do shell script "ping -c 1 google.com; echo -n"
set paras to number of paragraphs in intcon
if paras < 5 then
return 1
else
return 0
end if

and on failure it runs a script notifier "Reset Internet Connection" with this Applescript:

do shell script "networksetup -setnetworkserviceenabled AirPort off"
delay 3
do shell script "networksetup -setnetworkserviceenabled AirPort on"

Works very well in Snow Leopard. BTW, finally purchased Simon Enterprise!

David Sinclair's picture

Re: Solution found

Excellent; thanks for sharing your solution (and for purchasing an Enterprise license!).

You probably could have used a normal Ping service for the test portion, and just turned on the option to check when offline. But the notifier script is an excellent idea... mind if I include that in the next Simon release and/or the Simon Extras page?