16 Aug 2022 09:47 PM - last edited on 21 Aug 2024 08:31 AM by Michal_Gebacki
Hello,
I tried to setup MW as bellow
[
{
"schemaId": "builtin:alerting.maintenance-window",
"scope": "environment",
"schemaVersion": "2.14",
"value": {
"enabled": true,
"generalProperties": {
"name": "Example Window ZZZZ",
"description": "An example Maintenance window ZZZZ",
"maintenanceType": "UNPLANNED",
"suppression": "DETECT_PROBLEMS_DONT_ALERT",
"disableSyntheticMonitorExecution": false
},
"schedule": {
"scheduleType": "ONCE",
"onceRecurrence": {
"startTime": "18:00:00.00",
"endTime": "19:00:00.00",
"timeZone": "Europe/Berlin"
}
},
"filters": [
{
"entityType": "HOST",
"entityTags": [
"PatchGroup:t1g1"
],
"managementZones": [
"1234567890123455"
]
}
]
}
}
]
but all call of API finish with warning:
Post to Dynatrace failed.; Error `Create failed with code 400and error:
{
"code": 400,
"message": "Validation failed for 2 Validators.",
"constraintViolations": [
{
"path": "builtin:alerting.maintenance-window/0/schedule/onceRecurrence/startTime",
"message": "Given property 'startTime' with value: '20:00:00' violates the following constraint: Must be of type local_date_time.",
"parameterLocation": "PAYLOAD_BODY",
"location": null
},
{
"path": "builtin:alerting.maintenance-window/0/schedule/onceRecurrence/endTime",
"message": "Given property 'endTime' with value: '21:00:00' violates the following constraint: Must be of type local_date_time.",
"parameterLocation": "PAYLOAD_BODY",
"location": null
}
]
}`
I tested many of format of time and datetime - all wrong.
Any idea?
.
Solved! Go to Solution.
17 Aug 2022 08:31 AM
OK, I learn that:
local_date_time type follows the following format: year-month-day-hour-minute-second, so for your configuration you will need to adapt the schedule to something like:
startTime: "2022-08-17T20:00:00"