Composite alarm policy management endpoints in the REST API
As an administrator, use the following API endpoints for composite alarm policy and understand how to run them. Before running any endpoint, you must complete the required authentication. For more information, see Access and authentication for the REST API.
Run the APIs to create, update, enable, disable, delete, and search for composite alarm policies.
Composite alarm policy management
POST composite_alarm_policies
Create a composite alarm policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyName
| String | Yes | Name of the composite alarm policy. This must be unique within a tenant. | Body |
| description | String | No | Policy description. | Body |
| enabled
| Boolean | No | Indicates whether the policy is enabled or disabled. The following values are valid:
| Body |
| entityType
| String | Yes | The type of entity to be monitored. For example: K8S_POD, K8S_NODE, DEVICE | Body |
| severityConfigurations
| Array | Yes | A time-series expression consisting of an array of severity configurations. | Body |
| severityConfigurations[].severity
| String | Yes | The severity level at which the composite alarm policy generates an alarm. The following values are valid:
| Body |
| severityConfigurations[].expression
| String | Yes | The time-series expression for the mentioned severity level. | Body |
| validateWindow
| Integer | No | Time span in minutes for validating the time-series expression. Valid range is 1-60 minutes. Default value: 5 | Body |
| evaluationInterval
| Integer | No | Interval in seconds at which the policy must be evaluated to determine if the conditions are breached and an alarm must be generated. Valid range is 60-3600 seconds. Default value: 60 | Body |
| forDuration
| Integer | No | Duration in minutes for which the condition must be true to run the policy and generate an alarm. Valid range is 1-60 minutes. Default value: 5 | Body |
| validate
| Boolean | No | Backend validation flag. Must be false or blank for the create operation. | Body |
Request body
"policyName": "String",
"description": "String",
"enabled": Boolean,
"entityType": "String",
"severityConfigurations": [
{
"severity": "String",
"expression": "String"
}
],
"validateWindow": Integer,
"evaluationInterval": Integer,
"forDuration": Integer
}
Example request body
"policyName": "K8S_Pod_CPU_High_Usage",
"description": "Alert when pod CPU usage exceeds threshold",
"enabled": false,
"entityType": "K8S_POD",
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.9"
},
{
"severity": "MAJOR",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.7"
}
],
"validateWindow": 5,
"evaluationInterval": 60,
"forDuration": 5
}
Successful response
"responseTimeStamp": 1709481600000,
"statusCode": "201",
"statusMsg": "Policy created successfully",
"policy": {
"policyId": "550e8400-e29b-41d4-a716-446655440000",
"policyName": "K8S_Pod_CPU_High_Usage",
"description": "Alert when pod CPU usage exceeds threshold",
"enabled": false,
"entityType": "K8S_POD",
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.9"
},
{
"severity": "MAJOR",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.7"
}
],
"validateWindow": 5,
"evaluationInterval": 60,
"forDuration": 5,
"tenantId": "tenant123",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedTime": 1709481600000
}
}
Unsuccessful responses
Scenario 1: Duplicate policy name
"responseTimeStamp": 1709481600000,
"statusCode": "409",
"statusMsg": "Policy with name 'K8S_Pod_CPU_High_Usage' already exists."
}
Scenario 2: Validation error - Invalid expression
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Invalid PromQL expression: syntax error at position 25"
}
Scenario 3: Validate=true not allowed
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Backend validation not allowed for create operation. UI must perform validation before saving. Cannot set validate=true."
}
Scenario 4: Missing required fields
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Policy name cannot be null or empty"
}
GET composite_alarm_policies/<policy ID>
Search for a composite alarm policy based on the policy ID
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Or
monitor.alarm_policies.view
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyId | String | Yes | The unique policy ID in UUID format. | Path |
Successful response
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policy retrieved successfully",
"policy": {
"policyId": "550e8400-e29b-41d4-a716-446655440000",
"policyName": "K8S_Pod_CPU_High_Usage",
"description": "Alert when pod CPU usage exceeds threshold",
"enabled": true,
"entityType": "K8S_POD",
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.9"
}
],
"validateWindow": 5,
"evaluationInterval": 60,
"forDuration": 5,
"tenantId": "tenant123",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedBy": "admin@example.com",
"modifiedTime": 1709485200000
}
}
Unsuccessful responses
Scenario 1: Policy not found
"responseTimeStamp": 1709481600000,
"statusCode": "404",
"statusMsg": "Policy not found with ID: 550e8400-e29b-41d4-a716-446655440000"
}
Scenario 2: Invalid policy ID format
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Invalid policy ID format. Must be a valid UUID."
}
PUT composite_alarm_policies/<policy ID>
Update a composite alarm policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyId | String | Yes | The unique policy ID in UUID format. | Path |
| policyName | String | Yes | Name of the policy. This must be unique within a tenant. | Body |
| description | String | No | Description for the policy. | Body |
| enabled | Boolean | No | Indicates whether the policy is enabled or disabled. The following values are valid:
| Body |
| entityType | String | Yes | The type of entity to be monitored. For example: K8S_POD,K8S_NODE,DEVICE | Body |
| severityConfigurations | Array | Yes | A time-series expression that consists of an array of severity configurations. | Body |
| validateWindow | Integer | No | Time span in minutes for validating the time-series expression. Valid range is 1-60 minutes. Default value: 5 | Body |
| evaluationInterval | Integer | No | Interval in seconds at which the policy must be evaluated to determine if the conditions are breached and an alarm must be generated. Valid range is 60-3600 seconds. Default value: 60 | Body |
| forDuration | Integer | No | Duration in minutes for which the condition must be true to run the policy and generate an alarm. Valid range is 1-60 minutes. Default value: 5 | Body |
| validate | Boolean | No | Backend validation flag. | Body |
Request body
"policyName": "String",
"description": "String",
"enabled": Boolean,
"entityType": "String",
"severityConfigurations": [
{
"severity": "String",
"expression": "String"
}
],
"validateWindow": Integer,
"evaluationInterval": Integer,
"forDuration": Integer
}
Example request body
"policyName": "K8S_Pod_CPU_High_Usage_Updated",
"description": "Updated alert for pod CPU usage",
"enabled": true,
"entityType": "K8S_POD",
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.95"
}
],
"validateWindow": 10,
"evaluationInterval": 120,
"forDuration": 10
}
Successful response
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policy updated successfully",
"policy": {
"policyId": "550e8400-e29b-41d4-a716-446655440000",
"policyName": "K8S_Pod_CPU_High_Usage_Updated",
"description": "Updated alert for pod CPU usage",
"enabled": true,
"entityType": "K8S_POD",
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.95"
}
],
"validateWindow": 10,
"evaluationInterval": 120,
"forDuration": 10,
"tenantId": "tenant123",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedBy": "admin@example.com",
"modifiedTime": 1709485200000
}
}
Unsuccessful responses
Scenario 1: Policy not found
"responseTimeStamp": 1709481600000,
"statusCode": "404",
"statusMsg": "Policy not found with ID: 550e8400-e29b-41d4-a716-446655440000"
}
Scenario 2: Policy locked
"responseTimeStamp": 1709481600000,
"statusCode": "423",
"statusMsg": "Policy is locked for editing. It was recently modified and cannot be updated for another 245 seconds. Please try again later.",
"locked": true,
"remainingLockTimeSeconds": 245
}
Scenario 3: Duplicate policy name
"responseTimeStamp": 1709481600000,
"statusCode": "409",
"statusMsg": "Policy with name 'K8S_Pod_CPU_High_Usage_Updated' already exists"
}
Scenario 4: validate=true not allowed
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Backend validation not allowed for update operation. UI must perform validation before saving. Cannot set validate=true."
}
Post composite_alarm_policies/<policy ID>
Delete a composite alarm policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyIds | String / Array | Yes | IDs of the policies to be deleted. Supports single or bulk deletion. | Body |
Request body
"policyIds": ["String"]
}
Example request body for single policy deletion
"policyIds": ["550e8400-e29b-41d4-a716-446655440000"]
}
Example request body for multiple policy deletion
"policyIds": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001",
"770e8400-e29b-41d4-a716-446655440002"
]
}
Successful response for single policy deletion
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policy deleted successfully",
"results": {
"550e8400-e29b-41d4-a716-446655440000": "SUCCESS"
}
}
Successful response for multiple policy deletion
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policies deleted",
"results": {
"550e8400-e29b-41d4-a716-446655440000": "SUCCESS",
"660e8400-e29b-41d4-a716-446655440001": "SUCCESS",
"770e8400-e29b-41d4-a716-446655440002": "NOT_FOUND"
}
}
Unsuccessful responses
Scenario 1: Empty policy IDs list
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Policy IDs list cannot be empty"
}
Scenario 2: Single policy not found
"responseTimeStamp": 1709481600000,
"statusCode": "404",
"statusMsg": "Policy not found with ID: 550e8400-e29b-41d4-a716-446655440000"
}
GET composite_alarm_policies
List composite alarm policies
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Or
monitor.alarm_policies.view
Successful response
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policies retrieved successfully",
"policies": [
{
"policyId": "550e8400-e29b-41d4-a716-446655440000",
"policyName": "K8S_Pod_CPU_High_Usage",
"description": "Alert when pod CPU usage exceeds threshold",
"enabled": true,
"entityType": "K8S_POD",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedBy": "admin@example.com",
"modifiedTime": 1709485200000
},
{
"policyId": "660e8400-e29b-41d4-a716-446655440001",
"policyName": "K8S_Node_Memory_High",
"description": "Alert when node memory is high",
"enabled": false,
"entityType": "K8S_NODE",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedTime": 1709481600000
}
]
}
Unsuccessful responses
Scenario: Internal server error
"responseTimeStamp": 1709481600000,
"statusCode": "500",
"statusMsg": "Internal server error"
}
Post composite_alarm_policies/<policy ID>/validate
Validate the time-series expression created for a policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
or
monitor.alarm_policies.view
Parameter details
The Prometheus language is used to build the time-series expressions and validate them. For more information about the query language, see Prometheus query functions
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| expression | String | No, if the severityConfigurations is defined | Single time-series expression to be validated | Body |
| severityConfigurations | Array | No, if the expression is defined. | A time-series expression with an array of severity configurations to be validated. | Body |
| severityConfigurations[].severity | String | Yes, if the severityConfigurations is defined | The severity level at which the policy generates an alarm. The following values are valid:
| Body |
| severityConfigurations[].expression | String | Yes, if the severityConfigurations is defined | The time-series expression for the mentioned severity level. | Body |
| policyId | String | No | The unique policy ID in UUID format. | Body |
Request body for a single expression
"expression": "String"
}
Request body for multiple expressions
"severityConfigurations": [
{
"severity": "String",
"expression": "String"
}
],
"policyId": "String"
}
Example request body for a single expression
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.9"
}
Example request body for multiple expressions
"severityConfigurations": [
{
"severity": "CRITICAL",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.9"
},
{
"severity": "MAJOR",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.7"
},
{
"severity": "MINOR",
"expression": "avg_over_time(container_cpu_usage_seconds_total[5m]) > 0.5"
}
]
}
Successful response
"valid": true,
"message": "Expression validation successful"
}
Unsuccessful responses
Scenario 1: Invalid time-series query syntax
"valid": false,
"message": "Invalid PromQL expression: unexpected token 'xyz' at position 45"
}
Scenario 2: Empty expression
"valid": false,
"message": "Expression in severity configuration cannot be empty"
}
Scenario 3: Missing severity
"valid": false,
"message": "Severity in severity configuration cannot be empty"
}
Scenario 4: Security validation failure
"valid": false,
"message": "Severity CRITICAL: Expression contains potentially dangerous functions or operators"
}
Scenario 5: Neither expression nor severityConfigurations provided
"valid": false,
"message": "Either expression or expressions must be provided"
}
Scenario 6: Missing tenant ID
"valid": false,
"message": "Tenant ID cannot be extracted from JWT"
}
Scenario 7: Multiple expressions validation error
"valid": false,
"message": "Severity MAJOR: Invalid metric name 'invalid_metric_name'"
}
Post composite_alarm_policies/ search
Search composite alarm policies
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
or
monitor.alarm_policies.view
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| searchString | String | No | A string to filter policies by name or description. | Body |
| pageIndex | Integer | No | Page index (1-based). Default: 1 | Body |
| recordsPerPage | Integer | No | Number of records per page Default: 10 | Body |
| sortCriteria | Object | No | Criteria to sort the policies. | Body |
| sortCriteria.attribute | String | No | Attribute to sort the searched policies. For example: policyName, modifiedTime, enabled. Default: modifiedTime | Body |
| sortCriteria.order | String | No | Order of sorting the policies. Valid values: ASC, DESC Default: DESC | Body |
Request body
"searchString": "String",
"pageIndex": Integer,
"recordsPerPage": Integer,
"sortCriteria": {
"attribute": "String",
"order": "String"
}
}
Example request body
"searchString": "CPU",
"pageIndex": 1,
"recordsPerPage": 10,
"sortCriteria": {
"attribute": "modifiedTime",
"order": "DESC"
}
}
Successful response
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "policy list success",
"policies": [
{
"policyId": "550e8400-e29b-41d4-a716-446655440000",
"policyName": "K8S_Pod_CPU_High_Usage",
"description": "Alert when pod CPU usage exceeds threshold",
"enabled": true,
"entityType": "K8S_POD",
"createdBy": "user@example.com",
"createdTime": 1709481600000,
"modifiedBy": "admin@example.com",
"modifiedTime": 1709485200000
}
],
"totalRecords": 1,
"pageIndex": 1,
"pageSize": 10
}
Unsuccessful responses
Scenario: Internal server error
"responseTimeStamp": 1709481600000,
"statusCode": "500",
"statusMsg": "Internal server error"
}
Post composite_alarm_policies/ <policy ID>/ enable
Enable a composite alarm policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyIds | Array (for multiple policies) String (for a single policy) | Yes | An array of policy IDs to be enabled. Supports single or bulk enable. | Body |
| validate | Boolean | No | Validation flag. Default: false Policies are already validated while creating or updating the procedure. | Body |
Request body
"policyIds": ["String"],
"validate": Boolean
}
Example request body for a single policy
"policyIds": ["550e8400-e29b-41d4-a716-446655440000"]
}
Example request body for multiple policies
"policyIds": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001",
"770e8400-e29b-41d4-a716-446655440002"
]
}
Successful response for a single policy
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policy enabled successfully"
}
Success response for multiple policies with complete success
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "All policies enabled successfully",
"status": "SUCCESS",
"results": {
"550e8400-e29b-41d4-a716-446655440000": {
"status": "SUCCESS",
"message": "Policy enabled successfully"
},
"660e8400-e29b-41d4-a716-446655440001": {
"status": "SUCCESS",
"message": "Policy enabled successfully"
}
},
"totalPolicies": 2,
"successCount": 2,
"failureCount": 0
}
Success response for multiple policies with partial success
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Some policies failed to enable",
"status": "PARTIAL_SUCCESS",
"results": {
"550e8400-e29b-41d4-a716-446655440000": {
"status": "SUCCESS",
"message": "Policy enabled successfully"
},
"660e8400-e29b-41d4-a716-446655440001": {
"status": "FAILURE",
"message": "Policy not found"
},
"770e8400-e29b-41d4-a716-446655440002": {
"status": "FAILURE",
"message": "Validation failed: Invalid expression"
}
},
"totalPolicies": 3,
"successCount": 1,
"failureCount": 2
}
Unsuccessful responses
Scenario 1: Empty policy IDs list
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Policy IDs list cannot be empty"
}
Scenario 2: Single policy not found
"responseTimeStamp": 1709481600000,
"statusCode": "404",
"statusMsg": "Policy not found with ID: 550e8400-e29b-41d4-a716-446655440000"
}
Scenario 3: Policy locked
"responseTimeStamp": 1709481600000,
"statusCode": "423",
"statusMsg": "Policy is locked for editing. It was recently modified and cannot be enabled for another 180 seconds. Please try again later.",
"locked": true,
"remainingLockTimeSeconds": 180
}
Scenario 4: Validation failed for a single policy
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Policy validation failed: Invalid PromQL expression"
}
Post composite_alarm_policies/ <policy ID>/ disable
Disable a composite alarm policy
Authorization: Bearer <JWT_token>
For instructions on obtaining the JWT token, see Access and authentication for the REST API.
Parameter details
Parameter Name | Value Type | Mandatory | Description | Located in |
|---|---|---|---|---|
| policyIds | Array (for multiple policies) String (for a single policy) | Yes | An array of policy IDs to be disabled. Supports single or bulk disable. | Body |
Request body
"policyIds": ["String"]
}
Example request body for a single policy
"policyIds": ["550e8400-e29b-41d4-a716-446655440000"]
}
Example request body for multiple policies
"policyIds": [
"550e8400-e29b-41d4-a716-446655440000",
"660e8400-e29b-41d4-a716-446655440001",
"770e8400-e29b-41d4-a716-446655440002"
]
}
Successful response for a single policy
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policy disabled successfully"
}
Success response for multiple policies
"responseTimeStamp": 1709481600000,
"statusCode": "200",
"statusMsg": "Policies disabled",
"results": {
"550e8400-e29b-41d4-a716-446655440000": "SUCCESS",
"660e8400-e29b-41d4-a716-446655440001": "SUCCESS",
"770e8400-e29b-41d4-a716-446655440002": "NOT_FOUND"
}
}
Unsuccessful responses
Scenario 1: Empty policy IDs list
"responseTimeStamp": 1709481600000,
"statusCode": "400",
"statusMsg": "Policy IDs list cannot be empty"
}
Scenario 2: Single policy not found
"responseTimeStamp": 1709481600000,
"statusCode": "404",
"statusMsg": "Policy not found with ID: 550e8400-e29b-41d4-a716-446655440000"
}
Scenario 3: Policy locked
"responseTimeStamp": 1709481600000,
"statusCode": "423",
"statusMsg": "Policy is locked for editing. It was recently modified and cannot be enabled for another 180 seconds. Please try again later.",
"locked": true,
"remainingLockTimeSeconds": 180
}