Each configuration YAML file contains a list of configurations to be deployed.
A basic configuration YAML file looks like this:
configs:- id: test-dashboardtype:api: dashboardconfig:name: Test Dashboardtemplate: dashboard.jsonparameters:owner: Test User
As you can see, the top-level element is configs
. Its value is a list of configurations. Each configuration requires the following fields: id
, type
, and config
.
It's also possible to override values from config
on the environment and environment-group level. For this, there exist the optional groupOverrides
and environmentOverrides
fields.
The id
field identifies a config within the configurations. It has to be unique for the same configType and project. So it's possible to have, for example, two dashboards with the same id
in two different projects. Note that the field is only local to the Dynatrace Monaco CLI. It has nothing to do with the ID provided by the Dynatrace API. One important use case for this id
is when using reference parameters.
The type
field defines the type of the Dynatrace configuration.
A type
can be one of the supported Configuration types.
An API type
can be defined as:
type:api: dashboard
or in shorthand form as:
type: dashboard
See the list of supported configuration types for all possible api
values.
Some API-type configurations have a parent-child relationship with another configuration. Such configurations require a scope
field that points to the parent configuration.
Parameter scope
can be defined as either a value, reference, or environment parameter.
Because such configurations are made in the scope of their parent API, referencing the parent configuration's ID is a useful way of configuring entities after they've been created via the Dynatrace Monaco CLI.
In the sample below, a mobile application is configured, and then key user actions for this application are made.
configs:- id: mobile-application-idconfig:name: my-mobile-apptemplate: mobile-app.jsonskip: falsetype:api: application-mobile- id: MyKuatype:api:name: key-user-actions-mobiletemplate: kua.jsonscope:configId: mobile-application-idconfigType: application-mobileproperty: idtype: reference
Settings are defined by their schema
, scope
, and an optional schemaVersion
.
A settings type
can be defined as:
type:settings:schema: builtin:tags.auto-taggingscope: environment
The schema
and schemaVersion
are simply defined as text.
Parameter scope
can be defined as either a value, reference, or environment parameter.
In the sample above, it's defined as a shorthand value parameter with the value of environment
, creating a setting in the scope of the entire Dynatrace environment.
Because many settings are made in the scope of a Dynatrace entity, referencing another configuration's ID is a useful way of configuring entities after they've been created via the Dynatrace Monaco CLI.
In the sample below, a web application is configured, and then settings for this application are made.
configs:- id: MyApptype:api: application-webconfig:name: My Sample Web Applicationtemplate: application.json- id: MyApp_RUMSettingstype:settings:schema: builtin:rum.web.enablementscope:type: referenceconfigType: application-webconfigId: MyAppproperty: idconfig:name: MyApp_RUMSettingstemplate: rum-settings.json
As you can see, the scope
of the rum.web.enablement
setting is a reference to the web application.
Dynatrace Monaco CLI version 2.14.0+
Parameter insertAfter
must be defined as a reference parameter.
This parameter can be utilized to enforce a specific ordering of Settings 2.0 objects. During deployment, Monaco ensures that the settings object is deployed after the referenced one.
type:settings:schema: builtin:container.monitoring-ruleschemaVersion: 0.0.1scope: environmentinsertAfter:configId: c2314e1b-409c-3eaf-9efa-5dc593b14aff # Monaco config idproperty: id # Dynatrace id property of the referenced config (must be "id")type: reference # reference type parameter (must be "reference")
Dynatrace Monaco CLI version 2.6.0+
An automation type
can be defined as:
type:automation:resource: workflow # or business-calendar, or scheduling-rule
Indicate the desired automation resource using the resource
field. Keep in mind that each resource requires distinct OAuth permissions.
This example config.yaml
file includes an automation configuration for workflow creation:
type:automation:resource: workflowconfig:name: 'My first workflow managed by the Dynatrace Monaco CLI'template: workflow.json
The API supports a query parameter called adminAccess
that can be used to fetch all workflow resources on a given tenant, not only those bound to the user that was used to create the OAuth client.
To use this feature, the OAuth client needs to have the scope automation:workflows:admin
configured.
automation:workflows:admin
permission using the following policy statement:
ALLOW automation:workflows:admin;
By default, the Dynatrace Monaco CLI will try to use this flag when accessing the API. If it fails, the operation will be repeated without the flag, but you will only be able to access the workflows created by your own user.
Workflows use the same templating characters as the Dynatrace Monaco CLI ({{ ... }}
), so you need to escape the templating characters used in your workflow JSONs as follows:
{{
becomes {{`{{`}}
}}
becomes {{`}}`}}
When using the download command, these characters will be escaped automatically.
Dynatrace Monaco CLI version 2.9.0+
A Bucket type
can be defined as:
type: bucket
Dynatrace Monaco CLI version 2.15.0+
Dynatrace Platform Documents - like Dashboards and Notebooks - can be managed by Monaco with the document
type.
A document type
can be defined as:
type:document:kind: dashboard # type of document, e.g. "dashboard" or "notebook"private: true # optional
You can use the optional field private
to specify whether the document is publicly visible or not.
private
field.Dynatrace Monaco CLI version 2.15.0+
Dynatrace OpenPipeline configurations can be managed by Monaco with the openpipeline
type.
An OpenPipeline type
can be defined as:
type:openpipeline:kind: bizevents # id of openpipeline configuration (for example, "bizevents", "events", "logs", "spans", or "metrics")
The kind
field specifies the ID of a pre-existing OpenPipeline configuration. Monaco can retrieve and update configurations, but it cannot create new ones or delete them.
The config
field offers the following fields:
name
—Name used to identify objects in the Dynatrace APItemplate
—Defines templating file used to render the request to the Dynatrace API (for details, see Manage a Dynatrace Monaco CLI project)skip
—If set to true
, the Dynatrace Monaco CLI will not deploy this configurationparameters
—List of parameters available in the templateoriginObjectId
—Set on download, this field defines the ID of the Dynatrace configuration object from which this config originates. It's used on deployment as an additional identifier.name
property is mandatory and needs to be defined for all configuration types.name
property is required only for API-type configurations and is optional for other configuration types.For configurations of type API, the name
is used to identify configurations in a Dynatrace environment and ensure that they are updated when they already exist.
For this, the name
needs to be used in the JSON template to fill the specific name property of the configuration. Usually, this is also just name
, but for some configurations, this may differ; see the special cases described for JSON templates and refer to the API documentation if in doubt.
When downloading, names are automatically extracted and placed in the YAML for you.
When referencing the name
in a JSON template, it needs to be used as is, with no additional text or characters around it.
The name property in JSON should always be used like this:
"{{ .name }}"
If you encounter issues with configurations not being created several times instead of updated, check to make sure that your reference to the name does not contain any accidental spaces or other characters that make what is sent to Dynatrace in the JSON different from the name defined in the YAML.
The name
property isn't used to identify Dynatrace objects. Instead, the configuration's coordinate (a combination of project, type, and configuration ID) or originObjectId
(if present) is used.
The name
property can still be used and, for some types, is automatically extracted when downloading.
The skip
field makes it possible to omit (skip) deployment of a certain configuration. If skip
is set to true
, the Dynatrace Monaco CLI will not deploy the configuration.
The skip
field behaves like a parameter and can be defined as either a value or environment parameter. Usually, it's defined directly as a shorthand value as can be seen in several examples.
It's often useful in combination with environment overrides, where you want to deploy a configuration to one environment but exclude it from another.
Parameters are used to provide values in configuration templates. They are defined as YAML objects with a type
entry. This type
then further decides how the parameter object is interpreted. One important property of parameters is that they are lazy: the value of a parameter is only evaluated if it's referenced by a configuration that is going to be deployed.
The following parameter types are available:
The value parameter is the simplest form of a parameter. Besides the type
property, it also requires the value
property. You can define whatever you like as the value, even nested maps. This value is then accessible in the template file.
Because value
parameters are the most common parameter type, there is a special short-form syntax to define them: you can simply provide the value if your parameter is neither an array nor a map.
For example:
parameters:threshold: 15complexThreshold:type: valuevalue:amount: 15unit: sec
In the template of this config, you could then access the threshold
parameter via {{ .threshold }}
. To access, for example, the amount
of the complexThreshold
, you could use {{ .complexThreshold.amount }}
.
Parameters of type environment
allow you to reference an environment variable. The name of the environment variable to reference is defined via a name
property.
You can provide a default value (via the default
property) for cases in which the environment variable is not present.
If the default
property is not set and the env variable is missing, the parameter cannot be resolved. This will fail the deployment.
This is the case only if the parameter is relevant to be deployed. Parameters not referenced by the config to deploy are not evaluated.
Example:
parameters:owner:type: environmentname: OWNERdefault: "-"target:type: environmentname: TARGET
In the above example:
owner
parameter will evaluate to the value of the OWNER
environment variable. If the environment variable is not present, it will evaluate to value -
.target
parameter will evaluate to the value of the TARGET
environment variable. It will fail the deployment if the variable is not set at deployment time.Because it's often necessary to reference a property of another configuration, the Dynatrace Monaco CLI offers a special reference
parameter that allows one configuration to depend on almost any parameter of another configuration.
To use the reference
type parameter, provide the following required fields:
project
—The project name of the configuration the parameter is referencing.
configType
—The type of configuration that the parameter is referencing.
For configurations of type settings
, the value of configType
should correspond to the schema ID (for example, builtin:tags.auto-tagging
).
configId
—The ID of the configuration that the parameter is referencing.
property
—The field name to determine the value of the parameter.
If property
is set to id
or name
, the parameter will resolve to the corresponding Dynatrace object's actual ID or name.
In the example below, the value of mz_id
will be the Dynatrace object ID of the configuration of type management-zone
with ID management-zone-config
from the project-1
project:
parameters:mz_id:type: referenceproject: project-1configType: management-zone # or builtin:management-zones if referencing "settings" type configurationsconfigId: management-zone-configproperty: id
The Dynatrace Monaco CLI will make sure that the deployment of configuration is ordered and that the dependent config is deployed first.
If you configure a cycle of dependencies, the deployment will fail with an error.
Because reference
parameters are one of the most common parameter types, there is a special short-form syntax to define them as an array:
[ <project>, <configType>, <configId>, <property> ]
mz_id: ["project-1", "management-zone", "main", "id"]
Note that in this case, no type
is needed, as the type is inferred based on the syntax.
It's possible to omit some reference fields. In this case, they will be filled with the same value as the current config.
Generally, you might want to use this for simplicity's sake when referencing configuration within the same project
- simply omit the field.
parameters:mz_id:type: referenceconfigType: management-zoneconfigId: mainproperty: id
While it's possible to omit configType
and even configId
, note that you can only leave the upper-most level empty and can't leave a gap.
So if configType
is omitted, so must project
.
Below you find a full sample (using shorthand references):
infrastructure/management-zone/config.yaml
configs:- id: maintype:api: management-zoneconfig:name: "Main zone"template: "zone.json"
development/management-zone/config.yaml
configs:- id: developmenttype:api: management-zoneconfig:name: "Development zone"template: "zone.json"
development/dashboard/config.yaml
configs:- id: a_dashboardtype:api: dashboardconfig:name: "Overview dashboard"template: "dashboard.json"- id: overviewtype:api: dashboardconfig:name: "Overview dashboard"template: "dashboard.json"parameters:zoneId: ["infrastructure", "management-zone", "main", "id"]devZoneId: ["management-zone", "development", "id"] # inferred project 'development'otherDashboard: ["a_dashboard", "id"] # inferred project 'development' and type 'dashboard'
The compound parameter is a parameter composed of other parameters of the same config. This parameter requires two properties:
format
stringreferences
to all referenced parameters.The format
string can be any string. To use parameters in it, use the syntax {{ .parameter }}
, where parameter
is the name of the parameter to be filled in.
For example:
parameters:example:type: compoundformat: "{{ .greeting }} {{ .entity }}!"references:- greeting- entitygreeting: "Hello"entity: "World"
This would produce the value Hello World!
for example
. Compound parameters can also be used for more complex values, such as in the following example:
parameters:example:type: compoundformat: "{{ .resource.name }}: {{ .resource.percent }}%"references:- resourceprogress:type: valuevalue:name: "Health"percent: 40
This would produce the value Health: 40%
, for example.
Even though referenced parameters can only be from the same config, by using the reference parameter, it's possible to make a compound parameter with other configs. This is also true for environment variables.
parameters:example:type: compoundformat: "{{ .user }}'s dashboard is {{ .status }}"references:- user- statususer:type: environmentname: USER_NAMEstatus:type: referenceconfigType: dashboardconfigId: dashboardproperty: status
Parameters of type list
allow you to define lists of value parameters. When written into a template, these are written as a JSON list surrounded by square brackets and separated by commas.
This type of parameter is generally useful when you require a simple list of things, such as emails or identifiers, that can be filled with any kind of value parameter.
For example:
parameters:recipients:type: listvalues:- first.last@company.com- someone.else@company.comgeolocations:type: listvalues: ["GEOLOCATION-1234567", "GEOLOCATION-7654321"]
As shown in the example above, you can define the list values either line by line or as an array in YAML.
When using a list parameter value in a JSON template, make sure to just reference the value without any extra brackets.
{"emails": {{ .recipients }}}
This differs from the sometimes used string list in v1, for which the template needed to include square brackets (for example, "emails": [ {{ .recipients }} ]
). When such lists are encountered when converting a v1 configuration, templates are automatically updated.
Dynatrace Monaco CLI version 2.14.0+
Parameters of type file
allow you to load content from a file on disk.
Example:
parameters:comment: "// hello special comment"myWf:type: file # parameter type "file"path: "myWf.js" # relative path to the filereferences: # other parameters names referenced in the content of the file- comment
In the given example, the parameter named myWf
will be dynamically resolved to include the content of the file named myWf.js
, relative to the current configuration location. This parameter can then be referenced within the JSON template as follows:
{"script" : {{ .myWf }}}
Moreover, you can include references to other parameters within the content of the referenced file. Each reference parameter must be defined as a separate parameter and listed in the references section of the file parameter type.
In the given example, an additional parameter named comment
can be referenced within the content specified by the file parameter using the notation {{ .comment }}
.
When using the Dynatrace Monaco CLI to download existing configurations from Dynatrace, the created YAML files contain an originObjectId
for some configuration types.
This holds the ID of the specific Dynatrace object that was downloaded. It's used when the downloaded configuration is again deployed to the same Dynatrace environment to ensure that the existing object is correctly updated.
For example, an already existing Settings 2.0 object will be extended with the data used to correctly identify it.
Note that originObjectId
is optional, and you generally don't need to care about it or modify it.
In general, all YAML values are escaped before being added to a configuration uploaded to Dynatrace. This ensures that fully filled templates are valid JSON when uploading. Any newlines, special characters such as double quotes, and so on are escaped.
parameters:name: "Dev"example1: "This is \\n already escaped"example2: "This will \n be escaped"example3: This "will" be escaped tootext: |This will alsobe escaped
There are many cases in which a configuration is similar but not the same between environments. Examples:
To enable this, you can override values of configurations on an environment and environment-group level using the groupOverrides
and environmentOverrides
fields.
Both are generally defined in the same way, differing only in whether they're applied to a group or a single environment. You can define the group/environment name to target and any configuration properties to modify.
In the example below, a configuration gets some special configuration applied for two environments, and skip
ensures that the configuration will not be deployed to the production-environments
group:
configs:- id: test-dashboardtype:api: dashboardconfig:name: Test Dashboardtemplate: dashboard.jsonparameters:owner: Test Usercontent: "Some Text ..."environmentOverrides:- environment: dev-env-42override:name: Special Dev Dashboardparameters:content: "Some even better Text!"- environment: staging-env-21override:name: Special Staging Dashboardparameters:content: "Some much better Text!"groupOverrides:- group: production-environmentsoverride:skip: true