Alarm policy management endpoints in the REST API



The following section provides a list of supported endpoints and an overview about running these endpoints. Before you run an endpoint, you must authenticate yourself. For more information, see Access and authentication for the REST API

Run APIs to create, update, enable, disable, delete, and search for alarm policies.


Alarm policy management

Use REST APIs to create, update, enable, disable, and delete alarm policies.

POST alarm_policies

Create an alarm policy
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details



Request body

{
  "entityThresholds":[
     {
        "metricDetails":{
           "entityTypeId":"String",
           "metricId":"String",
           "label":"String",
           "unit":"String",
           "path":"String"
        },
        "order":Integer,
        "alarmConfigurations":[
           {
              "condition":{
                 "comparison":"String",
                 "threshold":"String",
                 "duration":Integer,
 "numPolls":Integer,
                 "baseline":Boolean
              },
              "action":{
                 "severity":"String",
                 "autoClose":Boolean
              },
              "configOrder":Integer
           }
         ],
        "type":"String",
        "evaluationCriteria":"String"
     }
   ],
  "enabled":Boolean,
  "policyName":"String",
  "description":"String",
  "executionOrder":Integer
}   

Example request body

Example 1: Static threshold condition
{
 "entityThresholds": [
    {
     "metricDetails": {
       "entityTypeId": "IAK_CPU",
       "metricId": "Utilization",
       "label": "Utilization",
       "unit": "%",
       "path": "iak/1.1.31/IAK_CPU/Utilization"
      },
     "order": 0,
     "alarmConfigurations": [
        {
         "condition": {
           "comparison": "below",
           "baseline": false,
           "threshold": 10,
           "duration": -1,
           "numPolls": 10
          },
         "action": {
           "severity": "MINOR",
           "autoClose": true,
           "closeDuration": -1
          },
         "configOrder": 0
        }
      ],
     "type": "ALL",
     "evaluationCriteria": ""
    }
  ],
 "enabled": false,
 "policyName": "Threshold violation by using poll count",
 "description": "Metric violates the threshold for the specified poll count",
 "executionOrder": 9999
}
Example 2: Baseline threshold condition
{
 "entityThresholds": [
   {
     "metricDetails": {
       "entityTypeId": "IAK_CPU",
       "metricId": "Utilization",
       "label": "Utilization",
       "unit": "%",
       "path": "iak/1.1.31/IAK_CPU/Utilization"
     },
     "order": 0,
     "alarmConfigurations": [
       {
         "condition": {
           "baseline": true,
           "duration": 5,
           "numPolls": -1
         },
         "action": {
           "severity": "MAJOR"
         },
         "configOrder": 0
       }
      ],
     "type": "MULTI",
     "evaluationCriteria": "( agent_host_name starts-with 'clm-pun-' ) AND ( agent_os contains 'Windows' ) "
   }
  ],
 "enabled": true,
 "policyName": "Baseline violation",
 "description": "Metric violates the baseline value",
 "executionOrder": 9999
}
Example 3: Invalid values for the duration and polls
{
 "entityThresholds": [
    {
     "metricDetails": {
       "entityTypeId": "NUK_CPU",
       "metricId": "Utilization",
       "unit": "%",
       "label": "Utilization",
       "path": "nuk/22.4.12/NUK_CPU/Utilization"
      },
     "order": 1,
     "alarmConfigurations": [
        {
         "condition": {
           "comparison": "above",
           "threshold": 0,
           "duration": -1,
           "numPolls": -1
          },
         "action": {
           "severity": "MINOR",
           "autoClose": false
          },
         "configOrder": 0
        }
      ],
     "type": "ALL",
     "evaluationCriteria": ""
    }
  ],
 "policyName": "TestAlarmPolicy",
 "description": "Alarm policy for Duration with Precedence value 5",
 "executionOrder": 5,
 "enabled": false
}
Example 4: Duplicate configurations within the same policy
{
 "entityThresholds": [
   {
     "metricDetails": {
       "entityTypeId": "NUK_Process",
       "metricId": "ProcessCpuUsage",
       "unit": "%",
       "label": "CPU Used By Monitored Process",
       "path": "nuk/22.4.11/NUK_Process/ProcessCpuUsage"
     },
     "order": 0,
     "alarmConfigurations": [
       {
         "condition": {
           "comparison": "below",
           "threshold": 2,
           "duration": -1,
           "numPolls": 5
         },
         "action": {
           "severity": "CRITICAL",
           "autoClose": false
         },
         "configOrder": 0
       },
       {
         "condition": {
           "comparison": "above",
           "threshold": 2,
           "duration": -1,
           "numPolls": 10
         },
         "action": {
           "severity": "CRITICAL",
           "autoClose": false
         },
         "configOrder": 1
       }
      ],
     "type": "ALL",
     "evaluationCriteria": ""
   }
  ],
 "policyName": "mh_public_api_test",
 "description": "Duplicate configurations within the same policy",
 "executionOrder": 9999,
 "enabled": true
}

