To run Monaco, you need to define the deployment manifest, project directories, and resource configuration so that you can manage the resources.
The deployment manifest file has three top-level keys: manifestVersion, projects, and environmentGroups.
An example of a manifest.yaml:
manifestVersion: 1.0projects:- name: infrapath: shared/infrastructure- name: generalpath: generaltype: groupingenvironmentGroups:- name: devenvironments:- name: test-env-1url:value: https://<YOUR-DT-DEV-ENV-ID>.apps.dynatrace.comauth:token:name: DEV_TOKENoAuth:clientId:name: DEV_CLIENT_IDclientSecret:name: DEV_CLIENT_SECRET- name: test-env-2url:value: https://<YOUR-DT-SPRINT-ENV-ID>.apps.dynatrace.comauth:token:name: SPRINT_TOKENoAuth:clientId:name: SPRINT_CLIENT_IDclientSecret:name: SPRINT_CLIENT_SECRET- name: prodenvironments:- name: prod-env-1url:type: environmentvalue: https://<YOUR-DT-PROD-ENV-ID>.apps.dynatrace.comauth:token:name: PROD_TOKENoAuth:clientId:name: PROD_CLIENT_IDclientSecret:name: PROD_CLIENT_SECRET
A manifest must contain a manifestVersion as a top-level key.
This is a simple string that is used to validate if the currently used version of Monaco can correctly parse the manifest.
Currently, the supported manifest version is 1.0.
The release notes will contain details if the manifest is extended, of if newer versions are released.
All entries under projects specify the projects to deploy by Monaco.
To specify a project's:
name key.path.type key.Give these keys a value.
There are two project types: simple and grouping.
For more details, see Manage a Monaco project.
A simple project represents the default type and is defined by two properties:
name: can't contain any slash characters (/ or \). For example, / or Dynatrace® Software Intelligence Platform, is to be distinguished from file system paths.path: if not stated, the name will be used as the path.
It must always use a forward slash (/) as a separator, regardless of your operating system (Linux, Windows, Mac).A grouping project loads all subfolders of a given path as simple projects. A grouping project offers a simplified way of grouping multiple projects together.
Required name: used as a prefix for the resulting simple project.
A dot (.) will be used as separator of <project.name>.<subfolder_name>.
| A given file structure | With the following project definition | Yields two projects |
|---|---|---|
general/ |
|
|
An environment is a Dynatrace environment.
You can group these environments together in single environment group using the environmentGroups type.
You can apply a configuration to an environmentGroup, which implicitly applies it to all environments within the group.
Grouping pre-production and production environments can be helpful, as shown in the initial manifest.yaml example above.
An environment type consists of name, url, and auth sections.
name: A Monaco-internal name for the given Dynatrace environment.
The name can be any globally unique string.
It must be unique.
url: The URL of the Dynatrace environment.
The environment url definition consists of
typevalueThe environment's url can be defined directly in the manifest or referenced via an environment variable.
url:type: valuevalue: "https://<YOUR-ENV-ID>.apps.dynatrace.com"
url:type: environmentvalue: YOUR_URL_ENV_VAR
auth: The Dynatrace API authentication method.
It defines all the information required for authenticated use of the Dynatrace API.
Because these configurations are sensitive, the Dynatrace Monaco CLI doesn't allow you to define them directly, but always loads them from the environment variables. Make these secrets available as environment variables by following the instructions for your operating system or CI/CD tool.
The auth section supports the following authentication methods:
token: an access token for general configuration and settings.platformToken or oAuth: a platform token or OAuth client for the Dynatrace Platform APIs, such as automation workflows, documents, and Grail buckets.You can define a token together with either a platformToken or an oAuth client for the same environment, but you can't define both platformToken and oAuth.
Access tokens and platform tokens are not interchangeable. Each authenticates against different Dynatrace APIs and must be referenced in its own field of the auth section.
The following examples show how to reference each authentication method. In each case, the name value is the name of the environment variable that holds the secret, not the secret itself.
auth:token:name: ACCESS_TOKEN
Access tokens for the Dynatrace Monaco CLI always require at least the Access problem and event feed, metrics, and topology (DataExport)—API v1 permission to query general information about your environment.
In most cases, you need an access token with at least these permissions:
DataExport)—API v1ReadConfig)—API v1WriteConfig)—API v1settings.read)—API v2settings.write)—API v2Each available configuration type requires specific permissions. For details, see Monaco API support and access permission handling.
For general information on access token authentication, see Dynatrace API - Tokens and authentication.
To access a Dynatrace Platform environment, a platform token or an OAuth client is required.
Each available type of platform configuration requires specific scopes. For details, see Monaco API support and access permission handling.
Generally, platform tokens and OAuth clients for the Dynatrace Monaco CLI should have at least these scopes:
app-engine:apps:run)—This permission is required to access Dynatrace Platform metadata endpoints.settings:objects:read)settings:objects:write)settings:schemas:read)The actually required scopes depend on the resources to be managed by the Dynatrace Monaco CLI.
To create a platform token or an OAuth client for the Dynatrace Monaco CLI, see Create a platform token for the Dynatrace Monaco CLI and Create an OAuth client for the Dynatrace Monaco CLI.
The configuration files consist of:
The configuration YAML file contains basic information about the configuration to deploy. This includes the configuration name, the location of the template file, and the parameters available in the template file. Parameters can be overwritten based on the currently deployed group or environment.
The JSON template file contains the payload that will be uploaded to the Dynatrace API endpoints.
It allows you to reference all defined configuration parameters via {{ .PARAMETER_NAME }} syntax.
| config.yaml | slo-cpu-usage.json |
|---|---|
|
|
The Dynatrace Monaco CLI uses Go templates, which allow you to define more complex templates. Still, we recommend keeping templates simple—referencing variables via {{ .PARAMETER_NAME }} should be sufficient.
The JSON files that can be uploaded with Monaco are the JSON objects that the respective Dynatrace APIs accept/return. Adding a new configuration is generally done via the Dynatrace UI unless you know the configuration JSON structures well enough to prefer writing them. You can download the configurations via the respective GET endpoint defined in the Dynatrace Configuration API, and they should be cleaned up for auto-deployment.
id.
The entity can be created or updated if one with the same name exists.
The name must be defined as a variable.Some configuration types have special requirements for their JSON payloads and might need manual modification to be used with Configuration as Code.
A deletefile is a YAML document that lists the configurations that are to be deleted by the delete command.
By default, this file is named delete.yaml.
You can manually create a delete file, or generate it with monaco generate deletefile.
Within the file, each entry can reference a configuration directly via its Dynatrace object ID, or indirectly via coordinates.
Monaco can delete objects that are created by, and/or onboarded to, Monaco. It cannot delete entries for Dashboard share settings or OpenPipeline configurations.
Objects are deleted by referencing the configuration, either
monaco delete, you first need to deploy the project.To reference directly, define the following parameters:
type: The configuration type.objectId: The ID of the Dynatrace configuration object.An example structure is shown in the code block below.
delete:- type: slo-v2objectId: origin-object-ID # ID of the configuration from Dynatrace- [other entries...]
The structure of the delete.yml file depends on the configuration type, whether
When using an indirect reference entry, Monaco can only delete documents that it has originally created. Monaco cannot delete documents that have been onboarded.
# delete.yml file for Classic Dynatrace APIdelete:- name: my-mz # name of the configurationtype: management-zone- [other entries ...]
# delete.yml file for Settings 2.0 and Platform APIsdelete:- project: my-projecttype: workflowid: my-workflow- [other entries ...]
Monaco can generate JSON-format schema files for many of Monaco's YAML files, including manifest, configuration, and delete files. For more information about generation, see Generate.
These schema files can be integrated with most common IDEs and advanced editors directly or by using free plugins.
In Visual Studio Code, for example, you can use the YAML extension (YAML Language Support by Red Hat) to associate a specific schema file with the Monaco files.
We recommend modifying your settings.json file with the following contents (replace the <path> placeholder with the appropriate path):
"yaml.schemas": {"file:///<path-to-your-schema-folder>/monaco-config.schema.json": "**/*config*.yaml","file:///<path-to-your-schema-folder>/monaco-manifest.schema.json": "**/*manifest*.yaml","file:///<path-to-your-schema-folder>/monaco-delete-file.schema.json": "**/*delete*.yaml"}
We assume you follow the naming patterns that are used in this documentation and the generated files. If you use different naming patterns for your manifest, config, or delete YAML files, you need to adapt the configuration accordingly.
Because the format of manifest or configuration files may change between versions, regenerate the schema definitions with the current version of Monaco.