Sending HTTP Requests to Event Source

To configure the HTTP client component of the probe to send HTTP requests to the event source, you must pre-create a secret that contains the httpRequests data key. httpRequests contains the list of HTTP request configurable parameters shown below. You must update related parameters and remove unrequired entries then save them in a local JSON file.

{
   "GLOBAL":
   {
      "httpVersion":"1.1",
      "httpHeaders":"",
      "responseTimeout":"60",
      "securityProtocol":"",
      "keepTokens":"",
      "tokenEndpointURI":"",
      "autoReconnect":"OFF"
   },
   
   "LOGIN":
   {
        "GET_ACCESS_TOKEN":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"0",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        },
        
        "GET_REFRESH_ACCESS_TOKEN":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"60",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        }
   },

   "SUBSCRIBE":
   {
        "GET_SUBSCRIPTION":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"0",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        },
        
        "GET_SUBSCRIPTION_REFRESH":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"120",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        }
   },

   "RESYNC":
   {
        "RESYNC_CHILD_BY_FDN":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"0",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        }
   },

   "LOGOUT":
   {
        "REVOKE_ACCESS_TOKEN":
        {
            "uri":"",
            "method":"POST",
            "headers":"",
            "content":"",
            "interval":"0",
            "attempts":"0",
            "requireSSL":"true",
            "enableHostnameVerification" : "true"
        }
   }
}

The example below shows the HTTP request parameters in JSON file to allow the probe to send HTTP requests to https://<target host>/api/notifications/pull and retrieve Location field in HTTP response from the server. The Location field contains the event source URI and it will be saved as token that will be used for subsequent HTTP requests to perform resynchronization.

{
    "GLOBAL": {
        "httpVersion": "1.1",
        "httpHeaders": "Accept=application/json,Content-Type=application/json,Use-Cookie=true,User-Agent=IBM Netcool/OMNIBus Message Bus Probe",
        "responseTimeout": "60",
        "securityProtocol": "TLSv1.2",
        "keepTokens": "Location",
        "tokenEndpointURI": "",
        "autoReconnect": "OFF"
    },
    "LOGIN": {
        "GET_ACCESS_TOKEN": {
            "uri": "https://<target host>/api/notifications/pull",
            "method": "POST",
            "headers": "",
            "content": "",
            "interval": "0",
            "requireSSL": "true",
            "enableHostnameVerification" : "true"
        }
    },
    "RESYNC": {
        "RESYNC_FAULT_MANAGEMENT_ALARMS": {
            "uri": "++Location++",
            "method": "GET",
            "headers": "",
            "content": "",
            "interval": "0",
            "requireSSL": "true",
            "enablePagination": "false",
            "enableHostnameVerification" : "true"
        }
    }
}

The following table shows descriptions of each parameter in the example above.

Parameter name Description

GLOBAL.httpVersion

Use this property to specify the version of the HTTP protocol that the target system supports. In the example, it is set to 1.1.

GLOBAL.httpHeaders

Use this property to specify the HTTP header options to use in all HTTP requests. In the example, it is set to Accept=application/json,Content-Type=application/json,Use-Cookie=true,User-Agent=IBM Netcool/OMNIBus Message Bus Probe.

GLOBAL.responseTimeout

Use this property to specify how long (in seconds) theprobe waits for a response from the target system before timing out. In the example, it is set to 60 seconds.

GLOBAL.securityProtocol

Use this property to specify the security protocol to use when retrieving events from the REST API. In the example, it is set to TLSv1.2.

GLOBAL.keepTokens

Use this property to specify a comma-separated list of the attributes that the probe extracts from the incoming JSON data. These data items can be used in token substitution throughout the runtime of the probe. In the example, it is set to Location. Location will be extracted from incoming JSON data during login. Location contains the URI of the event source.

GLOBAL.tokenEndpointURI

Use this property to specify the URI that the probe uses to obtain an access token for the target device. This is the path on the remote host to request an access token, for example: tokenEndpointURI=/oauth/token. In the example, it is set to nil.

GLOBAL.autoReconnect