Successful response

{
 "statusCode": "200",
 "resourceId": [
   "64701389-49a4-47fa-a0c3-808bfb82d5d6"
  ]
}

Unsuccessful responses

Scenario 1

Invalid condition name : agent_host_name_dummy.
There must be exactly one space character on each side of the following elements:
  Operator
  Parenthesis


Scenario 2

{
   "statusCode": "POLICY_ALREADY_EXIST",
   "resourceId": null
}

Scenario 3: You specify invalid values for duration and polls simultaneously

Both the duration and polls are invalid and cannot be specified simultaneously. Specify a valid value for one field and -1 for the other.

Scenario 4: You specify a configuration that already exists in the same policy

The endpoint returns this response if you specify the same severity in different configurations for the same metric within a policy.

{
 "statusCode": "WITHIN_POLICY_DUPLICATE_CONFIG_EXIST",
 "resourceId": null
}

Back to top

PUT alarm_policies/<policy ID>

Important

To update an existing policy, make sure that you send the entire policy detail request payload with the required values.

This update replaces the existing policy definition similar to overwriting changes in a file.

Update an alarm policy
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/<Policy Id>
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/0ab07dd5-277b-4d6a-9f8a-a578bb86ed8d
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details



Request body

{
  "entityThresholds":[
     {
        "metricDetails":{
           "entityTypeId":"String",
           "metricId":"String",
           "label":"String",
           "unit":"String",
           "path":"String"
        },
        "order":Integer,
        "alarmConfigurations":[
           {
              "condition":{
                 "comparison":"String",
                 "threshold":"String",
                 "duration":Integer,
 "numPolls":Integer,
                 "baseline":Boolean
              },
              "action":{
                 "severity":"String",
                 "autoClose":Boolean
              },
              "configOrder":Integer
           }
         ],
        "type":"String",
        "evaluationCriteria":"String"
     }
   ],
  "enabled":Boolean,
  "policyName":"String",
  "description":"String",
  "executionOrder":Integer
}

Example request body

Example 1: Static threshold condition
{
 "id": "f835a4f5-116f-4282-b489-fcae7d46a913",
 "policyName": "Test_Alarm_2",
 "description": "Creating Alarm Policy",
 "enabled": false,
 "entityThresholds": [
   {
     "metricDetails": {
       "entityTypeId": "IAK_WPAR",
       "metricId": "UsedMemory",
       "label": "Memory Used",
       "unit": "MB",
       "path": "iak/1.1.20/IAK_WPAR/UsedMemory"
     },
     "type": "MULTI",
     "evaluationCriteria": "( agent_host_name starts-with 'clm-pun-' ) AND ( agent_os contains 'Windows' ) ",
     "alarmConfigurations": [
       {
         "configId": "daf17a3b-0daa-4418-a8eb-efdb673cc4db",
         "condition": {
           "comparison": "above",
           "threshold": 18,
           "duration": -1,
           "numPolls": 3,
           "occurrence": 0,
           "baseline": false
         },
         "action": {
           "severity": "CRITICAL",
           "autoClose": false
         },
         "configOrder": 0
       }
      ],
     "order": 0
   }
  ],
 "executionOrder": 9999
}
Example 2: Baseline threshold condition
{
 "id": "d6155947-eb21-4797-b75b-1ffb41e83573",
 "policyName": "Baseline violation",
 "description": "Metric violates the baseline value",
 "enabled": false,
 "entityThresholds": [
   {
     "metricDetails": {
       "entityTypeId": "NUK_CPU",
       "metricId": "Utilization",
       "label": "Utilization",
       "unit": "%",
       "path": "nuk/22.4.00/NUK_CPU/Utilization"
     },
     "type": "MULTI",
     "evaluationCriteria": "( agent_host_name starts-with 'clm-pun-' ) AND ( agent_os contains 'Windows' ) ",
     "alarmConfigurations": [
       {
         "configId": "d32c3620-4947-44c2-98ae-bb067ba94751",
         "condition": {
           "baseline": true,
           "duration": 1
         },
         "action": {
           "severity": "MINOR",
           "autoClose": false,
           "closeDuration": 0
         },
         "configOrder": 0
       }
      ],
     "order": 0
   }
  ],
 "executionOrder": 9999
}
Example 3: Add a metric to an existing policy
{
 "id": "d6155947-eb21-4797-b75b-1ffb41e83573",
 "policyName": "Service status and CPU usage",
 "description": "Service status and CPU usage",
 "enabled": false,
 "entityThresholds": [
   {
     "metricDetails": {
       "entityTypeId": "NT_SERVICES",
       "metricId": "ServiceStatus",
       "unit": "0 - Running, 1 - Ok not running, 2 - Warning not running, 3 - Alarm not running",
       "label": "Service status",
       "path": "psx_epd/20.05.11/NT_SERVICES/ServiceStatus"
     },
     "type": "MULTI",
     "evaluationCriteria": "( agent_host_name string-equals 'clm-aus-vag88w' )",
     "alarmConfigurations": [
       {
         "configId": "11a1590d-4d7d-4c4f-8f75-71fa2eb7ca09",
         "condition": {
           "comparison": "equal",
           "threshold": 0,
           "duration": 1,
           "occurrence": 0,
           "baseline": false
         },
         "action": {
           "severity": "CRITICAL",
           "autoClose": true,
           "closeDuration": 0
         },
         "configOrder": 0
       }
      ],
     "order": 0
   },
   {
     "metricDetails": {
       "entityTypeId": "NUK_Process",
       "metricId": "ProcessCpuUsage",
       "unit": "%",
       "label": "CPU used by monitored process",
       "path": "nuk/22.4.11/NUK_Process/ProcessCpuUsage"
     },
     "type": "ALL",
     "evaluationCriteria": "",
     "alarmConfigurations": [
       {
         "configId": "b9b3c8f9-5976-4160-a602-9e0073fcc775",
         "condition": {
           "comparison": "above",
           "threshold": 70,
           "duration": 0,
           "occurrence": 0,
           "baseline": false
         },
         "action": {
           "severity": "CRITICAL",
           "autoClose": false,
           "closeDuration": 0
         },
         "configOrder": 0
       }
      ],
     "order": 1
   }
  ],
 "executionOrder": 8655
}

Here, ProcessCpuUsage is the new metric that is added to the existing policy.

Successful response

{
   "statusCode": "200",
   "resourceId": [
       "27391336-80e8-457c-ab6c-2ab0e27a2954"
    ]
}

Unsuccessful responses

Scenario 1: Policy does not exist

{
   "statusCode": "POLICY_NOT_EXIST",
   "resourceId": null
}

Scenario 2: Incorrect or invalid policy precedence

The Execution Order (policy precedence) parameter must be a positive number and must be between 0 and 9999.


Scenario 3: The EntityTypeID parameter is empty


{
   "statusCode": "500",
    The EntityTypeId parameter cannot be empty or null.
}


Scenario 4: The EntityTypeID parameter is invalid


{
   "statusCode": "500",
    Invalid EntityTypeId.
}


Scenario 1: Invalid instance type


{
   "statusCode": "500",
    Invalid type : nIK3HXRc
}

Back to top

POST alarm_policies/<policy ID>/enable

Enable an alarm policy
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/<Policy Id>/enable
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/0ab07dd5-277b-4d6a-9f8a-a578bb86ed8d/enable
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details


Successful response

{
  "statusCode":"200"
}

Unsuccessful responses

Scenario 1: Invalid policy ID


{
  "statusCode":"500"
Invalid UUID string: 263927105892830
}


Scenario 2: Incorrect policy ID format

{
  "statusCode":"500"
Error at index 9 in: "d38ccf559re7"
}

Back to top

POST alarm_policies/<policy ID>/disable

Disable an alarm policy
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/<Policy Id>/disable
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/0ab07dd5-277b-4d6a-9f8a-a578bb86ed8d/disable
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details


Successful response

{
  "statusCode":"200"
}

Unsuccessful responses

Scenario 1: Invalid policy ID

{
  "statusCode":"500"
Invalid UUID string: 263927105892830
}

Scenario 2: Incorrect policy ID format

{
  "statusCode":"500"
Error at index 9 in: "d38ccf559re7"
}

Back to top

DELETE alarm_policies/<policy ID>

Delete an alarm policy
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/<Policy Id>
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/0ab07dd5-277b-4d6a-9f8a-a578bb86ed8d
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details


Successful response

{
 "statusCode":"200",
  "customMsg":"[Deleted policies.]"
}


Unsuccessful responses

Scenario 1: Incorrect policy ID

{
   "statusCode": "500"
}

Scenario 1: Invalid policy ID

{
   "statusCode": "404"
}

Back to top


Alarm policy search

You can search for alarm policies based on one of the following criterion:

  • Policy ID
  • Other criteria that you specify

Run the APIs in this section to search for alarm policies.

GET alarm_policies/<policy ID>

Search for an alarm policy based on the policy ID
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/<Policy Id>
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/5b5cc184-055c-4e29-b0df-2098cf1235c5
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details


Successful response

Example 1: Response
{
 "responseTimeStamp": 1613549398716,
 "statusCode": "200",
 "statusMsg": "policy list success",
 "totalRecords": 1,
 "policies": [
   {
     "tenantId": "1786266992",
     "id": "a3328dc5-3c2a-420c-a3e4-8b895eca0b87",
     "policyName": "Test_Alarm_1",
     "description": "",
     "enabled": false,
     "owner": "admin",
     "createdTime": 1613542081767,
     "modifiedTime": 1613542081767,
     "entityThresholds": [
       {
         "metricDetails": {
           "entityTypeId": "IAK_WPAR",
           "metricId": "CPUUtilization",
           "unit": "%",
           "label": "CPU Utilization",
           "path": "iak/1.1.20/IAK_WPAR/CPUUtilization"
         },
         "type": "MULTI",
         "evaluationCriteria": "agent_os contains 'AIX' ",
         "alarmConfigurations": [
           {
             "configId": "06177e2f-0a9d-482b-8fe3-35eec9adeef2",
             "condition": {
               "comparison": "above",
               "threshold": 19,
               "duration": 10,
               "occurrence": 0,
               "baseline": false
             },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
             },
             "configOrder": 0
           }
          ],
         "order": 0
       }
      ],
     "executionOrder": 9999
   }
  ]
}
Example 2: Response
{
 "responseTimeStamp": 1613549398716,
 "statusCode": "200",
 "statusMsg": "policy list success",
 "totalRecords": 1,
 "policies": [
   {
     "tenantId": "1786266992",
     "id": "d6155947-eb21-4797-b75b-1ffb41e83573",
     "policyName": "Baseline violation",
     "description": "Metric violates the baseline value",
     "enabled": false,
     "owner": "admin",
     "createdTime": 1613542081767,
     "modifiedTime": 1613542081767,
     "entityThresholds": [
       {
         "metricDetails": {
           "entityTypeId": "NUK_CPU",
           "metricId": "Utilization",
           "unit": "%",
           "label": "Utilization",
           "path": "nuk/22.4.00/NUK_CPU/Utilization"
         },
         "type": "MULTI",
         "evaluationCriteria": "( agent_host_name starts-with 'clm-pun-' ) AND ( agent_os contains 'Windows' ) ",
         "alarmConfigurations": [
           {
             "configId": "d32c3620-4947-44c2-98ae-bb067ba94751",
             "condition": {
               "baseline": true,
               "duration": 1
             },
             "action": {
               "severity": "MINOR",
               "autoClose": false,
               "closeDuration": 0
             },
             "configOrder": 0
           }
          ],
         "order": 0
       }
      ],
     "executionOrder": 9999
   }
  ]
}

Back to top

POST alarm_policies/search

Search for an alarm policy based on specified criteria
Request URL
https://<BMC Helix Portal URL>/alarm-service/api/v1.0/alarm_policies/search
Example request URL with optional parameters
https://test.bmc.com/alarm-service/api/v1.0/alarm_policies/search
Request Header
Content-Type: application/json
Authorization: Bearer <JWT_token>

For instructions on obtaining the JWT token, see Access and authentication for the REST API.

Parameter details



Request body

{
  "searchString":"String",
  "sortCriteria":{
     "attribute":"String",
     "order":"String"
  }
}

Example request body

{
 "searchString": "PATROL Knowledge Module for Linux",
 "sortCriteria": {
   "attribute": "modifiedTime",
   "order": "DESC"
  }
}


Successful response

{
 "statusCode": "200",
 "totalRecords": 1,
 "policies": [
    {
     "tenantId": "1877651219",
     "id": "6d87d1b0-ba46-4a60-a35d-3c6cd84f1fd2",
     "policyName": "PATROL Knowledge Module for Linux",
     "description": "Global threshold configuration policy for Collection status(Disks), Collection status(File Systems), FileSystem Mount Status(File System), Process Count Check(Process), Process Ownership Check(Process), Parent PID is 1(Process).  ",
     "enabled": true,
     "owner": "admin",
     "createdTime": 1664271514462,
     "modifiedTime": 1694685867428,
     "executionOrder": 9999,
     "entityThresholds": [
        {
         "metricDetails": {
           "entityTypeId": "NUK_Disk_Container",
           "metricId": "_CollectionStatus",
           "unit": "1 - OK, 2 - Not OK",
           "label": "Collection status",
           "path": "nuk/22.4.11/NUK_Disk_Container/_CollectionStatus"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "5b81b51f-f18c-4861-9909-c72de3915319",
             "condition": {
               "comparison": "equal",
               "threshold": 2,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 0
        },
        {
         "metricDetails": {
           "entityTypeId": "NUK_FileSystem_Container",
           "metricId": "_CollectionStatus",
           "unit": "1 - OK, 2 - Not OK",
           "label": "Collection status",
           "path": "nuk/22.4.11/NUK_FileSystem_Container/_CollectionStatus"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "e5f025ff-610c-4cf7-b5ed-2072e2e1db52",
             "condition": {
               "comparison": "equal",
               "threshold": 2,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 1
        },
        {
         "metricDetails": {
           "entityTypeId": "NUK_FileSystem",
           "metricId": "MountStatus",
           "unit": "0 - OK, 1 - Unmounted, 2 - Unknown",
           "label": "Filesystem mount status",
           "path": "nuk/22.4.11/NUK_FileSystem/MountStatus"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "348ea3b6-1b02-4217-9d1d-82b9a8d7a8dc",
             "condition": {
               "comparison": "equal",
               "threshold": 1,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 2
        },
        {
         "metricDetails": {
           "entityTypeId": "NUK_Process",
           "metricId": "ProcessCountCheck",
           "unit": "0 - OK, 1 - Warning, 2 - Alarm",
           "label": "Process count check",
           "path": "nuk/22.4.11/NUK_Process/ProcessCountCheck"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "0579bbc3-736a-405a-8cd4-867fb610c4f5",
             "condition": {
               "comparison": "equal",
               "threshold": 2,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 3
        },
        {
         "metricDetails": {
           "entityTypeId": "NUK_Process",
           "metricId": "ProcessOwnerCheck",
           "unit": "0 - OK, 1 - Warning, 2 - Alarm",
           "label": "Process ownership check",
           "path": "nuk/22.4.11/NUK_Process/ProcessOwnerCheck"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "b390e582-5fa8-40d7-aed2-680440b2bf9b",
             "condition": {
               "comparison": "equal",
               "threshold": 2,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 4
        },
        {
         "metricDetails": {
           "entityTypeId": "NUK_Process",
           "metricId": "ProcessParentPID1",
           "unit": "0 - OK, 1 - Warning, 2 - Alarm",
           "label": "Parent PID is 1",
           "path": "nuk/22.4.11/NUK_Process/ProcessParentPID1"
          },
         "type": "ALL",
         "evaluationCriteria": "",
         "alarmConfigurations": [
            {
             "configId": "6ca0a52a-c9f7-4746-944e-53c10f2bbe09",
             "condition": {
               "comparison": "equal",
               "threshold": 2,
               "duration": 5,
               "occurrence": 0,
               "baseline": false
              },
             "action": {
               "severity": "CRITICAL",
               "autoClose": true,
               "closeDuration": -1
              },
             "configOrder": 0
            }
          ],
         "order": 5
        }
      ]
    }
  ]
}

Back to top

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*