This template creates a Stackdriver Metric Descriptor.
- Install gcloud
- Create a GCP project, set up billing, enable requisite APIs
- Create a Stackdriver Workspace
- Log in to the Stackdriver Workspace where the metric has to be deployed
- Grant the monitoring.admin IAM role to the Deployment Manager service account
- projects.metricDescriptors
- GCP metric list
- AWS metric list
- Stackdriver Agent metric list
- External metric list
See the properties
section in the schema file(s):
-
Clone the Deployment Manager samples repository
git clone https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit
-
Go to the dm directory
cd dm
-
Copy the example DM config to be used as a model for the deployment, in this case examples/stackdriver_metric_descriptor.yaml
cp templates/stackdriver_metric_descriptor/examples/stackdriver_metric_descriptor.yaml my_metric_descriptor.yaml
-
Change the values in the config file to match your specific GCP setup. Refer to the properties in the schema files described above.
vim my_metric_descriptor.yaml # <== Replace <FIXME:...> placeholders if any
-
Set the project context to use the Stackdriver Workspace project
gcloud config set project <STACKDRIVER_WORKSPACE_PROJECT_ID>
-
Create your deployment as described below, replacing
<YOUR_DEPLOYMENT_NAME>
with your with your own deployment namegcloud deployment-manager deployments create <YOUR_DEPLOYMENT_NAME> \ --config my_metric_descriptor.yaml
-
In case you need to delete your deployment
gcloud deployment-manager deployments delete <YOUR_DEPLOYMENT_NAME>