public

Monitoring GCP App Engine with Cloud Monitoring

The Cloud Monitoring resource in GCP is very useful for monitoring and alerting on issues. In this article, we are going to setup an App Engine resource, and then monitor its status with Cloud Monitoring.

3 months ago

Latest Post NEW - ByteUnits Membership by Tyler Moon public

The Google Cloud Platform has a simple compute resource called App Engine. This serverless offering provides a simple way to deploy APIs, web apps, and a host of other services. The Cloud Monitoring resource in GCP is very useful for monitoring, and alerting on issues. In this article, we are going to setup an App Engine resource, and then monitor its status with Cloud Monitoring.

Prerequisites

Create Hello World App Engine

Log into the GCP console and navigate to the App Engine resource.

On the top navigation bar open up the GCP console virtual terminal (Highlighted below in yellow)

In the terminal that opens on the bottom of the window, enter the following commands. These will clone the hello world sample code for Nodejs and then install the NPM dependencies:

git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples
cd nodejs-docs-samples/appengine/hello-world/standard
export PORT=8080 && npm install

After creating this simple app use the following gcloud commands to create the App Engine resource and then deploy the sample code to it:

gcloud app create
gcloud app deploy

The output of that last command should display the temp url to view the application. The running hello world application should look something like the following:

Nice and blank but functional enough to connect to GCP Cloud Monitoring.

Configure Cloud Monitoring

Head on over to the Cloud Monitoring resource. Then click "Create new Uptime Check" and add the following parameters:

For the other sections of this menu the defaults will do for the purposes of this quick-start.

Waiting for monitoring

After creating the Uptime Check the dashboard should show something like the following:

For the first few minutes the checks will show an unknown status. After a couple of minutes refresh the dashboard and the unknown statuses should start showing green

Dashboard

To view the Monitoring Dashboard for the App Engine head over to the Monitoring resource then select the "Dashboards" tab on the left side.

Select "App Engine"

Then select your project that you used for creating the App Engine earlier.

And now you should be able to see a dashboard showing standard API metrics!

Summary

In this article, we saw how to configure an Uptime Alert, and view Dashboard metrics for an App Engine resource on GCP.

Tyler Moon

Published 3 months ago