This page describes how to install Google Cloud Function version 0.1, which is scheduled for deprecation.
To set up the Dynatrace integration as a Google Cloud Function, follow the instructions below.
Install yq version 4.9.8
Example command to install yq:
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.8/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
Enable the following permissions for the API token: Ingest metrics
(API v2), Read configuration
(API v1), and Write configuration
(API v1)
Determine the URL for your environment.
https://<your-environment-id>.live.dynatrace.com/
https://<your-domain>/e/<your-environment-id>/
To determine <your-environment-id>
, see environment ID.
Running the deployment script requires a list of permissions. You can create a custom role (instruction below) and use it to deploy dynatrace-gcp-monitor
.
dynatrace-gcp-monitor-cloud-function-deployment-role.yaml
with the following content:title: Dynatrace GCP Monitor cloud function deployment roledescription: Role for Dynatrace GCP Monitor cloud function deploymentstage: GAincludedPermissions:- appengine.applications.get- appengine.applications.create- cloudfunctions.functions.create- cloudfunctions.functions.get- cloudfunctions.functions.list- cloudfunctions.functions.sourceCodeSet- cloudfunctions.functions.update- cloudfunctions.functions.getIamPolicy- cloudfunctions.operations.get- cloudfunctions.operations.list- cloudscheduler.locations.list- cloudscheduler.jobs.list- cloudscheduler.jobs.create- cloudscheduler.jobs.get- cloudscheduler.jobs.delete- pubsub.topics.list- pubsub.topics.create- pubsub.topics.update- secretmanager.secrets.list- secretmanager.versions.add- secretmanager.secrets.create- secretmanager.versions.list- secretmanager.secrets.getIamPolicy- secretmanager.secrets.setIamPolicy- resourcemanager.projects.get- resourcemanager.projects.getIamPolicy- resourcemanager.projects.setIamPolicy- serviceusage.services.enable- iam.serviceAccounts.actAs- iam.serviceAccounts.list- iam.serviceAccounts.create- iam.serviceAccounts.getIamPolicy- iam.serviceAccounts.setIamPolicy- iam.roles.list- iam.roles.create- iam.roles.update- monitoring.dashboards.list- monitoring.dashboards.create
<your_project_ID>
with the project ID where you want to deploy the Dynatrace integration.gcloud iam roles create dynatrace_monitor.cloud_function_deployment --project=<your_project_ID> --file=dynatrace-gcp-monitor-cloud-function-deployment-role.yaml
Be sure to add this role to your GCP user.
To deploy the Dynatrace GCP function in Google Cloud Shell, download and run the installation script below, making sure to replace <VERSION>
with the release version you want to download, for example 0.1.19
.
Be sure to choose one of the versions before release-1.0.0
, as the newer versions require different installation instructions.
wget -q "https://github.com/dynatrace-oss/dynatrace-gcp-monitor/releases/download/release-<VERSION>/setup.sh" -O setup.sh; chmod a+x *.sh; ./setup.sh
The Dynatrace GCP Monitor uses Cloud Scheduler, which requires the App Engine application. If you don't have App Engine installed, the installer script will prompt you to create App Engine and select the region where you want the installer script to run.
The installation script will prompt for the following parameters:
GCP project ID - The ID of the Google Cloud project where you want to deploy the Dynatrace GCP Monitor. The default is set to the current project ID, for the gcloud CLI.
Function size - The amount of memory that you want to allocate to the function. You can select one of the following:
[s]
- Small (allocates 256 MB memory to the function). Select this option if you have up to 500 GCP service instances.
[m]
- Medium (allocates 512 MB memory to the function). Select this option if you have up to 1,000 GCP service instances.
[l]
- Large (allocates 2,048 MB memory to the function). Select this option if you have up to 5,000 GCP service instances.
You can adjust the amount of memory after installation.
Dynatrace tenant URI - Your Dynatrace environment URL. See Prerequisites for details.
Dynatrace API token - Your Dynatrace API token. See Prerequisites for details.
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.8/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
Ingest metrics
, Read configuration
, and Write configuration
permissions for the API tokenFor SaaS:
https://<your-environment-id>.live.dynatrace.com/
For Managed:
https://<your-domain>/e/<your-environment-id>/
To determine <your-environment-id>
, see environment ID.
dynatrace-gcp-monitor
.dynatrace-gcp-monitor-cloud-function-deployment-role.yaml
with the following content:title: Dynatrace GCP Monitor cloud function deployment roledescription: Role for Dynatrace GCP Monitor cloud function deploymentstage: GAincludedPermissions:- appengine.applications.get- appengine.applications.create- cloudfunctions.functions.create- cloudfunctions.functions.get- cloudfunctions.functions.list- cloudfunctions.functions.sourceCodeSet- cloudfunctions.functions.update- cloudfunctions.functions.getIamPolicy- cloudfunctions.operations.get- cloudfunctions.operations.list- cloudscheduler.locations.list- cloudscheduler.jobs.list- cloudscheduler.jobs.create- cloudscheduler.jobs.get- cloudscheduler.jobs.delete- pubsub.topics.list- pubsub.topics.create- pubsub.topics.update- secretmanager.secrets.list- secretmanager.versions.add- secretmanager.secrets.create- secretmanager.versions.list- secretmanager.secrets.getIamPolicy- secretmanager.secrets.setIamPolicy- resourcemanager.projects.get- resourcemanager.projects.getIamPolicy- resourcemanager.projects.setIamPolicy- serviceusage.services.enable- iam.serviceAccounts.actAs- iam.serviceAccounts.list- iam.serviceAccounts.create- iam.serviceAccounts.getIamPolicy- iam.serviceAccounts.setIamPolicy- iam.roles.list- iam.roles.create- iam.roles.update- monitoring.dashboards.list- monitoring.dashboards.create
<your_project_ID>
with the project ID where you want to deploy the Dynatrace integration.gcloud iam roles create dynatrace_monitor.cloud_function_deployment --project=<your_project_ID> --file=dynatrace-gcp-monitor-cloud-function-deployment-role.yaml
Be sure to add this role to your GCP user.
To deploy the Dynatrace GCP function in bash
gcloud init
wget -q "https://github.com/dynatrace-oss/dynatrace-gcp-monitor/releases/download/release-<VERSION>/setup.sh" -O setup.sh; chmod a+x *.sh; ./setup.sh
The Dynatrace GCP Monitor uses Cloud Scheduler, which requires the App Engine application. If you don't have App Engine installed, the installer script will prompt you to create App Engine and select the region where you want the installer script to run.
The installation script will prompt for the following parameters:
GCP project ID - The ID of the Google Cloud project where you want to deploy the Dynatrace GCP Monitor. The default is set to the current project ID, for the gcloud CLI.
Function size - The amount of memory that you want to allocate to the function. You can select one of the following:
[s]
- Small (allocates 256 MB memory to the function). Select this option if you have up to 500 GCP service instances.
[m]
- Medium (allocates 512 MB memory to the function). Select this option if you have up to 1,000 GCP service instances.
[l]
- Large (allocates 2,048 MB memory to the function). Select this option if you have up to 5,000 GCP service instances.
You can adjust the amount of memory after installation.
Dynatrace tenant URI - Your Dynatrace environment URL. See Prerequisites for details.
Dynatrace API token - Your Dynatrace API token. See Prerequisites for details.
After deploying the integration, you can see metrics from monitored services. If you want to add services to monitoring, see Expand monitoring below.
To check whether installation was successful
dynatrace-gcp-monitor
is there.There are two ways to add services to Dynatrace monitoring when using a Google Cloud Function: via the service configuration file or using the GCP console. See below for instructions.
To add services in the service configuration file
activation-config.yaml
service configuration file, making sure to replace <VERSION>
with your function release version.wget -q "https://github.com/dynatrace-oss/dynatrace-gcp-monitor/releases/download/release-<VERSION>/dynatrace-gcp-monitor.zip" -O dynatrace-gcp-monitor.zip; unzip -p dynatrace-gcp-monitor.zip activation-config.yaml >activation-config.yaml
Edit the activation.metrics.services
section in activation-config.yaml
by uncommenting the services you want to monitor.
Download and run the dynatrace-gcp-monitor
installation script in the same folder where you downloaded activation-config.yaml
.
wget -q "https://github.com/dynatrace-oss/dynatrace-gcp-monitor/releases/download/release-<VERSION>/setup.sh" -O setup.sh; chmod a+x *.sh; ./setup.sh
To add services in the Google Cloud console
cloud_function
, gce_instance/agent
).