Skip navigation
Share:|

BMC TrueSight 10 features a rich set of APIs that allow to interact with all the main aspects of the solution: Data, Events, Cis, Configuration.

This is the first of a series of short posts on how to get familiar with those APIs and leverage them.

You can find the second post about CMA API here: TrueSight Operations Management REST API for Central Monitoring Administration

 

For testing the APIs I suggest to use a Google Chrome app called Advanced REST client.

A valid alternative is another app/extension called Postman

 

Assumptions for using this tutorial:

TrueSight Operations Management 10.x installed and configured

  • TrueSight Presentation Server installed and configured for authentication with Atrium SSO
  • at least one TrueSight Infrastructure Management server installed and configured

 

Let's start setting up the Advanced REST client test environment:

 

 

The Event Management API is exposed on the TSIM Server, in case of multiple servers, interaction happens with the “router” server.

In order to be able to call any of the TSIM APIs you need to obtain an authentication token calling the login API.


Here are the details needed for the login api

--------------------------------------------------------------------------------------------------------------

Url:

http://tsim1.bmcswe.com/bppmws/api/authenticate/login

 

Method: POST

 

Content-Type: application/x-www-form-urlencoded

 

Body:

username=admin&password=admin12345&tenantName=bmcRealm

------------------------------------------------------------------------------------------------------------------------

 

Calling the Login api in Advanced REST client:

more details here: Web services authentication - BMC TrueSight Infrastructure Management 10.0 - BMC Documentation

 

Even though tokens expire, it is advised to release the token using the logout api when you are finished with the api calls.

 

 

 

List Events

 

The event management api allows to retrieve events

 

Here are the details needed for the search api:

--------------------------------------------------------------------------------------------------------------

 

url:

http://tsim1.bmcswe.com/bppmws/api/Event/search?routingId=pncell_clm-tsom&routingIdType=CELL_NAME

 

method: POST

 

Content-Type: application/json

 

Header: set Authorization header with the authtoken previously gotten.

Example: Authorization= authtoken SsX2xiU9FAw4d88gAuxukLb9yEY=

 

JSON body (sample) - Payload:

{

      "criteria": {

            "value": "CRITICAL",

            "identifier": "severity",

            "operator": "EQUALS"

      }

}

 

------------------------------------------------------------------------------------------------------------------------

Calling the event Search api in Advanced REST client:

 

 

Create Events

 

The event management api allows to create one or more events. As you can notice the JSON body start and ends with square brackets, inside this section it is possible to define multiple events in blocks contained in curly brackets and separated by comma (",")

 

Here are the details needed for the create api:

--------------------------------------------------------------------------------------------------------------

 

url:

http://tsim1/bppmws/api/Event/create?routingId=pncell_tsim1&routingIdType=CELL_NAME

 

Content-Type: application/json


method: POST

 

Header: set Authorization header with the authtoken previously gotten.

Example: Authorization= authtoken SsX2xiU9FAw4d88gAuxukLb9yEY=

 

JSON body (sample):

[

      {

      "eventSourceHostName": "bppmwsserver2.domain.com",

      "eventSourceIPAddress": "192.72.255.152",

      "attributes": {

          "CLASS": "EVENT",

          "mc_object_uri": "",

          "severity": "CRITICAL",

          "msg": "AppServer CPU usage:reached threshold=80",

          "mc_smc_alias": "Prod application SRV2",

          "mc_smc_id": "Model1_10000_S0110",

          "mc_owner": "Administrator",

          "mc_priority": "PRIORITY_5"

      }

      },

    {

    "eventSourceHostName": "bppmwsserver3.domain.com",

    "eventSourceIPAddress": "192.72.255.153",

    "attributes": {

          "CLASS": "EVENT",

          "mc_object_uri": "",

          "severity": "CRITICAL",

          "msg": "DB Server CPU usage:reached threshold=80",

          "mc_smc_alias": "Prod db SRV2",

          "mc_smc_id": "Model1_10000_S0110",

          "mc_owner": "Administrator",

          "mc_priority": "PRIORITY_5"

      }

    }

]

 

------------------------------------------------------------------------------------------------------------------------

Calling the event Create api in Advanced REST client:

 

 

 

Update Events

 

The event management api allows to update one or more events. As you can notice the JSON body does not start and ends with square brackets, but it is still possible to define multiple events in blocks contained in curly brackets and separated by comma (",")

 

Here are the details needed for the Update api:

--------------------------------------------------------------------------------------------------------------

Url:

http://tsim1/bppmws/api/Event/update?routingId=pncell_tsim1&routingIdType=CELL_NAME

method: PUT (notice this is PUT not POST as for the List and Create APIs)


Header: set Authorization header with the authtoken previously gotten:

example - Authorization= authtoken SsX2xiU9FAw4d88gAuxukLb9yEY=


JSON body (sample): square brackets have been causing a “400 bad request” response so make sure you do not use them here to open and close the whole block. It is possible to update multiple events in one call. Just add another block separated by a “,” (comma) sign.

{

      "attributes": {

      "CLASS": "EVENT",

      "mc_ueid": "mc.pncell_CLM-TSOM.15c47b0e.0",

      "mc_object_uri": "",

    "severity": "CRITICAL",

      "msg": "Updated!!! AppServer CPU usage:reached threshold=83",

      "mc_smc_alias": "Prod application SRV2",

      "mc_smc_id": "Model1_10000_S0110",

      "mc_owner": "Administrator",

      "mc_priority": "PRIORITY_5"

      }

}

 

------------------------------------------------------------------------------------------------------------------------

 

Calling the event Update api in Advanced REST client:

 

My plan is to add more details to this post in the upcoming days.

I plan also create 3 more posts covering: the DATA api, the Component (CI) api and the CMA api with focus on policy management.

Filter Blog

By date:
By tag: