0

Hi I have two projects project-A and project-B. I have created a monitoring workspace in project-A and added project-B in that workspace. I want to create alerts from log based metrics . I have created the log based metrics in project-A and created an alert from it but it wouldn't trigger for project-B it works for project-A only. For log based metrics my query is -

                  "resource.type="build"
                   severity=ERROR" 

so alert triggers when cloudbuild fails in project-A but not when it fails in project-B. Is it possible to do that?

Abhinav
  • 21
  • 3

2 Answers2

0

I believe you can start consider Using merge, assume that you have two Google Cloud projects, Project-A and Project-B, and that you want to create a multi-project Workspace for these projects. Also assume that these projects are host projects for a Workspace. That is, a Workspace has been created for Project-A, and a different Workspace has been created for Project-B.

Because both projects are host projects for a Workspace, to have both projects in the same Workspace, you must merge the Workspaces:

In the Monitoring navigation pane, use the Workspace selector to select Project-A. This is the Workspace that is to be retained.

In the Monitoring navigation pane, select settings Settings.

In the Settings window, select Merge, and then select the Workspace named Project-B. To save the change, click Merge.

After the merge operation completes, the Settings window lists Project-A and Project-B as members of the Workspace. In this case, Project-A is the host project.

Also consider to check Multi-project Workspace best practice

1.- Create a Google Cloud project to be the Workspace host project. This project should be empty of resources. That is, it doesn't have any VM instances, Cloud Spanner tables, or other resources.

2.-Create a Workspace for the new project. For details, see Creating a Workspace.

3.- Add Google Cloud projects or AWS accounts to the Workspace by following the steps in Adding monitored projects.

By using this approach, you can move a project that was added in the last step, to a different Workspace, or you can remove it from the Workspace. The move and remove actions affect only the project being moved or removed. No other project in the Workspace is affected.

in this part of the public documentation covers them, mainly consisting of using a new empty GCP project as the host one for the Monitoring Workspace, with the resources to be monitored only being in the other projects.

Elba Lazo
  • 7
  • 2
  • Hi, thanks a lot for the response i have already merged the project. My issue is that i have created an alert out of log based metrics. I want that alert to work for both of my projects as it is working for only one project. – Abhinav Apr 23 '21 at 09:53
0

You have already created a workspace and added both projects Project-A and Project-B, but alerting policies are only applied to one. To resolve this, first you'll create a Cloud Monitoring Group for visibility across both projects.Cloud Monitoring lets you define a set of resources as a group. After you define a group, you can set up alerting policies, charts, and dashboards to monitor the group.

Create a Cloud Monitoring Group

  1. In the left menu, click Groups, and then click Create Group.
  2. In the first dropdown field (Type), Name is selected by default.
  3. In the second dropdown (Contains), Contains is selected by default.
  4. In the third field (Value), type in "project" since both of the project-names in both of your projects start with the word "Project".
  5. Use Cloud Monitoring to create one or more alerting policies.
  6. In the left menu, click Uptime Checks, and then click Add alert policy.
  7. Set the conditions for the uptime check and alerting policies.
  8. Name the alert and click save.

Try this solution and see if this works for you.