R12.1-JA-2025June05

Defining API Triggered Flash Automation

In addition to the built-in flash probe, the preventive monitoring system can also be integrated with the 3rd party monitoring systems to trigger the execution of drill-down network intent automation without frequently polling from the live network.

Prerequisite: Before creating flash probe, Alert Template must be defined in advance.

  1. Go to Runbook-Based Triggered Automation > API Trigger Template Manager, then Click Add Template

  2. In the pop-up dialog, define an alert template:

    1. Select Alert Template for Template Type.
    2. Enter the Template Name and Description.
    3. In the Qualification field, enter a regular expression to define the applicable row data.
    4. Define the JSON Script. 
  3. Click OK to finish the settings. 
  4. View the alert template. The created alert template will be listed under the API Trigger Template Manager tab. The created alert template is enabled by default. You can disable it by turning off the Enabled function. 

After the alert template is defined, follow the steps below to create the API-triggered flash automation:

  1. Click  on the Taskbar and select  Preventive Automation Manager  .
  2. Navigate to the Monitoring Probe > External Probe tag. Click +Add to define an External Flash Probe. Type in the name and description of the Flash probe.
    Graphical user interface, text, application Description automatically generated
    Alternatively, flash probe can be generated automatically. Once the alert is generated by 3rd party system, it will be evaluated and parsed by the alert template. If the alert matches any of the alert templates, a flash probe will be generated automatically. 
  3. Define the API for triggering flash alert. To trigger the defined alert template, you can write JSON script of an API that will be used to call the Alert template, then run the script.
    The address for the API for triggering the alert template is /ServicesAPI/API/V1/CMDB/ThirdPartyFlashAlert/Alerts.
    A sample JSON script for the API:
    JSON
    def interface_external_probe(srcName, srcType, devicename, probeName, intfname):  # , task_type, intfname

    API_BODY = {

    "srcName": srcName,

    "srcType": srcType,

    "tenantName": TENANT,

    "domainName": DOMAIN,

    "msg": ""

    }

    msg = {

    # # "_id": "{guid1}",

    # "tenantName": TENANT,

    # "domainName": DOMAIN,

    "nodename": devicename,

    "intfname": intfname,

    # "TaskType": task_type,

    # "Internal": 'internal1',

    "probeName": probeName

    }

    API_BODY["msg"] = json.dumps(msg)

    print(str(API_BODY))

    event = PublishEvent(API_BODY)

    print(event)

    You can modify the following values in the API script: user, pwd, host_url, TENANT, DOMAIN according to the actual situation. 
  4. The system will execute the network intent automation when the real alert is generated for the first time.

View API Triggered Flash Alert Results:

The API Triggered Flash Alert results can be viewed in the Execution Tree and Adaptive Monitoring Data View.