Monitor Changes to the State of a Metric

get

/monitoring/monitoring/{idDomainName}/.customer/api/v1/notificationPollingInfo

Request

Path Parameters
Header Parameters
  • Basic Authentication credentials. The user must be located in the identity domain name specified by the header X-ID-TENANT-NAME.
  • Set to the identity domain ID where the user specified in the Authorization header resides.
Back to Top

Response

Supported Media Types

200 Response

successful operation
Body ()
Root Schema : NotificationPollingInfo
Type: object
Show Source
Nested Schema : LongPollInfo
Type: object
Show Source
Nested Schema : notifications
Type: array
Show Source
Nested Schema : PollResult
Type: object
Show Source
Nested Schema : MetricThresholdEvent
Type: object
Show Source
Nested Schema : MetricThreshold
Type: object
Show Source
Nested Schema : MetricThresholdAlertAction
Type: object
Show Source
  • Specify the type of alert notification to be sent. By default, the channelType attribute is set to NOTIFICATION_MESSAGE. In this case, an email notification is sent to the service administrator of the requested resource when an event occurs.

    The channelType attribute can also be set to PUSH_TO_CLIENT. In this case, notification messages are delivered to the process polling for state changes.
  • Specify the alert action type.
Nested Schema : MetricThresholdCondition
Type: object
Show Source
Nested Schema : MetricTarget
Type: object
Show Source
Nested Schema : MetricSeries
Type: object
Show Source
Nested Schema : MetricType
Type: object
Show Source
Nested Schema : MetricSubject
Type: object
Show Source
Nested Schema : MetricSubjectType
Type: object
Show Source
Nested Schema : MetricUnit
Type: object
Show Source
Nested Schema : properties
Type: array
Properties of the subject.
Show Source
Nested Schema : MetricProperty
Type: object
Show Source
Back to Top

Examples

The following example shows how to monitor changes to the state of a metric by submitting a GET request on the REST resource using cURL. See Use cURL.

To monitor changes to the state of a metric, you must:
  1. First make a request to get the long poll URL to listen to.

  2. Start listening to the long poll URL.

Run the following cURL command to perform the long poll request:

curl -X GET -H "Authorization: Basic d2VibG9naWM6V2VsY29tZTE=" -H "X-ID-TENANT-NAME:mydomain" https://monitoring.us.oraclecloud.com/monitoring/mydomain/.customer/api/v1/notificationPollingInfo HTTP/1.1

Example of Response Header

The following shows an example of the response header.

HTTP/1.1 200 OK
Date: Tue, 02 Feb 2016 18:32:30 GMT
Content-Type: application/json

Example of Response Body

The following example shows the contents of the response body in JSON format:

{
  "notifications": [],
  "nextLongPollInfo": {
    "pollResult": {
      "canonicalLink": "http://monitoring.us.oraclecloud.com:8003/notification/.tpolling/.common/.oracleNotification/v1?accessToken=860C2D6D666FA56E7F6947CCACCCA5D8=0=http%3A%2F%2Fmonitoring.us.oraclecloud.com%3A8003%2Fmonitoring%2Fmydomain%2F.customer%2Fapi%2Fv1%2FnotificationPollingInfo%2FtokenUpdate=e0d33142-044f-4db0-a9e0-b3e0a7b2521f=MTQ1NDQzNjgzOTk1OC0xLTE0NTQ0MzY4Mzk5NTg%3D=1454436839958"
    },
    "waitTimeBeforePolling": 60,
    "httpRequestTimeoutHint": 300
  }
}

To receive notification of metric state changes you must iteratively:

  1. Wait for waitTimeBeforePolling seconds.

  2. Perform a GET request on the nextLongPollInfo.pollResult.canonicalLink.

Run the following cURL command to start listening to the long poll URL:

GET curl -X GET -H "Authorization: Basic d2VibG9naWM6V2VsY29tZTE=" -H "X-ID-TENANT-NAME:mydomain" -H "Content-Type: application/json" http://monitoring.us.oraclecloud.com:8003/notification/.tpolling/.common/.oracleNotification/v1?accessToken=860C2D6D666FA56E7F6947CCACCCA5D8=0=http%3A%2F%2Fslc000xyz.us.oracle.com%3A8003%2Fmonitoring%2Fmydomain%2F.customer%2Fapi%2Fv1%2FnotificationPollingInfo%2FtokenUpdate=e0d33142-044f-4db0-a9e0-b3e0a7b2521f=MTQ1NDQzNjgzOTk1OC0xLTE0NTQ0MzY4Mzk5NTg%3D=1454436839958

