Monitor Environments with Google Cloud Managed Service for Prometheus: Challenge Lab - GSP364
Introduction
In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
This lab is recommended for students enrolled in the Monitor Environments with Google Cloud managed Service for Prometheus course. Are you ready for the challenge?
Lab Objectives
In this lab, you will learn how to:
Deploy the Managed Service for Prometheus
Create a self managed data collection for scraping metrics
Deploy an application to query metrics
Task 1. Deploy a GKE cluster in us-west1-a
Task 2. Deploy a managed collection
Note: You will need to utilize a flag when issuing the command to create the GKE cluster in order to enable the Managed Service for Prometheus.
Note: You should use the setup and operator manifest files to complete this challenge. For more information, refer to GoogleCloudPlatform/prometheus-engine.
Task 3. Deploy an example application
Note: Use the following manifest: example-app.yaml
Check if prometheus has been deployed
Check my progress
Task 4. Filter exported metrics
- Add the following to operator config to filter metrics
collection:
filter:
matchOneOf:
- '{job="prom-example"}'
- '{__name__=~"job:.+"}'
- Create a config.yaml file
vi op-config.yaml
Copy the contents of operatorconfig inside the config.yaml file
Upload the config file you created to verify.
export PROJECT=$(gcloud config get-value project)
gsutil mb -p $PROJECT gs://$PROJECT
gsutil cp op-config.yaml gs://$PROJECT
gsutil -m acl set -R -a public-read gs://$PROJECT
Check if metrics filter has been applied
Solution of Lab
curl -LO raw.githubusercontent.com/QUICK-GCP-LAB/2-Minutes-Labs-Solutions/main/Monitor%20Environments%20with%20Google%20Cloud%20Managed%20Service%20for%20Prometheus%20Challenge%20Lab/gsp364.sh
sudo chmod +x gsp364.sh
./gsp364.sh