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: NamespaceClient

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 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, value and status:

  • 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 report

  • timestamp – Time at which the report was generated

  • status – Overall health status (OK, warn or error)

  • last_update – Time at which the stats were last refreshed

  • stats – Monitored stats sections (configuration, runtime, workload, capacity_estimation)

Raises:
Return type:

ObjectApiResponse[dict[str, Any]]

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
perform_request(method, path, *, params=None, headers=None, body=None)

Perform an HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]

AsyncTaskManagerClient

Asynchronous version of the TaskManagerClient for use with async/await syntax.

class kibana._async.client.task_manager.AsyncTaskManagerClient(client)[source]

Bases: AsyncNamespaceClient

Async 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, value and status:

  • 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 report

  • timestamp – Time at which the report was generated

  • status – Overall health status (OK, warn or error)

  • last_update – Time at which the stats were last refreshed

  • stats – Monitored stats sections (configuration, runtime, workload, capacity_estimation)

Raises:
Return type:

ObjectApiResponse[dict[str, Any]]

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
async perform_request(method, path, *, params=None, headers=None, body=None)

Perform an async HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]