Monitoring Your Website Automatically

Do you have a website that you would like to know when it is down? Do you have more than one websit

Do you have a website that you would like to know when it is down? Do you have more than one website? Or, are you looking for a thrift solution to monitor your websites? I located many commercial services that offer free versions of website monitoring services, but I wanted something that was simple to use and open source. One such method was developed by Amit Agarwal lagnol.org which uses Google Scripts on your Google Spreadsheets account. It checks a website every five minutes and alerts you when its down via e-mail.

Here are the steps I used to install it to track my websites :

  • Sign-in to your Google account using your Gmail or Google Apps login.
  • Click here to copy this Google sheet into your Google Drive.

GoogleDrive-UptimeMonitor-1

  • Type your website URL's in cell B2, separate each URL with a comma if you are entering more than one site (I added "-test" to one domain name to test it out), and your email address in cell B3.
  • I did not wish to receive alerts by text message, so I left cell B4 as "No".

GoogleDrive-UptimeMonitor-2

  • Click on Website Monitor menu in your Google Sheets toolbar.
  • Click Initialize and you’ll get a pop-up asking for authorization.
  • Grant the necessary access.


GoogleDrive-UptimeMonitor-3

GoogleDrive-UptimeMonitor-4

  • Go to the Website Monitor menu again and choose “Start Website Monitor” to begin the monitoring process.
  • Close the Google Sheet.
  • You will receive an email when the site is "down" every 5 minutes until it is restored. Each "down" result will be logged in your spreadsheet with the date.

Google notified me of the of following error after a few days of running the script:

Service using too much computer time for one day


My solution was to increase the amount of time between checks to my websites from 5 to 30 minutes. You can access the script by clicking on the link (Copy of Website Monitor v4.0)  in the email you received from Google, or simple clicking on Tools>Script Editor if you have it opened in your Google Drive account:

GoogleDrive-UptimeMonitor-Error-1

I opened the script labnol.gs and updated the following code by changing the 5 to 30:

  // Setup trigger that runs every 5 minutes
  
  ScriptApp.newTrigger("websiteMonitor")
  .timeBased()
  .everyMinutes(30) // Updated from 5 to 30 minutes to reduce computer time
  .create();
  
  sheet.toast("Google Docs will now monitor your website(s). "
              + "You can exit this sheet!", "Initialized", -1);
}

This is the maximum number of time for it to run. Then, saved the update and restarted the script.

I'll keep you all posted if any new messages are received.

Add comment