Table of Contents (🔎 Click to expand/collapse)
Cloud Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications. Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services, hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch, and many others. Cloud Monitoring ingests that data and generates insights via dashboards, charts, and alerts. Cloud Monitoring alerting helps you collaborate by integrating with Slack, PagerDuty, HipChat, Campfire, and more.
- The Cloud Monitoring agent is a collectd-based daemon that gathers system and application metrics (e.g. disk, CPU, network and process metrics) from virtual machine instances and sends them to Monitoring.
- The Cloud Logging agent sent or stream info to Cloud Monitoring in the Cloud Console.
Install the Cloud Monitoring agent and Cloud Logging agent in the VMs with following commands:
# install the Cloud Monitoring agent
$ curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
$ sudo bash add-monitoring-agent-repo.sh
$ sudo apt-get update && sudo apt-get install stackdriver-agent -y
# install the Cloud Logging agent
$ curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
$ sudo bash add-logging-agent-repo.sh
$ sudo apt-get update && sudo apt-get install google-fluentd
To install the agents on the VM:
- From the Navigation Menu go to Monitoring.
- In the Monitoring Overview window, click VIEW GCE DASHBOARD.
- Click on the VMs Dashboard link under Compute Engine. You will see your VMs listed.
- Under the Monitoring Agent Status (or Logging Agent Status) for VMs, click Install Agent. This will bring up an Agent Details window on the right side, which is used to install the agent.
- In the Agent Details window, ensure the operating system and click Install Agent.
Follow the steps below to create the monitoring workspace:
- In the Cloud Console, click Navigation menu > Monitoring.
- Wait for your workspace to be provisioned.
When the Monitoring dashboard opens, your workspace is ready.
Uptime checks verify that a resource is always accessible. Following the steps to create update time check of instances:
- In the Cloud Console, click Navigation menu > Monitoring > Uptime checks.
- Click Create Uptime Check and then fill the fields.
- Click Test to verify that your uptime check can connect to the resource.
- Click Create when you see a green check mark everything can connect.
Use Cloud Monitoring to create one or more alerting policies:
- In the Cloud Console, click Navigation menu > Monitoring > Alerting.
- Click Create Policy > Add Condition and then fill the fields.
- Click Next > Save.
We can display the metrics collected by Cloud Monitoring in our own charts and dashboards. Create the charts for the lab metrics and a custom dashboard following the steps below:
- In the Cloud Console, click Navigation menu > Monitoring > Dashboard.
- Click Create Dashboard and then add charts.
Cloud Monitoring and Cloud Logging are closely integrated. Check out the logs by following steps:
- In the Cloud Console, click Navigation menu > Logging > Logs Explorer.
- Choose the logs we want to see by clicking Resource and then selecting resources.
- Click Add.
- Click Stream logs.
- [Uptime Check] In the Cloud Console, click Navigation menu > Monitoring > Uptime checks.
- [Alerts] In the Cloud Console, click Navigation menu > Monitoring > Alerting.