Skill Level: Any Skill Level

This recipe explains a new method to handle retries of sending events to a Netcool system. See recipe "ScienceLogic EM7 to Netcool event integration (JSON)" to set the SL1 to send events to Netcool.


For this recipe the prerequisite is to have the ScienceLogic to Netcool Event Integration implemented (see ScienceLogic EM7 to Netcool event integration (JSON) recipe at https://developer.ibm.com/recipes/tutorials/sciencelogic-em7-to-netcool-event-integration/).

The previous retry method is described at https://developer.ibm.com/recipes/tutorials/sciencelogic-em7-to-netcool-event-integration-retry-method/


  1. Changes to the existing Netcool Runbook

    1)    Change the existing Netcool Runbook Action to display the execution status as shown below:

    a)    In case of success, the existing action should display following strings:

                           ‘Netcool Omnibus Request Okay’

    b)    In case of error:

                           ‘Netcool Omnibus Request Failed’

                           ‘#EventID:%s#’ % (EM7_VALUES[‘%e’])

                           ‘#Organization:%s#’ % (str(EM7_VALUES[‘%O’]))

                           ‘#JsonPayload:%s#’ % (str(JSON_PAYLOAD))

    2)    Add a new action to the existing Netcool Automation (GSMA Event Validation_dalpont on this example). The action will check the previews action’s execution and decide if the event should be queued for retry or not.

    Automation Example:



    3)    New Action Example (GSMA Event Validation_dalpont on this example)



    Action code -> https://github.ibm.com/MnE-ScienceLogic/Netcool-Integration/blob/master/Action_GSMA%20Event%20Validation.py

  2. Create a new Netcool Runbook for the Retry flow

    1)    Create a new automation for the retry flow that will contains 3 new actions (READ, EXEC and EVAL) and will be triggered by a specific event (API_EVENT on this example)


    Automation Example:



    2)    Create the new action READ as the example below – Action will read the event queue (if any) and prepare event t be resent.


    Code for the action READ -> https://github.ibm.com/MnE-ScienceLogic/Netcool-Integration/blob/master/Action_GSMA%20Event%20Retry%20Read.py


    3)    Create the new action EXEC as the example below – Action will resend the event to Netcool.


    Action EXEC -> https://github.ibm.com/MnE-ScienceLogic/Netcool-Integration/blob/master/Action_GSMA%20Event%20Retry%20Exec.py


    4)    Create the new action EVAL as the example below. It will evaluate if event was sent successfully and can be deleted from the queue or not.


    Action EVAL -> https://github.ibm.com/MnE-ScienceLogic/Netcool-Integration/blob/master/Action_GSMA%20Event%20Retry%20Eval.py

  3. Create a new recurrent event to trigger the Retry Automation

    For the Retry Automation to be triggered a new event should be created. The new event can be created as showed below.

     1)    Create a new python script (e.g /home/em7admin/python/sl1_event.py) in the Central SL1 Database Appliance to generate an alarm using API. Script code provided below.


    #!/usr/bin/python -u

     #import time

    import requests

    import json

    #import sys

    from requests.auth import HTTPBasicAuth


    #####SL1 Event API definitions

    url = "https://localhost/api/alert"

    payload_header =  {"Authorization": "Basic <YOUR ENCRYPTED AUTHORIZATION HERE>","Content-Type": "application/json"}

    #payload_data = { "message": "API_ALARM", "message_time": "0", "aligned_resource": "/api/organization/0" }

    #r2 = requests.post(url, headers=payload_header, data=json.dumps(payload_data), verify=False, timeout=5)

    payload_data = { "message": "API_ALARM", "message_time": "0", "aligned_resource": "/api/device/1" }

    r2 = requests.post(url, headers=payload_header, data=json.dumps(payload_data), verify=False, timeout=5)


    2)    Create a new crontab entry that will call the above script every N minutes (e.g every 5 minutes).


    $ crontab -l

    */5 * * * * /home/em7admin/python/sl1_event.py


    3)    Create a new Event Policy to generate a new event based on the alert from API.




Join The Discussion