Keep an eye on the uptime checks using Google Monitoring service

A quick and easy way to instantly know that our service is experiencing problems.

Przemysław Żochowski
4 min readJan 10, 2022
Photo by Tobias Tullius on Unsplash

Once the application is deployed and our customers start visiting it, our focus should not be set only on further development of the service, but first and foremost on an uninterrupted availability. In case any troubles appear on the horizon, we would like be the first ones to know, that something is not working, without the necessity to monitor it manually. One of the first steps would be to set alerting for the uptime checks of our application. This short article depicts a quick and easy way to do just that with the use of Google Cloud Monitoring service.

A quick disclaimer: Just because Google service is used for the purpose of the uptime checks, it does not mean that the application must be hosted on the Google Cloud Platform.

This article assumes You have an active account on the Google Cloud Platform and are familiar with basic GCP concepts.

Configuring uptime checks for the application

The entire setup (especially alerting) requires specific roles in the project, so make sure You have them. Check out Google documentation for more information.

Once logged in the Google console select the Monitoring option from the left sidebar menu, located in the Operations section. Alternatively, one might type in ‘monitoring’ in the search bar. In both cases You should be presented with the following view after selecting the Monitoring:

Main screen of monitoring dashboard

Uptime check is the service we are interested in, so again we can select it from the sidebar menu on the left or directly from the monitoring dashboard. Once we do that, we should see the following:

Google uptime checks panel

Now we get to the essence of the whole setup. By clicking on the “Create uptime check” option, we activate a short form on the right, where our uptime check should be defined. The most important sections are the “Target” and “Alert & notification”. The first one allows us to define condition for the uptime check. The next one facilitates a configuration of the alerts resulting from the checks and notification channels.

Basic illustrative setup for a health check of our external service hosted on public domain

If the website requires an authentication to access the specified path, we can provide the necessary credentials there. We can leave the rest as it is or adjust it to our needs. By default the uptime check will expect a response from the service with HTTP Status of type “Success” if we didn’t specify any additional requirements (like necessary content returned). In any other scenario, an uptime check will raise an alert, which we define in the next step. If we haven’t configured any notification channels before, we will be asked to do it now.

Configuring alerts & notifications for our uptime check

In the Alert & notification section we select “Manage notification channels” option. There’s a list of options, to name just a few:

  • Slack — alerts are sent directly on the provided slack channel after we create an integration with it;
  • Email — alerts are sent directly on the email address;
  • SMS — alerts are sent directly on the provided telephone number;
  • Cloud Pub/Sub — push alert events as a message on the selected Google Pub/Sub topic. It is a good option, if we have a consumer processing those messages, generating reports or if we want to simply store it on the queue for other downstream systems;

When selecting Slack, Google will ask for permission to access the workspace of Your choice. Once permission is granted by the Slack administrator, You can enter the name of the Slack channel used for notifications and provide a display name for the notification channel. Note that if the Slack channel is private, the Monitoring app has to be invited to the channel, by typing in:

/invite @Google Cloud Monitoring

in the channel message bar.

Now, every time our application does not pass the uptime check, we get a notification on the Slack channel about an incident pending:

An example of an incident raised by the uptime check on the Slack channel

Once the uptime checks passes the trial again, we will be notified on our channel about the closure of the incident.

Additionally, we can look at the history of our uptime checks on the monitoring dashboard charts in the Google Console.

Conclusion

Google Uptime Check is a very simple and effective way to keep our applications under surveillance. In the world of high-availability and high demand for non-interrupted access to the resources over the Internet, quick reaction for the potential failures and service outages is of the highest importance. It gives us, the developers, a chance to apply the fix as soon as possible, before our users notice the issue.

--

--

Przemysław Żochowski

Passionate Java full-stack developer. Strong advocate of the motto: "If you can't explain something in simple words, you don't understand it well enough"