Distribute custom dashboards with your extensions
After your extension starts sending data to Dynatrace, you can create a custom dashboard and then export its definition to a JSON file and add it to your extension archive. You can export a dashboard definition through the Dynatrace web UI or Dynatrace API.
Export dashboard in web UI
- Go to Dashboards or Dashboards Classic (latest Dynatrace).
- In the row for the dashboard you want to export, select More (…) > Export.
A JSON file with the dashboard's name is downloaded to your local machine. For more information, see Edit Dynatrace dashboard JSON.
Export dashboard using API
- Go to Dashboards or Dashboards Classic (latest Dynatrace) and display the dashboard.
- In the dashboard URL, find the
id
parameter (for example,id=d996b25e-593c-4213-8ad3-c87319a8830a
) and save the parameter value. - Use the Get a dashboard API endpoint to get the dashboard JSON definition.
Run the following command to get the dashboard definition. For this example, we use the Dynatrace SaaS URL:
Replace:curl -X GET "https://{env-id}.live.dynatrace.com/api/config/v1/dashboards/{dashboard-id}" \-H "accept: application/json; charset=utf-8" \-H "Authorization: Api-Token `{api-token}"
{env-id}
with your Environment ID.{api-token}
with an API token that has the required permissions.{dashboard-id}
with the dashboard identifier you determined in the previous step.
- The call returns the JSON payload containing the dashboard definition. Save it as a JSON file.
Add your dashboard to the extension package
Add your dashboard JSON file to your extension package and reference it in your extension YAML file.
For the following package structure:
extension.zip│ extension.yaml│└───alerts│ | alert.json│└───dashboards│ dashboard.json
Use the following reference in the top level of your YAML file:
dashboards:- path: dashboards/dashboard.jsonalerts:- path: alerts/alert.json