TaskManagerClient¶
Client for the Kibana Task Manager API.
Task Manager is the Kibana service that runs background tasks such as alerting rules, actions, reporting jobs, and telemetry collection. This API exposes the health and performance statistics of the task manager on the Kibana instance that serves the request.
The Task Manager API is not space-scoped: it always operates at the Kibana instance level.
- class kibana._sync.client.task_manager.TaskManagerClient(client)[source]¶
Bases:
NamespaceClientClient for the Kibana Task Manager API.
Task Manager is the Kibana service that runs background tasks such as alerting rules, actions, reporting jobs, and telemetry collection. This API exposes the health and performance statistics of the task manager on the Kibana instance that serves the request.
The Task Manager API is not space-scoped: it always operates at the Kibana instance level.
Example
>>> from kibana import Kibana >>> client = Kibana("http://localhost:5601", api_key="...") >>> >>> # Check task manager health >>> health = client.task_manager.health() >>> print(health.body["status"]) OK
Checking Task Manager Health
from kibana import Kibana client = Kibana("http://localhost:5601", api_key="your_api_key") health = client.task_manager.health() # Overall status: OK, warn, or error print(f"Task manager status: {health.body['status']}") # Drill into the individual stat sections: configuration, # runtime, workload, capacity_estimation stats = health.body["stats"] for section, report in stats.items(): print(f"{section}: {report['status']}")
Monitoring Integration
The health endpoint is designed for monitoring systems and health checks:
def check_task_manager(client): health = client.task_manager.health() status = health.body["status"] if status != "OK": print(f"ALERT: task manager status is {status}") return status == "OK"
- __init__(client)[source]¶
Initialize the TaskManagerClient.
- Parameters:
client (Kibana) – The parent Kibana client instance to delegate requests to.
Example
>>> task_manager_client = TaskManagerClient(kibana_client)
- health()[source]¶
Get the health status of the Kibana task manager.
Returns a health report for the task manager on the Kibana instance that handles the request. The report aggregates several monitored stats sections, each with its own
timestamp,valueandstatus:configuration: effective task manager settings (poll interval, capacity, claim strategy, execution thresholds, …)
runtime: polling and task execution performance (drift, load, execution duration/result frequency per task type)
workload: the number and types of tasks in the system and their schedule density
capacity_estimation: an estimate of whether the deployed Kibana instances can handle the observed workload
- Returns:
ObjectApiResponse containing the health report with the following structure:
id– UUID of the Kibana instance that produced the reporttimestamp– Time at which the report was generatedstatus– Overall health status (OK,warnorerror)last_update– Time at which the stats were last refreshedstats– Monitored stats sections (configuration,runtime,workload,capacity_estimation)
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges to view the task manager health.
TransportError – If unable to connect to Kibana.
- Return type:
Example
>>> # Basic health check >>> health = client.task_manager.health() >>> print(health.body["status"]) OK >>> >>> # Inspect each monitored stats section >>> for section, info in health.body["stats"].items(): ... print(f"{section}: {info['status']}") configuration: OK runtime: OK workload: OK capacity_estimation: OK >>> >>> # Check polling performance >>> polling = health.body["stats"]["runtime"]["value"]["polling"] >>> print(polling["last_successful_poll"]) 2025-03-21T21:30:04.455Z
AsyncTaskManagerClient¶
Asynchronous version of the TaskManagerClient for use with async/await syntax.
- class kibana._async.client.task_manager.AsyncTaskManagerClient(client)[source]¶
Bases:
AsyncNamespaceClientAsync client for the Kibana Task Manager API.
Task Manager is the Kibana service that runs background tasks such as alerting rules, actions, reporting jobs, and telemetry collection. This API exposes the health and performance statistics of the task manager on the Kibana instance that serves the request.
The Task Manager API is not space-scoped: it always operates at the Kibana instance level.
Example
>>> from kibana import AsyncKibana >>> client = AsyncKibana("http://localhost:5601", api_key="...") >>> >>> # Check task manager health >>> health = await client.task_manager.health() >>> print(health.body["status"]) OK
Usage
The AsyncTaskManagerClient provides the same methods as TaskManagerClient but all methods are async and must be awaited:
from kibana import AsyncKibana import asyncio async def main(): async with AsyncKibana("http://localhost:5601") as client: health = await client.task_manager.health() print(health.body["status"]) asyncio.run(main())
- __init__(client)[source]¶
Initialize the AsyncTaskManagerClient.
- Parameters:
client (AsyncKibana) – The parent AsyncKibana client instance to delegate requests to.
Example
>>> task_manager_client = AsyncTaskManagerClient(kibana_client)
- async health()[source]¶
Get the health status of the Kibana task manager.
Returns a health report for the task manager on the Kibana instance that handles the request. The report aggregates several monitored stats sections, each with its own
timestamp,valueandstatus:configuration: effective task manager settings (poll interval, capacity, claim strategy, execution thresholds, …)
runtime: polling and task execution performance (drift, load, execution duration/result frequency per task type)
workload: the number and types of tasks in the system and their schedule density
capacity_estimation: an estimate of whether the deployed Kibana instances can handle the observed workload
- Returns:
ObjectApiResponse containing the health report with the following structure:
id– UUID of the Kibana instance that produced the reporttimestamp– Time at which the report was generatedstatus– Overall health status (OK,warnorerror)last_update– Time at which the stats were last refreshedstats– Monitored stats sections (configuration,runtime,workload,capacity_estimation)
- Raises:
AuthenticationException – If authentication fails.
AuthorizationException – If insufficient privileges to view the task manager health.
TransportError – If unable to connect to Kibana.
- Return type:
Example
>>> # Basic health check >>> health = await client.task_manager.health() >>> print(health.body["status"]) OK >>> >>> # Inspect each monitored stats section >>> for section, info in health.body["stats"].items(): ... print(f"{section}: {info['status']}") configuration: OK runtime: OK workload: OK capacity_estimation: OK >>> >>> # Check polling performance >>> polling = health.body["stats"]["runtime"]["value"]["polling"] >>> print(polling["last_successful_poll"]) 2025-03-21T21:30:04.455Z