You can push metrics to Dynatrace from multiple Google Cloud projects. For example, you can run dynatrace-gcp-monitor
in a project dedicated to monitoring, and get metrics from production, stage, or development projects.
There are two methods for monitoring multiple Google Cloud projects, depending on the size of the environment you want to monitor:
To monitor large environments, you can make use of Google's metrics scope feature. You need to select the main scoping project (where the Google Cloud integration will be deployed) and configure the rest of the projects as monitored projects. See below for instructions.
To modify a metrics scope, you need to have the Monitoring Admin (roles/monitoring.admin) role's permissions for all projects involved.
Basically, you extend the metrics visibility from the main scoping project to all the monitored projects from your Google Cloud console. For details, see Viewing metrics for multiple projects.
The next step is to deploy the Google Cloud Monitor integration with the parameter scopingProjectSupportEnabled
set to true
in your configuration file. See Main deployment or Alternative deployment scenarios.
This approach should work up to roughly 375 moderately sized projects. If you want to monitor more projects, you'll have to set up multiple Google Cloud Monitor integrations in different main scoping projects, assigning each monitored project to one of them.
There are two ways you can set up the standard monitoring: using the gcloud CLI or in the Google Cloud console. See below for instructions.
Deploy Dynatrace integration in a Kubernetes container.
To add projects to monitoring using the gcloud CLI
Be sure to replace <your-desired-project-ID>
with the ID of your desired project.
wget https://raw.githubusercontent.com/dynatrace-oss/dynatrace-gcp-monitor/master/gcp_iam_roles/dynatrace-gcp-monitor-metrics-role.yamlgcloud iam roles create dynatrace_monitor.metrics --project=<your-desired-project-ID> --file=dynatrace-gcp-monitor-metrics-role.yaml
Be sure to replace <your-desired-project-ID>
with the ID of your desired project, and <your-GCP-project-ID>
with the ID of the project where the IAM service account was created.
Repeat step 1 and 2 for all the other projects you want to monitor.
Enable permission for service usage booking. optional
If you want to set up service usage booking, you need to enable the serviceusage.services.use permission for your IAM service account.
For details about configuring serviceUsageBooking
see Parameters.
It takes about a minute for the metrics from the newly configured projects to appear in Dynatrace.
For GKE deployment, you must restart your Kubernetes container after adding projects to monitoring.
Alternatively, you can grant access for all desired projects in the Google Cloud console.
To add projects to monitoring in the Google Cloud console
For GKE deployment, you must restart your Kubernetes container after adding projects to monitoring.