Monaco resources

  • Latest Dynatrace
  • Reference
  • 7-min read

To run Monaco, you need to define the deployment manifest, project directories, and resource configuration so that you can manage the resources.

Deployment manifest

The deployment manifest file has three top-level keys: manifestVersion, projects, and environmentGroups.

Sample manifest.yaml

An example of a manifest.yaml:

manifestVersion: 1.0
projects:
- name: infra
path: shared/infrastructure
- name: general
path: general
type: grouping
environmentGroups:
- name: dev
environments:
- name: test-env-1
url:
value: https://<YOUR-DT-DEV-ENV-ID>.apps.dynatrace.com
auth:
token:
name: DEV_TOKEN
oAuth:
clientId:
name: DEV_CLIENT_ID
clientSecret:
name: DEV_CLIENT_SECRET
- name: test-env-2
url:
value: https://<YOUR-DT-SPRINT-ENV-ID>.apps.dynatrace.com
auth:
token:
name: SPRINT_TOKEN
oAuth:
clientId:
name: SPRINT_CLIENT_ID
clientSecret:
name: SPRINT_CLIENT_SECRET
- name: prod
environments:
- name: prod-env-1
url:
type: environment
value: https://<YOUR-DT-PROD-ENV-ID>.apps.dynatrace.com
auth:
token:
name: PROD_TOKEN
oAuth:
clientId:
name: PROD_CLIENT_ID
clientSecret:
name: PROD_CLIENT_SECRET

manifestVersion

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.

Projects

All entries under projects specify the projects to deploy by Monaco.

To specify a project's:

  • Name, provide the name key.
  • Path, provide the path.
  • Type, provide the type key.

Give these keys a value.

There are two project types: simple and grouping.

For more details, see Manage a Monaco project.

simple projects (default type)

A simple project represents the default type and is defined by two properties:

  • Required name: can't contain any slash characters (/ or \). For example, / or Dynatrace® Software Intelligence Platform, is to be distinguished from file system paths.
  • Optional 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).

grouping projects

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 structureWith the following project definitionYields two projects

    general/
    ├── infrastructure/
    └── zones/

    projects:
    - name: general
    path: general
    type: grouping

    general.infrastructure

    general.zones

environmentGroups

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.

Environment definition

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

    • type
    • value

    The environment's url can be defined directly in the manifest or referenced via an environment variable.

    • Defined directly
    url:
    type: value
    value: "https://<YOUR-ENV-ID>.apps.dynatrace.com"
    • Via environment variable
    url:
    type: environment
    value: 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.

Always define a token specifying the access token for general configuration and settings, including the latest Dynatrace Platform.

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.

You need to configure each available configuration type with specific permissions. For more detailed information, see Monaco API support and access permission handling.

For general information on access token authentication, see Dynatrace API - Tokens and authentication.

Each available configuration type requires specific permissions. For detailed information, see Monaco API support and access permission handling.

Generally, platform tokens and OAuth client credentials for Monaco should have at least these scopes:

  • Run apps (app-engine:apps:run) - This permission is required to access Dynatrace metadata endpoints.
  • View settings objects for schema (settings:objects:read).
  • Create settings objects for schema (settings:objects:write).
  • View settings schemas (settings:schemas:read).

The actually required scopes depend on the selected resources that shall be managed by the Monaco CLI.

Configuration files

The configuration files consist of:

  • A configs YAML file, defining parameters, dependencies, name, and template.
  • A JSON template file.

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.yamlslo-cpu-usage.json
configs:
- id: newCpuUsageSLO
config:
parameters:
target: 95
title: myNewSLO
entityScope: HOST-#######
template: slo-cpu-usage.json
skip: false
type: slo-v2
{
"name": "{{ .title }}",
"description": "test SLO for template test",
"tags": [],
"customSli": {
"filterSegments": [],
"indicator": "timeseries sli=avg(dt.host.cpu.usage)\n, by: { \"{{ .entityScope }}\" } \n , filter: in(dt.entity.host, { $hosts })\n | fieldsAdd entityName(dt.entity.host)"
},
"criteria": [
{
"target": {{ .target }},
"timeframeFrom": "now-7d",
"timeframeTo": "now",
"warning": 99
}
]
}

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.

Important additional information for creating new templates

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.

  • A checked-in configuration should not include the entity's id. The entity can be created or updated if one with the same name exists. The name must be defined as a variable.
  • Avoid hardcoded values for environment information, such as references to other auto-deployed entities, tags, and management zones. Reference these as variables.
  • Empty/null values that are optional when creating an object. Most API GET endpoints return more data than is needed to create an object. Many fields are empty or null and can be omitted, such as tileFilters on a dashboard.
The special requirements for JSON templates

Some configuration types have special requirements for their JSON payloads and might need manual modification to be used with Configuration as Code.

Deletefile

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

    • Directly via its Dynatrace object ID.
    • Indirectly via coordinates. If you have downloaded existing configurations and want to download them via monaco delete, you first need to deploy the project.

File structure for direct reference

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-v2
objectId: origin-object-ID # ID of the configuration from Dynatrace
- [other entries...]

File structure for indirect reference

The structure of the delete.yml file depends on the configuration type, whether

  • Classic Dynatrace API
  • Settings 2.0 and Platform APIs

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 API
delete:
- name: my-mz # name of the configuration
type: management-zone
- [other entries ...]
# delete.yml file for Settings 2.0 and Platform APIs
delete:
- project: my-project
type: workflow
id: my-workflow
- [other entries ...]

Schema files

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.

Related tags
Software Delivery