Monaco error regarding env-token-name

Output from cmd : “monaco --environments=environments.yaml -p=auto-tagging”

2022-10-30 12:55:32 INFO Dynatrace Monitoring as Code v1.8.5
2022-10-30 12:55:32 INFO Executing projects in this order:
2022-10-30 12:55:32 INFO 1: auto-tagging (0 configs)
2022-10-30 12:55:32 INFO Processing environment test1…
2022-10-30 12:55:32 INFO Deployment summary:
2022-10-30 12:55:32 ERROR Deployment to test1 failed with error!
2022-10-30 12:55:32 ERROR environment variable Monaco_Test not found
2022-10-30 12:55:32 ERROR errors during deployment! Check log

This is my environments.yaml file:

test1:- name: “test1”- env-url: “https://*******.live.dynatrace.com”- env-token-name: “Monaco_Test”

Can anyone please guide me how to set the token in environments.yaml file, am I doing it correctly? I have created the token in Saas with required permissions.

Hi @Sahil2308

You need to add the token to your system as environment variable as explained in the documentation

Yosi_Neuman_1-1667121641054.png

HTH

Yos

Hi @Yosi_Neuman ,

Yes I did mention the API token name in environments.yaml file.

This is my environments.yaml file:

test1:- name: “test1”- env-url: “https://*******.live.dynatrace.com”- env-token-name: “Monaco_Test”

Here “Monaco_Test” is my API token name created in Dynatrace

Do I need to specify the value itself somewhere in yaml?

Hi @Sahil2308

You need to add the token name and value in your system environment variable settings

Yosi_Neuman_1-1667127313084.png

HTH

Yos

Hi @Yosi_Neuman ,

Thanks for the help, this indeed resolved my issue :slightly_smiling_face: . I am using Ubuntu so I hve set the env in /etc/environment file.

I have run the cmd: “monaco -e=environments.yaml -p=auto-tag1”

o/p:

You are currently using the old CLI structure which will be used by
default until monaco version 2.0.0

Check out the beta of the new CLI by adding the environment variable
“NEW_CLI”.

We can’t wait for your feedback.

2022-10-30 18:17:14 INFO Dynatrace Monitoring as Code v1.8.5
2022-10-30 18:17:15 INFO Executing projects in this order:
2022-10-30 18:17:15 INFO 1: auto-tag1 (0 configs)
2022-10-30 18:17:15 INFO Processing environment test1…
2022-10-30 18:17:15 INFO Processing project auto-tag1…
2022-10-30 18:17:15 INFO Deployment summary:
2022-10-30 18:17:15 INFO Deployment finished without errors
2022-10-30 18:17:15 INFO There is no delete file delete.yaml found in delete.yaml. Skipping delete config.

But I cannot see the changes(creation of auto-tagging rule) in Tenant.

This is my file dir:

root@sahil-VirtualBox:/opt/monacoDir1# tree .
.
├── auto-tag1
│   ├── auto-tag.yaml
│   └── Host-Group-Name.json
├── environments.yaml
├── monaco
└── README.md

contents of auto-tag.yaml file:

config:- Host-Group-Name: “Host-Group-Name.json”
Host-Group-Name:- name: "Resistance is futile!"contents of Host-Group-Name.json file:{
“name”: “{{ .name }}”,
“rules”: [
{
“type”: “HOST”,
“enabled”: true,
“valueFormat”: “MonacoTest”,
“propagationTypes”: [],
“conditions”: [
{
“key”: {
“attribute”: “HOST_DETECTED_NAME”
},
“comparisonInfo”: {
“type”: “STRING”,
“operator”: “EQUALS”,
“value”: “AZSG-D-DTS3W”,
“negate”: false,
“caseSensitive”: true
}
}
]
}
]
}Everything seems alright :thinking:.

Hey, thanks for the help, got the issue resolved. :blush: