Create a Metric Threshold

post

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

For some Oracle Cloud services, service administrators can configure rules to generate alerts when metrics exceed or are under specified thresholds for a specific time period.

You can specify thresholds to monitor and receive alerts about specific metrics for specific instances. The resulting alert can be either an email to the service administrator or a notification message to the process that's polling for changes in the state of the alert threshold.

The specified alert action (email or notification message) is triggered in the following situations:

  • The metric being monitored has crossed the defined threshold and has remained in that state for the period specified in the alert condition.
  • The metric has returned to a value that's within the threshold and has remained in that state for the period specified in the alert condition.

    Request

    Supported Media Types
    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.
    • Must be set to "application/json". The content in an HTTP request body must be encoded in JavaScript Object Notation (JSON).
    • Set to the identity domain ID where the user specified in the Authorization header resides.
    Body ()
    The request payload
    Root 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

    Response

    Supported Media Types

    201 Response

    successful operation
    Headers
    Back to Top

    Examples

    The following example shows how to create a metric threshold by submitting a POST request on the REST resource using cURL. See Use cURL.

    curl -X POST -u joe@example.com:Mypassword1! -H "Authorization: Basic d2VibG9naWM6V2VsY29tZTE=" -H "X-ID-TENANT-NAME:mydomain" -H "Content-Type:application/json" -d "@requestbody.json" https://monitoring.us.oraclecloud.com/monitoring/mydomain/.customer/api/v1/metricThresholds
    

    Example of Request Body

    The following shows an example of the request body content in the requestbody.json file.

    {
     	"name" : "VM1 High Cpu",
    	"target" : {
    	   "series" : {
    		"id" : "13123123-43242342-234234234"
    	   }
            },
            "condition" : {
              "stats" : "avg",
              "operation" : ">=",
              "value" : 70,
              "periodDuration" : "PT10M",
              "periodCountToSatisfy" : 3,
              "periodCountToUnsatisfy" : 2
           }, 
           "alertAction" : {
             "type" : "notification"
         }   
      }

    In the above example, an alert is sent when:

    • The average CPU usage is at or over 70% for three consecutive 10-minute periods.

    • The average CPU usage falls back to below 70% for two consecutive 10-minute periods.

    Another alert is not sent:
    • If a metric remains above the threshold for more than 3 consecutive 10-minute periods and there is no change in the threshold state.

    • If a metric remains below or is within the threshold for more than 2 consecutive 10-minute periods and there is no change in the threshold state.

    The following table illustrates this behavior:

    Time Metric Value Alert Sent (Y/N)

    10:00

    Threshold Created

    N

    10:10

    66

    N

    10:20

    75

    N

    10:30

    84

    N

    10:40

    82

    Y (Avg>=70 for 3 consecutive 10-minute periods)

    10:50

    84

    N

    11:00

    83

    N

    11:10

    81

    N

    11:20

    65

    N

    11:30

    60

    Y (Avg<70 for 2 consecutive 10-minute periods)

    11:40

    63

    N

    Example of Response Header

    The following shows an example of the response header.

    HTTP/1.1 201 Created
    Date: Tue, 08 Mar 2016 12:20:49 GMT
    Content-Type: application/json
    
    Back to Top