Dashboards and alerts in GCP Cloud Operations

gcp operation suite
Reading Time: 3 minutes

Hi Readers, In previous blog we understood the need and role of GCP Cloud monitoring, logging, error debugging and so on. In this blog we will see how we can work with GCP Cloud Operations to create dashboards and alerts to get notified in case of any event happening against our set alert policy.

Step-1 :Create a simple instance with Firewalls to allow HTTP traffic

Step-2 :SSH to it and install apache2 and php

sudo apt-get update
sudo apt-get install apache2 php7.0

Step:3 Verify apache2 is running

sudo systemctl status apache2
In a browser, navigate to http://[EXTERNAL_IP]

Step:4 Install the agent itself now

Create a file with this content, this will install the monitoring and logging agents inside our compute engine.

curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh
sudo bash install-monitoring-agent.sh

curl -sSO https://dl.google/com/cloudagents/install-logging-agent.sh
sudo bash install-logging-agent.sh

Step 5: Go to Navigation Menu > Operations > Monitoring > Dashboard

Here we will need to create a dashboard and then we can add a chart to it as well. To keep it simple we will select Stacked bar option here.

Step 6: Go to Navigation Menu > Operations > Monitoring > Alerting

Here we will need to create an alert policy in order to monitor the created VM.

This policy will send an alert via SMS on phone whenever the CPU usage is above 0.010%. 0.010% is very low, but it is good enough to test the functionality locally.

After this whenever the CPU usage will cross the threshold limit we will get an SMS alert on phone like this,

That’s all for this blog. In this blog we understood the basics monitoring and logging for our virtual machines.

Thank you for following this blog till end. If you found this blog helpful do share this blog with your colleagues. In case of any feedback, suggestion or question reach out to me at nitin.mishra@knoldus.com.

References

Written by 

Nitin Mishra is a Software Consultant at Knoldus Software LLP. He has done MCA from GGSIPU and completed Bachelor of Science in Computer Science from Delhi University. He is a tech enthusiast with good knowledge of Java. He is majorly focused in DevOps practice. On personal front he loves to travel mountains and writes poetry.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading