Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction 
2.
Cloud Monitoring
3.
Scoping projects and monitored projects
4.
Best practices for scoping projects
5.
View metrics for multiple Cloud projects 
5.1.
Setup before you begin 
5.2.
Adding Monitored projects
5.3.
Removing Monitored projects
5.4.
List of Monitored projects
5.5.
Selecting a different metrics scope
5.6.
Viewing metrics for AWS accounts
6.
Frequently Asked Questions
6.1.
What is called a cloud?
6.2.
What is the Cloud Controls Matrix?
6.3.
What is an Asynchronous method?
6.4.
What is cloud bursting?
6.5.
What is IAM?
7.
Conclusion
Last Updated: Mar 27, 2024

Viewing Metrics for Multiple Projects

Author Muskan Sharma
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction 

We all are familiar with google cloud console. We have used it for different projects. But the problem arises with how to manage the metrics when working on a google project. So for that, in this blog, we will learn about the concept of the metric in cloud monitoring.

So let's dive in more to learn about this topic.

Cloud Monitoring

Cloud Monitoring gathers data from hosted uptime probes, application instrumentation, Google Cloud, Amazon Web Services (AWS), and events.

By default, a Google Cloud project has visibility only to the metrics it can store. However, you can expand the set of metrics that a project can be accessible by adding other Google Cloud projects to the project's metrics scope. The metrics scope defines the set of the Google Cloud projects whose metrics the current Google Cloud project can access.

A scoping project hosts the metrics scope.

Information regarding the scope of the metric is kept in the scoping project. Additionally, you can configure it to store the alarms, uptime checks, dashboards, and monitoring groups for the metrics scope.

For example, consider the scenario when two Cloud projects are included in the metrics scope of a scoping project. The policy watches the metrics in the two projects when an alerting policy is created in the scoping project for that metrics scope.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Scoping projects and monitored projects

Assume that Compute Engine virtual machine (VM) instances are present in your Staging and Production projects. Create a new project called AllEnvironments, and then add the Staging and Production projects as monitored projects in order to examine the metrics for all of your VMs in a single view. With this arrangement, you may access the metrics saved in the Staging project in two distinct ways:

  • Select AllEnvironments using the Google Cloud console project selector to see analytics for all projects. You may see the metrics scope for the AllEnvironments project by going to the Monitoring page. The following diagram's dashed line indicates that all three projects' metrics are available:

 

Project metrics

 

  • Select the Staging project in the Google Cloud console's project selector to see only the stats for that project. You may examine the scope of the metric for the Staging project by going to the Monitoring page. The following diagram's dashed line indicates that just the Staging project's metrics are available:

 

Staging Project's metrics

Best practices for scoping projects

When a metrics scope comprises monitored projects, you must provide filters that exclude metrics from the monitored projects to chart or monitor just those metrics recorded in the scoping project. Using filters makes chart and alerting rules more complex and raises the chance of a configuration error. The recommendation ensures that these scoping initiatives don't produce metrics, so there won't be any to chart.

The preceding illustration complies with our advice. The Staging and the Production projects were added as the monitored projects after the scoping project AllEnvironments was formed. Use the metrics scope for  AllEnvironments project to view or track the aggregate metrics for all projects. Use the metrics scope for the Staging project in order to inspect or keep track of the metrics kept there.

Take a look at a different layout. Consider the scenario where you decide to make the Production project a monitored project under the Staging project's metrics scope. You can examine or track metrics across all projects by using the metrics scope for the staging project:

The only metrics maintained in the Staging project are more challenging to examine or monitor due to this design. The combined metrics of Staging and Production projects are provided in the metrics scope for the Staging project. Therefore, your chart or alerting policy must employ filters to remove the data from the Production project when you wish to view or monitor only metrics recorded in the Staging project.

Now let’s have a look at view metrics for multiple projects

View metrics for multiple Cloud projects 

In this, we'll learn how to set up a Google Cloud project in the Google Cloud console to view and track metrics recorded in different Google Cloud projects.

Setup before you begin 

  • Make sure that the metricsScopesAdmin role is included in your Identity and Access Management (IAM) roles on the scoping project and any project you want to add as a monitored project. See Metrics scope setups for further details.
  • If you employ VPC Service Controls, you must take into account the sequence in which your multi-project metrics scope and VPC perimeters are established. The VPC perimeter check is carried out by Cloud Monitoring whenever a project is added to a metrics scope:
  •  The perimeter validation procedure starts when you first build the VPC perimeter and attempt to add a project to the metrics scope. The new project must be within the same perimeter as the scoping project or be connected to it by a perimeter bridge for this process to be valid. If the perimeter validation is unsuccessful, adding the project to the metrics scope will likewise be unsuccessful.
  • The perimeter validation process is disabled when you first build your multi-project metrics scope before you create your perimeters. Using this method, you can retrieve metrics for projects within various parameters.
  • You must consider the effects of permissions on a project that is a scoping project for a multi-project metrics scope before configuring IAM roles or granting access to projects. All metrics available to the metrics scope for that project can be viewed by the person with a role that allows read rights to Monitoring data. A user sees the metrics of the AllEnvironment project. For instance, it is also viewing the metrics of the Production project if the AllEnvironment project monitors the Production project.

Adding Monitored projects

Do the following to add monitored projects:

1.Select Monitoring from the Google Cloud console or press the following button:

Go to Monitoring 

2.Choose one of these:

  • Do the following to build a new multi-project metrics scope:
  • Select New Project from the expanded project picker menu on the Google Cloud dashboard.
  • Fill out the dialogue.
  • Select the new project using the project picker in the Google Cloud console.
  • Use the Google Cloud console project picker for choosing the scoping project whose metrics scope you want to change to add monitored projects to an existing project.
  • Select Settings from the Monitoring menu panel.

3.Select the projects you want to add, then click Add GCP Projects.

4.Select Create a new scoping project if you are given the option of doing so or using the current project as scoping project.

5.Then select Add projects.             

Removing Monitored projects

Do the following to remove monitored projects:

1.Select Monitoring from the Google Cloud console or press the following button:

Go to Monitoring 

2.To examine or change the metrics scope of a Cloud project, use the project picker in the Google Cloud console.

3.Select Settings from the Monitoring menu panel.

4.Select the projects you want to be deleted from the GCP Projects in the scope window, then click Remove project.

List of Monitored projects

Do the following to show a list of monitored projects:

1.Select Monitoring from the Google Cloud console or press the following button:

Go to Monitoring 

2.To examine or change the metrics scope of a Cloud project, use the project picker in the Google Cloud console.

3.Click on >Expand on the Metrics scope field of the Monitoring navigation pane.

The page that appears when the AllEnvironments project is selected is depicted in the next screenshot:

List of Monitored projects

Additionally, it demonstrates that this project consists of two monitored projects, Staging, and Production.

Selecting a different metrics scope

Use the project picker in the Google Cloud console to choose a different project if you want to choose a different metrics scope.

Now let's have a look at View metrics for AWS accounts

Viewing metrics for AWS accounts

In this, we are going to learn how to use Cloud Monitoring to view and track metrics from Amazon EC2.

Frequently Asked Questions

What is called a cloud?

The term "the cloud" describes the software and databases that run on servers that may be accessed via the Internet.

What is the Cloud Controls Matrix?

The Cloud Controls Matrix (CCM) from the Cloud Security Alliance is a tool created expressly to help potential cloud customers and cloud vendors analyze the overall security risk of a cloud provider.

What is an Asynchronous method?

The execution of an asynchronous method occurs in a separate thread from the main application thread.

What is cloud bursting?

Hybrid clouds are related to cloud bursting. The notion is that a certain application typically runs in a local computer environment or a private cloud.

What is IAM?

Identity and access management (IAM) is a centralized and consistent method to automate access controls, maintain user identities, and adhere to compliance standards in both traditional and containerized settings.

Conclusion

This blog has extensively discussed Viewing Metrics for Multiple Projects. We hope this article was helpful and it enhanced your knowledge about Viewing Metrics for Multiple Projects. If you want to explore more, check out the excellent content on the Coding Ninjas Website:

Key concepts of cloud logging

Refer to our guided paths on the Coding Ninjas Studio platform to learn more about DSA, DBMS, Competitive Programming, Python, Java, JavaScript, etc. 

Check out this problem - Smallest Distinct Window.

Refer to the links problemstop 100 SQL problemsresources, and mock tests to enhance your knowledge.

For placement preparations, visit interview experiences and interview bundle.

Thank You

Do upvote our blog to help other ninjas grow. Happy Coding!

Previous article
Cloud Profiler
Next article
Advanced Types of App Engine AuditData
Live masterclass