Source
from typing import Any import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * def health_check(health_dict, integration_name: str) -> tuple[bool, bool]: for _, integration in health_dict.items(): if integration.get("brand") == integration_name: return (False, True) if integration.get("lastError") else (True, True) return True, False def health_check_command(args: dict[str, Any]) -> CommandResults: integration_name = args.get("integration_name", "") raw_result = demisto.executeCommand( "core-api-post", { "uri": "/settings/integration/search", "body": {"size": 10, "query": "name:" + integration_name}, }, ) if is_error(raw_result): return_error(get_error(raw_result)) health_dict = raw_result[0]["Contents"]["response"]["health"] is_healthy, fetch_done = health_check(health_dict, integration_name) return CommandResults( outputs_prefix="IntegrationHealth", outputs_key_field="integrationName", outputs={"isHealthy": is_healthy, "fetchDone": fetch_done, "integrationName": integration_name}, ) def main(): try: return_results(health_check_command(demisto.args())) except Exception as ex: return_error(f"Failed to execute Script. Error: {ex!s}") if __name__ in ("__main__", "__builtin__", "builtins"): main()
README
Checks for existing errors in a given integration.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | basescript |
| Cortex XSOAR Version | 6.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| integration_name | Integration name to check its health status. |
Outputs
| Path | Description | Type |
|---|---|---|
| IntegrationHealth.isHealthy | Determines the health status of the integration. | Boolean |
| IntegrationHealth.fetchDone | Determines whether the fetch-indicators command completed. | Boolean |
| IntegrationHealth.integrationName | Requested integration name. | String |
Script Example
!VerifyIntegrationHealth integration_name="AutoFocus Daily Feed"
Context Example
{
"IntegrationHealth": {
"fetchDone": true,
"integrationName": "AutoFocus Daily Feed",
"isHealthy": true
}
}
Human Readable Output
Results
fetchDone integrationName isHealthy true AutoFocus Daily Feed true
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.