Example of Response Header

The following shows an example of the response header.

HTTP/1.1 200 OK
Date: Tue, 02 Feb 2016 18:32:30 GMT
Content-Type: application/json

Example of Response Body

The following example shows the contents of the response body in JSON format:

{
  "notifications": [
    {
      "createdOn": "2016-02-02T18:32:30.239Z",
      "data": {
        {
          "id" : "2b047a03-90a9-2ab3-e053-6a64f10a1d39",
          "identityDomain" : "mydomain",
          "eventType" : "changedToSatisfied",
          "eventStartedOn" : "2016-02-05T16:45:00.000Z",
          "threshold" : {
            "id" : "3e803a5d-8c30-4e33-b53e-1a912de0a55e",
            "target" : {
              "series" : {
                "id" : "2af7d08b-059b-61c2-e053-6a64f10ad5d2",
                "metricType" : {
                  "id" : "compute.CPU.PERCENT",
                  "name" : "cpuPercent",
                  "displayName" : "CPU Percentage",
                  "shortDisplayName" : "CPU",
                  "importName" : "CPU.PERCENT",
                  "unit" : {
                    "id" : "PERCENT"
                  },
                  "subjectType" : {
                    "id" : "compute.vm"
                  }
                },
                "subject" : {
                  "id" : "2af7d08b-0537-61c2-e053-6a64f10ad5d2",
                  "subjectType" : {
                    "id" : "compute.vm"
                  },
                  "properties" : [{
                      "name" : "vmLabel",
                      "value" : "USDEVSS0$403B95B2-45DB-4BB8-A69D-40DC303573D7"
                    }, {
                      "name" : "vmType",
                      "value" : "Compute"
                    }, {
                      "name" : "vmUuid",
                      "value" : "2AF7D08B053761C2E0536A64F10AD5D2"
                    }, {
                      "name" : "vmZone",
                      "value" : "COMPUTE-US2-Z18"
                    }
                  ],
                  "isDeleted" : false
                }
              }
            },
            "name" : "VM1 High CPU Alert",
            "condition" : {
              "stats" : "avg",
              "operation" : ">=",
              "value" : 70.0,
              "periodDuration" : "PT5M",
              "periodCountToSatisfy" : 1,
              "periodCountToUnsatisfy" : 1
            },
            "alertAction" : {
              "type" : "postToEndPoint",
              "url" : "http://example.us.examplecompany.com:8989"
            }
          }
        }
      },
      "notificationTypeId": "default"
    }
  ],
  "nextLongPollInfo": {
    "pollResult": {
      "canonicalLink": "http://monitoring.us.oraclecloud.com:8003/notification/.tpolling/.common/.oracleNotification/v1?accessToken=939FAD72573AEA39E6D17613DCBACADC=2261610=http%3A%2F%2Fslc00xyz.us.oracle.com%3A8003%2Fmonitoring%2Facme%2F.customer%2Fapi%2Fv1%2FnotificationPollingInfo%2FtokenUpdate=e0d33142-044f-4db0-a9e0-b3e0a7b2521f=MTQ1NDQzNzk1NDMxMy0xLTE0NTQ0MzgxMTg5OTM%3D=1454437951332"
    },
    "waitTimeBeforePolling": 5,
    "httpRequestTimeoutHint": 300
  },
  "canonicalLink": "/notification/.tpolling/.common/.oracleNotification/v1?accessToken=860C2D6D666FA56E7F6947CCACCCA5D8=0=http%3A%2F%2Fmonitoring.us.oraclecloud.com%3A8003%2Fmonitoring%2Facme%2F.customer%2Fapi%2Fv1%2FnotificationPollingInfo%2FtokenUpdate=e0d33142-044f-4db0-a9e0-b3e0a7b2521f=MTQ1NDQzNjgzOTk1OC0xLTE0NTQ0Mzc1ODM3OTc%3D=1454437768932"
}

Note:

  • Multiple entries can be returned in the notifications list.

  • The threshold element indicates the threshold associated with the current event.

  • By default, there is a limit of 50 thresholds per identity domain.

Back to Top