Automated Remote Connectivity Testing

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
61,433
Reaction score
23,180
Location
Cape Town
Okay my customers are getting more and more uppity about us testing remote connections to their systems on a regular basis so that we don't end up with the problem that during a critical issue there is not remote connectivity.

Sure sure in a perfect world it would be online 24/7 and fairly static...but nothing is perfect.

Deeper problem is that just about everyone has a different manner of connectivity, but for a start let's look strictly at SSH.

I use MobaXTerm as my default client for all things remote.

Is there an existing script or even Linux-based application out there that I could run on a monthly basis with a Cronjob to simply report back and say "YES, this connection works"?

I already have some bash scripts in place just to open the connections with minimal hassle right now so that part is already mostly automated, but what I need to figure out is how do I get the feedback from the other end to say "Yes I'm here, you've logged into me" ?

A standard ICMP check to know the box is still there won't do the job. I need to know authentication works and that I can get to the other end completely.

Spiceworks and Nagios came to mind very quickly but I'm not sure either will work with the multi-layer jump server setups...or manual password entry that is required sometimes.

And any solution that requires a client side install is probably a no go as I couldn't get client buy-in on that.
 
Last edited:
I'd probably go with a monitoring system like Zabbix / Nagios / Icinga2 etc and just create a check that ssh's in - does a hostname and alerts if that $hostname isn't as expected or some such...

Ansible would be a quick and dirty check to see if you could SSH - hell you could even do a for loop and just log to file if one item times out - but that won't really provide history / graphing - which I'm sure the clients would probably prefer.
 
I'd probably go with a monitoring system like Zabbix / Nagios / Icinga2 etc and just create a check that ssh's in - does a hostname and alerts if that $hostname isn't as expected or some such...

Ansible would be a quick and dirty check to see if you could SSH - hell you could even do a for loop and just log to file if one item times out - but that won't really provide history / graphing - which I'm sure the clients would probably prefer.

Zabbix requires a client.

The deeper problem is that the box I connect from is controlled by "Security" ass hats. So I'm kind of restricted to a bash script or "portable" Windows application of some kind.

I wonder if Ansible would run inside MobaXterm...will check it out.
 
If ssh, why not just do a remote ssh command to touch a file and delete?

Actually got around in much simpler manner.

Code:
ssh -q -o BatchMode=yes -o ConnectTimeout=10 user@hostname exit

if [ $? -ne 0 ]
then
  # Do stuff here if example.com SSH is down
    echo 'Can not connect to example.com' #| mail -s "example.com down" whoever@wherever
    fi

If I don't have passwordless then I can remove the Batchmode and rely on MobaXterm's built-in password management.

Of course email is blocked but this at least helps me to automate it all into one script and run it once every blue moon and check for output.

Rewrote it a little to output successes as well but for some reason it being the portable version didn't save....****ing "security experts" so will need to save it somewhere permanent.

Days like these I miss being in charge of it all in an SME and hate "The Man" otherwise I would have just installed and used Spiceworks Network Monitor.
 
Last edited:
Actually got around in much simpler manner.

Code:
ssh -q -o BatchMode=yes -o ConnectTimeout=10 user@hostname exit

if [ $? -ne 0 ]
then
  # Do stuff here if example.com SSH is down
    echo 'Can not connect to example.com' #| mail -s "example.com down" whoever@wherever
    fi

If I don't have passwordless then I can remove the Batchmode and rely on MobaXterm's built-in password management.

Of course email is blocked but this at least helps me to automate it all into one script and run it once every blue moon and check for output.

Rewrote it a little to output successes as well but for some reason it being the portable version didn't save....****ing "security experts" so will need to save it somewhere permanent.

Days like these I miss being in charge of it all in an SME and hate "The Man" otherwise I would have just installed and used Spiceworks Network Monitor.

You might want to get that bit further and actually test a login if possible. It's one thing the service being up, it's another if you can't actually log in etc.
 
You might want to get that bit further and actually test a login if possible. It's one thing the service being up, it's another if you can't actually log in etc.

That’s exactly what it does.

It logs in and then exits.

If it can’t login then it gives an error result.
 
Doh didn't see the username bit / that it's key'd... :D

In post#3 you came across as smart, when I read post#8 I thought wtf this guy is a dumbass :p:D

You made me feel smart there for a second as I can't do bash scripting if my life depended on it but I picked up on the username part :D
 
Top
Sign up to the MyBroadband newsletter
X