A very simple (and free!) service to check if your server is up or down and notify you.
This is a Google Sheet script that will check a url as often as you'd like and email you if the url is not available. It is great for checking personal websites, API's or really any url you'd like to keep tabs on.
If it receives a status code back from the url that is different from the last time it checked, it will email you. A healthy url should return a status code of 200. If something goes wrong and it returns a 40x or 50x status code, it will email you. Once the server is fixed, and back to returning 200, it will email you again. It will only email you on status code changes, not every time it receives a bad status code.
It will also keep track of response times from the url. It has a chart to show you this over time as well as a daily average sheet with that data.
Follow the steps below to get it running.
-
Open up Drive.
-
Create a New Google Sheet.
-
Click 'Tools -> Script editor...'.
-
Create script for 'Blank Project'.
-
Paste the code from Code.gs in this repo into the Code.gs file in the Script Editor.
-
Edit the first 3 lines of the Code.gs file inside the Script Editor to add your server url, a name you'll recognize and the email address you want to be notified at.
-
Save the Code.gs file and give it a name.
-
Click 'Resources -> Libraries...'.
-
In the 'Find a Library' input paste this key:
Mg6pvEB4DVYkHEw0WQhuhRqOFunn5iDS7
then click 'Select'. -
Click on 'Version' and choose the latest. Then click 'Save'.
-
Click 'Run -> initialize'. This will ask for some permissions then set up the sheet.
-
A dialog will ask you for Authorization to run. Click 'Continue'.
-
Another dialog will ask you for permission to access Sheets and Email. Click 'Accept'.
-
Go back to the Sheet tab. You should see some Columns and Sheets.
-
Refresh the sheet tab. You should see a new menu with the name you gave your server. Click on it then click 'Run'.
-
After Run, you should see your first entry. It shows the Date, Status Code and Response Time.
-
Click back to Script Editor. If it closed when you refreshed the tab in step 15, click 'Tools -> Script editor...' to re-open. On the Script editor click 'Resources -> Current project's triggers'.
-
A dialog will open. Click 'No triggers set up. Click here to here to add one now.'.
-
Click the 'Run' dropdown and choose 'fetch'. It will then be set to run ever hour. You can adjust this with the 'Events' dropdowns. Click 'Save'.
-
That's it! You are now all set up. It will run as often as you told it to. If the Status Code changes (eg. from 200 to something else) it will email you.