Start of change

Thresholds: POST

Create a threshold rule.

Availability

Available on all IBM Spectrum Scale™ editions.

Description

The POST thresholds request creates a threshold rule that defines threshold levels for data that is collected through performance monitoring sensors. For more information about the fields in the data structures that are returned, see mmhealth command.

Request URL

https://<IP address or host name of API server>:<port>/scalemgmt/v2/thresholds
where
thresholds
Specifies thresholds as the target of the operation. Required.

Request headers

Content-Type: application/json
Accept: application/json

Request parameters

The following parameters can be used in the request URL to customize the request:
Table 1. List of request parameters
Parameter name Description and applicable keywords Required/optional
body Body of the request that contains the required parameters to be passed on to theIBM Spectrum Scale system to perform the requested operation. Required.

Request data

  {
      "ruleName": "Name",
      "frequency": "Frequency",
      "tags": "Tags",
      "userActionWarn": "Warning message",
      "userActionError": "Error message",
      "type": "metric",
      "metric": "Metric name",
      "metricOp": "Metric operation",
      "sensitivity": "Sensitivity",
      "computation": "value",
      "duration": "Duration",
      "filterBy": "Filter by",
      "groupBy": "Group by",
      "errorLevel": "Error level",
      "warnLevel": "Warning level",
      "direction": "Direction",
      "hysteresis": "Hysterisis"
    }
For more information about the fields in the following data structures, see the links at the end of this topic.
"ruleName":"Name"
The name of the threshold rule.
"frequency":"Time"
The frequency in which the threshold values are evaluated.
"tags": "tags"
Maps events to components such as pool_data, pool_meta-data, fset_inode, and thresholds.
"userActionWarn": "Warning message"
A user-defined message that is included in the warning message.
"userActionError": "Error message"
A user-defined message that is included in the error message.
"type": "metric | measurement"
The type of the threshold, either metric or measurement.
"metric": "Metric name"
The metric for which the threshold rule is defined.
"metricOp": "sum | avg | min | max | rate"
The metric operation or the aggregator that is used for the threshold rule.
"sensitivity": "Sensitivity"
The sample interval value in seconds.
"computation": "Computation criteria"
A rule consists of a computation element performs a computation on the collected data. There are four computation criteria defined: value, stats (max, min, median, and percentile), zimonstatus, and gpfsCapacityUtil. Currently, only 'value' is supported.
"duration": "Collection duration"
Duration of collection time (in seconds).
"filterBy": "Filter by"
Filters the result based on the filter key.
"groupBy": "Group by"
Groups the result based on the group key.
"errorLevel": "Error level"
The threshold error limit that is defined for the metric. The value can be a percentage or an integer, depending on the metric on which the threshold value is being set.
"warnLevel": "Warning level"
The threshold warning limit that is defined for the metric. The value can be a percentage or an integer, depending on the metric on which the threshold value is being set.
"direction": "High | Low"
The direction for the threshold limit.
"hysteresis": "Hysterisis"
The percentage that the observed value must be above or below the current threshold level to switch back to the previous state.

Response data

{
    "status": {
      "code":ReturnCode",
      "message":"ReturnMessage"
   },
   jobs: [
      {
         "result":"", 
           { 
             "commands":"String",
             "progress":"String,
             "exitCode":"Exit code",
             "stderr":"Error",
             "stdout":"String",
           },
         "request":" ",
           {
             "type":"{GET | POST | PUT | DELETE}",
             "url":"URL",
             "data":""",
           }
         "jobId":"ID",
         "submitted":"Time",
         "completed":Time",
         "status":"Job status",
         }   
        ],
   }
For more information about the fields in the following data structures, see the links at the end of this topic.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"paging"
The URL to retrieve the next page. Paging is enabled when more than 1000 objects are returned by the query.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"jobs":
An array of elements that describe jobs. Each element describes one job.
"result"
"commands":"String'
Array of commands that are run in this job.
"progress":"String'
Progress information for the request.
"exitCode":"Exit code"
Exit code of command. Zero is success, nonzero denotes failure.
"stderr":"Error"
CLI messages from stderr.
"stdout":"String"
CLI messages from stdout.
"request"
"type":"{GET | POST | PUT | DELETE}"
HTTP request type.
"url":"URL"
The URL through which the job is submitted.
"data":" "
Optional.
"jobId":"ID",
The unique ID of the job.
"submitted":"Time"
The time at which the job was submitted.
"completed":Time"
The time at which the job was completed.
"status":"RUNNING | COMPLETED | FAILED"
Status of the job.

Examples

The following API command creates a threshold rule rule1.

Request URL:
curl -k -u admin:admin001 -X POST --header 'content-type:application/json' --header 'accept:application/json' 
-d "{
  "ruleName": "rule1",
  "userActionWarn": "The cpu usage has exceeded the warning level. ",
  "userActionError": "The cpu usage has exceeded the threshold level. ",
  "metric": "cpu_user",
  "sensitivity": "300",
  "filterBy": "gpfs_fs_name=gpfs0",
  "groupBy": "gpfs_fs_name=gpfs0",
  "errorLevel": "90.0",
  "warnLevel": "80.0",
  "direction": "high",
  "hysteresis": "5.0"
}
'https://198.51.100.1:443/scalemgmt/v2/thresholds'
The request URL with no field or filter parameter returns only the details that uniquely identify the object.
Response data:
Note: In the JSON data that is returned, the return code indicates whether the command is successful. The response code 200 indicates that the command successfully retrieved the information. Error code 400 represents an invalid request and 500 represents internal server error.
{
  "status": {
    "code": "200",
    "message": "..."
  },
  "job": [
    {
      "result": {
        "commands": "[''mmcrfileset gpfs0 restfs1001'', ...]",
        "progress": "[''(2/3) Linking fileset'']",
        "exitCode": "0",
        "stderr": "[''EFSSG0740C There are not enough resources available to create 
                   a new independent file set.'',  ...]",
        "stdout": "[''EFSSG4172I The file set {0} must be independent.'', ...]"
      },
      "request": {
        "type": "POST",
        "url": "/scalemgmt/v2/thresholds",
        "data":  "nodesDesc": "[ 'mari-16:manager-quorum', 'mari-17::mari-17_admin' ]"
      },
      "jobId": "12345",
      "submitted": "2016-11-14 10.35.56",
      "completed": "2016-11-14 10.35.56",
      "status": "COMPLETED"
    }
  ]
}
End of change