Navigation

Maintenance Windows

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project id. For existing groups, your group/project id remains the same. This page uses the more familiar term group when referring to descriptions. The endpoint remains as stated in the document.

The maintenanceWindows resource turns off alert notifications for specified alert types for a period of time, to allow maintenance to occur.

Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

Endpoints

Get All Maintenance Windows

Get all maintenance windows with end dates in the future.

GET /groups/GROUP-ID/maintenanceWindows

Get a Single Maintenance Window by its ID

GET /groups/GROUP-ID/maintenanceWindows/WINDOW-ID

Create a Maintenance Window

POST /groups/GROUP-ID/maintenanceWindows

The resource requires the following fields:

  • alertTypeNames
  • startDate
  • endDate

Update a Maintenance Window

PATCH /groups/GROUP-ID/maintenanceWindows/WINDOW-ID

Delete a Maintenance Window

DELETE /groups/GROUP-ID/maintenanceWindows/WINDOW-ID

Sample Entity

The following is a sample return document.

{
  "id" : "5628faffd4c606594adaa3b2",
  "groupId" : "541ed2009436399a1f54e01b",
  "created" : "2015-10-22T15:04:31Z",
  "updated" : "2015-10-22T15:04:31Z",
  "startDate" :"2015-10-23T22:00:00Z",
  "endDate" : "2015-10-23T23:30:00Z",
  "alertTypeNames" : [ "REPLICA_SET" ],
  "description" : "new description",
  "links" : []
}

Entity Fields

Name Type Description
id string unique identifier
groupId string Unique identifier of the group that owns this maintenance window config
created date When this maintenance window config was created.
updated date When this maintenance window config was last updated.
startDate date Start date for the maintenance window.
endDate date The end date for the maintenance window. It must be after startDate.
alertTypeNames string array Alert types to silence during maintenance window. For example: HOST, REPLICA_SET, CLUSTER, AGENT, BACKUP
description string Description of the maintenance window. This field might not exist.

Examples

Get All Maintenance Windows

Get all maintenance windows for a group with start dates in the future.

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET "https://<ops-manager-host>/api/public/v1.0/groups/541ed2009436399a1f54e01b/maintenanceWindows"

Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "results" : [ {
    "alertTypeNames" : [ "BACKUP" ],
    "created" : "2015-10-22T15:04:31Z",
    "description" : "new description",
    "endDate" : "2015-10-23T23:30:00Z",
    "groupId" : "541ed2009436399a1f54e01b",
    "id" : "5628faffd4c606594adaa3b2",
    "startDate" : "2015-10-23T22:00:00Z",
    "updated" : "2015-10-22T15:04:31Z",
    "links" : []
  }, {
    "alertTypeNames" : [ "AGENT", "BACKUP" ],
    "created" : "2015-10-22T15:40:09Z",
    "endDate" : "2015-10-23T23:30:00Z",
    "groupId" : "541ed2009436399a1f54e01b",
    "id" : "56290359d4c606594adaafe8",
    "startDate" : "2015-10-23T22:00:00Z",
    "updated" : "2015-10-22T15:40:09Z",
    "links" : []
  } ],
  "links" : [],
  "totalCount" : 2
}

Get a Single Maintenance Window by its ID

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET "https://<ops-manager-host>/api/public/v1.0/groups/541ed2009436399a1f54e01b/maintenanceWindows/5628faffd4c606594adaa3b2"

Response

Response Header

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

Response Body

{
  "alertTypeNames" : [ "AGENT", "BACKUP" ],
  "created" : "2015-10-22T15:04:31Z",
  "description" : "new description",
  "endDate" : "2015-10-23T23:30:00Z",
  "groupId" : "541ed2009436399a1f54e01b",
  "id" : "5628faffd4c606594adaa3b2",
  "startDate" : "2015-10-23T22:00:00Z",
  "updated" : "2015-10-22T15:04:31Z",
  "links" : []
}

Create a Maintenance Window

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET -X POST -H "Content-Type: application/json" "https://<ops-manager-host>/api/public/v1.0/groups/541ed2009436399a1f54e01b/maintenanceWindows" --data '
{
  "startDate" :"2015-10-23T22:00:00Z",
  "endDate" : "2015-10-23T23:30:00Z",
  "alertTypeNames" : [ "REPLICA_SET" ],
  "description" : "new description"
}'

Response

HTTP/1.1 200 Created

{
  "alertTypeNames" : [ "REPLICA_SET" ],
  "created" : "2015-10-22T20:49:35Z",
  "description" : "my description",
  "endDate" : "2015-10-23T23:30:00Z",
  "groupId" : "541ed2009436399a1f54e01b",
  "id" : "56294bdfd4c643eef5176b73",
  "startDate" : "2015-10-23T22:00:00Z",
  "updated" : "2015-10-22T20:49:35Z",
  "links" : []
}

Update a Maintenance Window

Request

curl --user "{username}:{apiKey}" --digest \
 --header "Accept: application/json" \
 --include \
 --request GET -X PATCH -H "Content-Type: application/json" "https://<ops-manager-host>/api/public/v1.0/groups/541ed2009436399a1f54e01b/maintenanceWindows/562909fcd4c606594adab8de" --data '
{
  "alertTypeNames" : [ "HOST", "REPLICA_SET" ]
}'

Response

HTTP/1.1 201 OK

{
  "alertTypeNames" : [ "HOST", "REPLICA_SET" ],
  "created" : "2015-10-22T20:49:35Z",
  "description" : "my description",
  "endDate" : "2015-10-23T23:30:00Z",
  "groupId" : "541ed2009436399a1f54e01b",
  "id" : "56294bdfd4c643eef5176b73",
  "startDate" : "2015-10-23T22:00:00Z",
  "updated" : "2015-10-23T16:11:49Z",
  "links" : []
}

Delete a Maintenance Window

Request

curl -i --digest -u "username:apiKey" -X DELETE "https://<ops-manager-host>/api/public/v1.0/groups/541ed2009436399a1f54e01b/maintenanceWindows/562909fcd4c606594adab8de"

Response

HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}

This endpoint does not return a response body.