HealthCheckExportSummaryData

Export all Incident, Context and Widget data into Json format output.

python · System Diagnostics and Health Check

Source

import json

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

ctx = demisto.context()
incident = demisto.incidents()[0]

main = {"incident": incident, "ctx": ctx, "widgets": {}}

# Save data from widgets

# HealthCheckIncidentsCreatedMonthly
res = demisto.executeCommand("HealthCheckIncidentsCreatedMonthly", {})[0]["Contents"]
main["widgets"]["IncidentsCreatedMonthly"] = json.loads(res).get("stats")


# HealthCheckIncidentsCreatedWeekly
res = demisto.executeCommand("HealthCheckIncidentsCreatedWeekly", {})[0]["Contents"]
main["widgets"]["IncidentsCreatedWeekly"] = json.loads(res).get("stats")

# HealthCheckIncidentsCreatedDaily
res = demisto.executeCommand("HealthCheckIncidentsCreatedDaily", {})[0]["Contents"]
main["widgets"]["IncidentsCreatedDaily"] = json.loads(res).get("stats")


variables = json.dumps(main).encode("utf-8")
file_entry = fileResult(filename="HealthCheckDataExport.txt", data=variables)
return_results(file_entry)

README

This README contains the full documentation for your script.

You auto-generate this README file from your script YML file using the demisto-sdk generate-docs command.

For more information see the documentation article.