Jump to content

Online status check of a website


 Share

Recommended Posts

I am searching and searching for a solution to check the status of a website. Between Offline or Online.

The problem is that it is a website of a sharepoint enviroment and you need to log in first before you can enter the site.

Are there ways to check the status of a website so you can check if it's online or offline.

Why do i want this? Because i want to know when the site is down so i can react as quickly as possible to fix the problem.

Now i know some will say you need to make it so good it won't fail, but i am dependable of a second party wich is hosting this platform.

Could someone help me a bit or push me in the right direction?

Link to comment
Share on other sites

Easy message tool.

#include <INet.au3>
Global $URL = "www.google.com"
If NOT(_INetGetSource($URL) = "") Then
    MsgBox(0,"","Your website is ONline")
Else
    MsgBox(0,"","Your website is OFFline")
EndIf
Exit
Oke, but the website wich you need to enter to get into the sharepoint enviroment is password protected.

If you go to http://sharepointsite you get a pop up box wich needs a username and password.

Link to comment
Share on other sites

The problem is that the sharepoint enviroment is running on a server wich is hosting more enviroments for other customers.

A few weeks ago the the server was down, but i don't know if i could ping the server or if our website alone was down.

I am thinking about a script wich launches IE and log in and watch for pixels or something like that, but the problem than is the pc where this script is running is constitantly in use by this script.

So nobody can work on that pc.

So i am looking for a way wich can connect or check to that site in a way like a trayicon, but that is for later use.

First i need to find a way wich i described above. So i don't know if the ping would fail if our site is down because the server could be running and answering the ping while our site is down.

Link to comment
Share on other sites

The problem is that the sharepoint enviroment is running on a server wich is hosting more enviroments for other customers.

A few weeks ago the the server was down, but i don't know if i could ping the server or if our website alone was down.

I am thinking about a script wich launches IE and log in and watch for pixels or something like that, but the problem than is the pc where this script is running is constitantly in use by this script.

So nobody can work on that pc.

So i am looking for a way wich can connect or check to that site in a way like a trayicon, but that is for later use.

First i need to find a way wich i described above. So i don't know if the ping would fail if our site is down because the server could be running and answering the ping while our site is down.

Then _InetGetSource :)
Link to comment
Share on other sites

I had a similar issue but ours is a custom site. Basically we monitor the web server but not the website on it and the client wanted an automated way of telling if the site was down. I came up with this script from bits of others that will email someone if its up/down and writes to a log file on another server for historical purposes, maybe you can find something useful. The downside is that it has to run as a scheduled task on a pc somewhere and that if your using NTLM authenication I'm not sure if you can automate the logon info, we've got single sign on internally so it's not an issue here. It's not perfect but it's been working here for almost a year without any issues (Other than McAfee blocking port 25 after an upgrade).

It looks long but it's not that bad.

#include <IE.au3>
#include <INet.au3>
#include <date.au3>
#include <file.au3>
Opt("TrayIconDebug", 0)

;Declare Variables, fill these in yourself
$Check1 = 0
$URL = "https://your website"
$PageTitle = "the title of the website"
$PageError = "Error in the title of the page in the case of a logon failure"
$CheckLog = "UNC or local path of your log file"
$EmailFrom = "Who is sending the email, Optional"
$SubjectSuccess = "Subject of the email if it's ok "
$SubjectFail = "Failure subject. "
$EmailBodySuccess = "Logon Was Successful @ "
$MailTo = "who gets the email? helpdesk? @ yourdomain.com"
$CCrecpt = "CC the email to"
$BCCrecpt = "BCC the email to"
$mailserv = "The name or ip of your SMTP server"
$EmailBodyFail = "** DO NOT REPLY TO THIS EMAIL **  Hourly Check Logon Failed @ " & _Now() & ".  Test Manually As Per Documentation.  Escalate to On Call Person if Manual Check Fails."

;Opens the browser and checks for conditions
$o_IE = _IECreate ()
WinSetState("", "", @SW_MAXIMIZE)
_IENavigate ($o_IE, $URL)
Sleep(1000);
If Not WinActivate($PageTitle,"")Then
    $Check1 = 1
WinClose("Internet Explorer","")

ElseIf WinActivate( $PageError,"")Then
    $Check1 = 2
WinClose("Internet Explorer","")

ElseIf WinActivate($PageTitle,"")Then
    $Check1 = 0
WinClose($PageTitle,"")
EndIf

;process the eror code and email appropiate group and write the log
MsgBox(0,"",$check1)
IF $Check1 = 1 Then
    EmailFailure()
EndIf
If $check1 = 0 Then
    EmailSuccess()
EndIf
IF $Check1 = 0 Then
    CheckSuccess()
EndIf
IF $Check1 = 2 Then
    CheckSuccess1()
EndIf

;Functions

;we only want to know about failures, commenting out EmailSuccess
#cs
Func EmailSuccess()
_FileWriteLog($CheckLog, "Logon Successful")

$objMessage = ObjCreate("CDO.Message")
$objMessage.Subject = $SubjectSuccess & _Now()
$objMessage.From = $EmailFrom
;$objMessage.To = $MailTo
;$objMessage.CC = $CCrecpt
$objMessage.BCC= $BCCrecpt
$objMessage.TextBody = $EmailBodySuccess & _Now()

;==This section provides the configuration information for the remote SMTP server.
;==Normally you will only change the server name or IP.
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

;Name or IP of Remote SMTP Server
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $mailserv

;Server port (typically 25)
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
 
$objMessage.Configuration.Fields.Update

;==End remote SMTP server configuration section==

$objMessage.Send
EndFunc
#ce

Func EmailFailure()
_FileWriteLog($CheckLog,"Logon Error Code = Fail" )
$objMessage = ObjCreate("CDO.Message") 
$objMessage.Subject = $SubjectFail & _Now()
$objMessage.From = $EmailFrom
;$objMessage.To = $MailTo
;$objMessage.CC = $CCrecpt
$objMessage.BCC = $BCCrecpt
$objMessage.TextBody = $EmailBodyFail

;==This section provides the configuration information for the remote SMTP server.
;==Normally you will only change the server name or IP.
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

;Name or IP of Remote SMTP Server
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $mailserv

;Server port (typically 25)
$objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
 
$objMessage.Configuration.Fields.Update

;==End remote SMTP server configuration section==

$objMessage.Send
EndFunc

Func CheckSuccess()
_FileWriteLog($CheckLog,"Logon Successful" )
EndFunc

Func CheckSuccess1()
_FileWriteLog($CheckLog,"Logon not really Successful" )
EndFunc
Exit
Edited by Legacy99
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...