cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Monaco Problem Notification Email List

AsafAx
Participant

Hello community,

I'm trying to deploy a problem notification (email integration) configuration using Monaco, but can't figure out what the correct syntax is for the "recipients" (a list of emails) in the .json file.

When trying to deploy, I get this output:

...
Deployment failed - Dynatrace API rejected HTTP request / JSON data: HTTP send request https://{environmentid}.live.dynatrace.com/api/v2/settings/objects failed after 15 retries: (HTTP 400) (HTTP 400): [{"code":400,"error":{"code":400,"message":"Validation failed for 1 Validators.","constraintViolations":[{"path":"builtin:problem.notifications/0/emailNotification/recipients/0","message":"Given property 'recipients/0' with value: 'email1@mail.com','email2@mail.com','email3@mail.com' violates the following constraint: Email address is not Valid.","parameterLocation":"PAYLOAD_BODY","location":null}]},"invalidValue":{"alertingProfile":"XXXXXXXXXXXXX","displayName":"XXXXXX","emailNotification":{"bccRecipients":[],"body":"{ProblemDetailsHTML}","ccRecipients":[],"notifyClosedProblems":true,"recipients":["email1@mail.com','email2@mail.com','email3@mail.com"],"subject":"{State} Problem {ProblemID}: {ImpactedEntity}"},"enabled":true,"type":"EMAIL"}}]
...

 

The environment variable I have saved and try to load into the .json looks like this
"email1@mail.com", "email2@mail.com", "email3@mail.com"

but I can't figure out how to format it properly for the .json file.

 

 

Here is my problem-notif-id.json:

{
    "enabled": true,
    "type": "EMAIL",
    "displayName": "{{.name}}",
    "alertingProfile": "{{.alertingProfileId}}",
    "emailNotification": {
      "recipients": [
        "{{.recipients}}"
      ],
    "subject": "{State} Problem {ProblemID}: {ImpactedEntity}",
    "notifyClosedProblems": true,
    "body": "{ProblemDetailsHTML}"
    }
}

 

 

I've tried looking through the community, documentation, and the "Configuration as Code Samples" on GitHub with no luck: 

https://github.com/Dynatrace/dynatrace-configuration-as-code-samples/tree/main/basic-templates-monac...

 

Thanks for the help,

Asaf

 

 

Asaf Axelrod
1 REPLY 1

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

I would use list parameter in YAML file.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Featured Posts