How to simply monitor a Google Apps Script using UptimeKuma

Mohammad R. Tayyebi
3 min readJan 6, 2024

--

Google Apps Script is a powerful tool that allows you to automate tasks and create web applications within the Google Workspace. However, monitoring the performance and uptime of these scripts can be challenging. This is where UptimeKuma comes in. UptimeKuma is an open-source, self-hosted monitoring software that can help you keep track of your Google Apps Scripts. Here’s a simple guide on how to use it.

Step 1: Set Up UptimeKuma

First, you need to install UptimeKuma on your server. You can do this by following the instructions provided in the UptimeKuma GitHub repository. Once installed, you can access the UptimeKuma dashboard through your web browser.

Step 2: Create a New Monitor

In the UptimeKuma dashboard, click on the “New Monitor” button. You will be asked to provide details about the monitor, such as its name and the type of monitor. For Google Apps Script, choose “HTTP(s)” as the monitor type.

Step 3: Configure the Monitor

Next, you need to configure the monitor to point to your Google Apps Script. To do this, you need the URL of the script. You can get this URL by deploying your script as a web app (in the Google Apps Script editor, go to Publish > Deploy as web app). Paste this URL into the “URL” field in UptimeKuma.

You can also set the monitoring interval (how often UptimeKuma checks the script) and the expected HTTP status code (200 for a successful HTTP request).

Step 4: Start Monitoring

Once everything is set up, click on the “Save” button. UptimeKuma will start monitoring your Google Apps Script, and you can view the status and response time of your script on the UptimeKuma dashboard.

Step 5: Set Up Push Monitoring

Push monitoring is a proactive form of monitoring where the application sends updates to the monitoring tool, rather than the monitoring tool checking the application at regular intervals. Here’s how to set it up with UptimeKuma and Google Apps Script.

5.1: Create a Push Monitor in UptimeKuma

In UptimeKuma, create a new monitor and select “Heartbeat” as the monitor type. This will generate a unique URL that your Google Apps Script will send updates to.

5.2: Configure Google Apps Script to Send Heartbeats

In your Google Apps Script, you’ll need to add code that sends a HTTP request to the Heartbeat URL. This can be done using the UrlFetchApp service. Here’s a simple example:

function sendHeartbeat() {
var url = 'YOUR_HEARTBEAT_URL'; // Replace with your Heartbeat URL
UrlFetchApp.fetch(url);
}

You can call this function at the end of your main script function, or set up a time-driven trigger to call it at regular intervals.

5.3: Start Push Monitoring

Once you’ve set up the Heartbeat monitor and configured your Google Apps Script, UptimeKuma will start receiving updates from your script. If UptimeKuma doesn’t receive an update within the expected interval, it will send an alert.

And there you have it! You’ve now added push monitoring to your Google Apps Script with UptimeKuma. This will give you even more insight into the performance and uptime of your scripts.

Please note: This guide assumes you have basic knowledge of Google Apps Script and server administration. Always ensure you follow best practices when setting up and configuring your server and scripts.

Written by Bing, your AI-powered assistant. Happy coding and monitoring!

--

--