IntegrationsCheck-Widget-IntegrationsErrorsInfo

Data output script for populating the dashboard table graph widget with the information about failing integrations.

python · Integrations & Incidents Health Check

Details

IDIntegrationsCheck-Widget-IntegrationsErrorsInfo
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagswidget failedInstances

README

Data output script for populating the dashboard table graph widget with the information about failing integrations.

Script Data


Name Description
Script Type python3
Tags widget, failedInstances
Cortex XSOAR Version 6.0.0

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401


def main():
    list_data = demisto.executeCommand("getList", {"listName": "XSOAR Health - Failed Integrations Table"})
    list_content = list_data[0].get("Contents", "")

    list_table = []

    if list_content:
        try:
            list_json = json.loads(list_content)
        except ValueError:
            list_json = {}
    else:
        list_json = None

    if isinstance(list_json, list):
        for instance in list_json:
            list_table.append(
                {
                    "Brand": instance.get("brand"),
                    "Instance": instance.get("instance"),
                    "Category": instance.get("category"),
                    "Information": instance.get("information"),
                }
            )
        demisto.results({"total": len(list_table), "data": list_table})

    elif isinstance(list_json, dict):
        list_table.append(
            {
                "Brand": list_json.get("brand"),
                "Instance": list_json.get("instance"),
                "Category": list_json.get("category"),
                "Information": list_json.get("information"),
            }
        )
        demisto.results({"total": len(list_table), "data": list_table})

    else:
        data = {"total": 1, "data": [{"Brand": "N/A", "Instance": "N/A", "Category": "N/A", "Information": "N/A"}]}
        demisto.results(data)


if __name__ in ["__main__", "builtin", "builtins"]:
    main()