How do I create a maintenance window?

API consumers can create or update maintenance windows for periods of planned system downtime. Each maintenance window can have its own unique identifier.

The following HTTP POST request creates a new maintenance window:

https://{id}.live.dynatrace.com/api/v1/maintenance/

The following example payload creates or updates a maintenance window with the identifier my.unique.mwindow.id.1.

{
	"id" : "my.unique.mwindow.id.1",
	"type": "Planned",
	"description" : "Here comes a detailed description of the maintenance window",
	"suppressAlerts" : true,
	"suppressProblems" : false,
	"scope" : {
		"entities" : [
			"HOST-0B3371A5AC53FF12", "SERVICE-13FA1F30530CDEE1"
		],
		"matches" : [
			{
				"type" : "HOST",
				"tags" : [
					{
						"context" : "AWS",
						"key" : "myTag1",
						"value" : "myValue1"
					},
					{	"key" : "myTag2" }
				]
			},
			{
				"type" : "SERVICE",
				"tags" : [
					{
						"context" : "AWS",
						"key" : "myTag3",
						"value" : "myValue3"
					},
					{	"key" : "myTag4" }
				]
			}
		]
	},
	"schedule" : {
		"type" : "Once",
		"maintenanceStart" : "2017-08-31 12:00",
		"maintenanceEnd" : "2017-08-31 13:00"
	}

}

Result

The above request returns a HTTP 204 response code if the window with the given ID was successfully created or updated.

The following list details the POST payload that is required to create or update a maintenance window:

  • id: The unique identifier that is used to reference the configuration.
  • type: Either Planned or Unplanned.
  • description: A textual description that provides details about the purpose of the maintenance.
  • suppressAlerts: Specifies if you want to disable alerting during maintenance, either true or false.
  • suppressProblems: Completely disables problem detection during maintenance, either true or false.
  • scope: (Optional) Complex JSON object defining the scope of your maintenance window. If no scope is specified, the maintenance applies to your entire environment. The scope is defined either by listing an array of specific monitored entity IDs within the entities attribute, or by specifying a matching rule within the matches attribute. Multiple matching rules can be used to filter by entity types (HOST, SERVICE, etc) and a list of logical and combined tags.
  • schedule: Complex JSON object defining the date and time when the maintenance is scheduled and, optionally, recurrance on a monthly or weekly basis. The schedule type attribute can either be Once, Day, Week, Month. If schedule type Once is specified, the recurrance attribute can't be specified. The attributes maintenanceStart and maintenanceEnd are specified using the following date/time format yyyy-MM-dd HH:mm. The default timezone is UTC.