Jump to content

Best way to check if a web server/site is up and running


Recommended Posts

Hello Everyone,

We have a primary and secondary Cisco Unified Intelligence Center (CUIC) reporting server that our Customer Service Agents will be using soon. Rather than confuse them with two separate shortcuts to to the primary and backup, I was going to create a single shortcut that points to an AutoIt executable that will first check to see if the primary web server/site is up and running and if so - launch the URL to it and - if not - launch the URL to the secondary server.

I've got code working already just pinging the server using the AutoIt Ping command, but I want to also handle when the server can be pinged successfully but the web page is not working for whatever reason.

So, what is the best way - what AutoIt command can I use - to verify just that the web page is running properly on the web server for me to perform my check against?

Regards,

TX Techie

Link to comment
Share on other sites

@TXTechie

As you've said above, you can use Ping() function too, but you have to be sure that the website, even if "pingable", is up and running, so, you could (one of many ways) use _IE* functions to navigate to the website and look for a text that is available only when the website in running correctly.

Take a look at IE UDF Automation Reference to see more about _IE L* functions :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

@FrancescoDiMuro, thank you.

However, I'm looking for a quick check that I can do without launching a browser and looking around, something like the _INetGetSource function.

Would this be considered a good or best practice kind of check?:

#include <Inet.au3>

; Check to see if the primary web server is up and running.
_INetGetSource('<primary server URL>')
If @error = 0 Then
    ; Launch the primary server's URL.
    ShellExecute('<primary server URL>')
Else
    ; Launch the secondary server's URL.
    ShellExecute('<secondary server URL>')
EndIf

 

Edited by TXTechie
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...