HealthCheckContainersStatus

Containers status.

python · System Diagnostics and Health Check

Source

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

XSOARV8_HTML_STYLE = "color:#FFBE98;text-align:center;font-size:150%;>"


def main():
    if is_demisto_version_ge("8.0.0"):
        msg = "Not Available for XSOAR v8"
        html = f"<h3 style={XSOARV8_HTML_STYLE}{msg!s}</h3>"
        demisto.results({"ContentsFormat": formats["html"], "Type": entryTypes["note"], "Contents": html})
        sys.exit()
    incident = demisto.incidents()[0]
    account_name = incident.get("account")
    account_name = f"acc_{account_name}/" if account_name != "" else ""

    res = execute_command("core-api-get", {"uri": f"{account_name}health/containers"})
    containers = res["response"]

    return CommandResults(
        readable_output=tableToMarkdown("Containers Status", [containers], headers=["all", "inactive", "running"]),
        outputs_prefix="containers",
        outputs=[containers],
        raw_response=containers,
    )


if __name__ in ("__main__", "__builtin__", "builtins"):  # pragma: no cover
    return_results(main())

README

Troubleshooting

Multi-tenant environments should be configured with the Cortex Rest API instance when using this
automation. Make sure the Use tenant parameter (in the Cortex Rest API integration) is checked
to ensure that API calls are made to the current tenant instead of the master tenant.