How To Monitor The Health Of Your Google Cloud Platform Instances

0
57

Google Cloud Platform comes with a suite of monitoring tools that track metrics on any cloud resource you’re using, which can help you spot problems in your infrastructure. On top of that, it features full support for AWS as well.

Setting Up A Monitoring Dashboard

By default, GCP creates dashboard for some major resources, such as Cloud Storage buckets, storage disks, and Compute Engine instances, which are viewable from the “Monitoring” tabs of those resources. However, the full “Monitoring” service is available from the sidebar, under “Operations”:

You can view the existing dashboards under the “Dashboards” tab:

By default, the graph for Compute Engine instances shows CPU utilization, Disk I/O, and any alarms that have gone off recently. You can filter all of these graphs by time and date using the controls at the top.

If you want to create your own dashboard though, it’s pretty easy. Dashboards are generic—you can create a dashboard that can apply to any GCE Instance and then filter the dashboard by instance name, project ID, or zone ID. This way, you can configure one dashboard with all the useful metrics,  then reuse it for any resource of the same type. If you do want the dashboard to show a specific instance, that’s possible as well.

From the “Dashboards Panel,” create a new dashboard:

Each Dashboard holds multiple charts, which show metrics from a given resource. Create a new chart to add to the dashboard:

From this dialog, you have total control over what metrics you want to display. You’re not limited to just one metric, as charts can display multiple metrics on top of each other, though it’s not guaranteed that the two graphs will make sense together.

Resource Type allows you to select what kind of cloud resource you’re monitoring, whether that’s a Cloud Storage bucket, Database, Compute Engine or EC2 instance, or pretty much any GCP or AWS resource you can think of. This will filter which metrics you can use to only show metrics that apply to the given resource.

The Metric name will select which data to show on the graph. There are a lot of metrics for complex resources like GCE instances, but the common ones like CPU Utilization, Disk I/O, memory usage, and Network In/Out are all here.

Filter allows you to preselect a particular project, instance, zone, or group. You can always change this from the dashboard to view other instances, but this will set the default filter.

Group By will change how multiple resources are displayed on the graph. If you’re adding a chart to monitor a group of instances, you could, for example, choose to separate them by Instance name.

Once added to the graph, you can always edit the settings from the menu on the chart, or activate “Stats Mode”, which will display moving averages and other useful features.

Setting Custom Alarms

One of the most useful features of GCP’s Monitoring suite is being able to set custom alarms that will notify you whenever there are problems with your network.

There are two kinds of alarms offered by Monitoring, both of which are entirely free and unlimited for everyone. Uptime Checks will query a web or TCP service to ensure that it’s still up and running. Alerting Policies will monitor metrics, and send alerts whenever it reaches a certain level, or something out of the ordinary happens.

Uptime checks are simple, and available from the main “Overview” tab. You’ll simply have to give it your hostname, and set an interval for it to check.

Once you hit “Save,” it will prompt you to create an Alert Policy for the check, which will send you notifications if it ever fails.

If you want to set up your own Alerting Policy, you can do so from the “Alerting” sidebar. This allows you to select a resource, metric, filter, and group, and configure it to send a notification if the graph meets the given condition. For example, you could set an alarm to trigger if CPU utilization on the instance is over 80% for at least a few minutes.

Of course, you’ll need to configure notifications for the alarm. The simplest option is to set up a notification channel to send you an email, but other options are available, such as SMS notifications, Slack notifications, or posting to a webhook.

All of these notification options are entirely free.