Use this property to switch ON or OFF to perform auto-reconnection. In the example, it is set to OFF.

LOGIN.GET_ACCESS_TOKEN.uri

Use this property to specify the URI that the probe uses to request a login. In the example, it is set to https://<target host>/api/notifications/pull.

LOGIN.GET_ACCESS_TOKEN.method

Use this property to specify the message type that the probe sends to request a login. In the example, it is set to POST to post the HTTP request.

LOGIN.GET_ACCESS_TOKEN.headers

Use this property to specify an HTTP header to send with all login requests. This overrides the global HTTP header options configured by the GLOBAL.httpHeaders property. In the example, it is set to nil.

LOGIN.GET_ACCESS_TOKEN.content

Use this property to specify any additional information that the probe sends with the login request. In the example, it is set to nil.

LOGIN.GET_ACCESS_TOKEN.interval

Use this property to specify the interval (in seconds) that the probe leaves between successive login. In the example, it is set to 0 to disable this feature.

LOGIN.GET_ACCESS_TOKEN.requireSSL

Use this property to enable or disable TLS/SSL connection during login. In the example, it is set to true to enable TLS/SSL connection.

LOGIN.GET_ACCESS_TOKEN.enableHostnameVerification

Use this property to enable or disable hostname verification during login. Hostname verification requires that the hostname of the target host must match the Subject Alternate Name (SAN) or DNS entry of the provided server certificate. If there is no match, an exception is thrown and the TLS handshake is aborted. This is to avoid man-in-the-middle attack which may present a different TLS server cert from the target hostname the HTTP client is trying to connect to. In the example, it is set to true to enable hostname verification during login.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.uri

Use this property to specify the URI that the probe uses to request a resynchronization with the target system. In the example, it is set to ++Location++ to use the token specified in GLOBAL.keepTokens. ++Location++ contains the event source URI.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.method

Use this property to specify the message type that the probe sends to request a resynchronization with the target system. In the example, it is set to GET to get events from event source during resynchronization.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.headers

Use this property to specify an HTTP header to send with all resynchronization requests. This overrides the global HTTP header options configured by the GLOBAL.httpHeaders property. In the example, it is set to nil.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.content

Use this property to specify any additional information that the probe sends with the resynchronization request. In the example, it is set to nil.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.interval

Use this property to specify the interval (in seconds) that the probe leaves between successive login. In the example, it is set to 0 to disable this feature.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.requireSSL

Use this property to enable or disable TLS/SSL connections during resynchronization. In the example, it is set to true to enable TLS/SSL connections.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.enablePagination

Use this property to enable or disable pagination. In the example, it is set to false to disable pagination.

RESYNC.RESYNC_FAULT_MANAGEMENT_ALARMS.enableHostnameVerification

Use this property to enable or disable hostname verification during resync. Hostname verification requires that the hostname of the target host must match the Subject Alternate Name (SAN) or DNS entry of the provided server certificate. If there is no match, an exception is thrown and the TLS handshake is aborted. This is to avoid man-in-the-middle attack which may present a different TLS server cert from the target hostname the HTTP client is trying to connect to. In the example, it is set to true to enable hostname verification during resync.

The following command creates a new secret named http-requests that contains httpRequests data with the HTTP request parameters saved in restWebhookTransport.properties file.

oc create secret generic http-requests \
  --from-file=httpRequests=<path to restWebhookTransport.properties>

Then set httpClient.httpRequestsSecretName to http-requests as in the example below to allow the probe to send HTTP requests to event source.

# (Optional) HTTP Client Configuration
httpClient:
  ## Set to 'true' to deploy HTTP Client component. Default is 'false'.
  enabled: true

  ## Host and Port parameters are used by the HTTP client component to connect 
  ## to an event source.
  host: ""
  port: 80

  ## Pre-created secret contains server.crt of an event source which is TLS/SSL enabled.
  ## To allow probe to connect to the event source
  sslSecretName: ""

  ## Pre-created secret contains HTTP Request Configuration
  ## Refer to README for details
  httpRequestsSecretName: "http-requests"