Skip to main content

Python client for Kibana

Project description

Kibana Python Client

Documentation Status Documentation Build PyPI version PyPI downloads Python Version License

Disclaimer: This is an independent, community-driven project and is not officially affiliated with, endorsed by, or supported by Elastic N.V. or any of its subsidiaries. "Kibana" and "Elasticsearch" are trademarks of Elastic N.V. This project is provided "as is", without warranty of any kind. Use it at your own risk. See the Disclaimer section and the LICENSE for full details.

A Python client library for interacting with Kibana's REST API. Built following the design patterns of the elasticsearch-py client.

📚 Documentation

Read the full documentation on ReadTheDocs →

Features

  • Dual API Support: Both synchronous (Kibana) and asynchronous (AsyncKibana) clients
  • Type Safety: Comprehensive type hints throughout for better IDE support and type checking
  • Reliable Transport: Built on elastic-transport for connection pooling, retries, and node management
  • Flexible Authentication: Support for API keys, basic auth, and bearer tokens
  • Space Support: Multi-tenancy with Kibana Spaces
  • Comprehensive Error Handling: Specific exception types for different HTTP status codes
  • Pythonic API: Clean, idiomatic Python interface to Kibana's REST APIs
  • Observability: Built-in OpenTelemetry support for distributed tracing

Installation

pip install kibana-py

Optional dependencies:

  • kibana-py[async] - Async client support
  • kibana-py[orjson] - High-performance JSON serialization
  • kibana-py[observability] - OpenTelemetry tracing support

For detailed installation instructions, see the Installation Guide.

Quick Start

Basic Usage

from kibana import Kibana

# Initialize client with authentication
client = Kibana(
    "http://localhost:5601",
    basic_auth=("elastic", "password")
)

# Get Kibana status
status = client.status.get_status()
print(f"Kibana status: {status.body['status']['overall']['level']}")

# Create a connector
connector = client.actions.create(
    name="My Webhook",
    connector_type_id=".webhook",
    config={"url": "https://example.com/webhook"}
)

print(f"Created connector: {connector.body['id']}")

# Close the client
client.close()

Async Client

import asyncio
from kibana import AsyncKibana

async def main():
    async with AsyncKibana(
        "http://localhost:5601",
        basic_auth=("elastic", "password")
    ) as client:
        status = await client.status.get_status()
        print(status.body)

asyncio.run(main())

For more examples and detailed usage, see:

API Coverage

The client currently supports the following Kibana APIs:

  • Actions API - Manage connectors for alerting and automation
  • Spaces API - Multi-tenancy with Kibana Spaces
  • Saved Objects API - Manage dashboards, visualizations, and other saved objects
  • Status API - Check Kibana health and operational status
  • Alerting API - Create, manage, and monitor alerting rules

For detailed API documentation, see the API Reference.

Health Checks & Readiness Probes

Use the Status API to build health check endpoints for Kubernetes liveness/readiness probes or load-balancer health checks:

from kibana import Kibana

client = Kibana("http://localhost:5601", api_key="...")

# Simple health check
def is_kibana_ready() -> bool:
    """Return True if Kibana is green/ready."""
    try:
        status = client.status()
        return status.body["status"]["overall"]["level"] == "available"
    except Exception:
        return False

# Kubernetes-style probe endpoint (Flask example)
@app.route("/healthz")
def healthz():
    if is_kibana_ready():
        return {"status": "ok"}, 200
    return {"status": "unavailable"}, 503

Authentication

The client supports multiple authentication methods:

# API Key
client = Kibana("http://localhost:5601", api_key="your_api_key")

# Basic Auth
client = Kibana("http://localhost:5601", basic_auth=("username", "password"))

# Bearer Token
client = Kibana("http://localhost:5601", bearer_auth="your_token")

For more details, see the Authentication Guide.

Examples

The examples/ directory contains working examples for all major features:

  • Connectors - Create and manage Kibana connectors
  • Spaces - Multi-tenancy with Kibana Spaces
  • Saved Objects - Manage dashboards and visualizations
  • Async Operations - Asynchronous client usage
  • Error Handling - Exception handling patterns

See the Examples Documentation for detailed explanations.

Development

Contributions are welcome! See the Contributing Guide for details on:

  • Setting up your development environment
  • Running tests
  • Code style and quality standards
  • Submitting pull requests

For more information, see the Development Documentation.

Requirements

  • Python 3.10+
  • Kibana 9.x
  • elastic-transport >= 9.1.0

Resources

Disclaimer

This project is an independent, community-driven open-source effort. It is not officially affiliated with, endorsed by, sponsored by, or supported by Elastic N.V. or any of its subsidiaries. "Kibana", "Elasticsearch", and "Elastic" are trademarks or registered trademarks of Elastic N.V.

This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors, contributors, or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.

By using this library, you acknowledge that:

  • The authors and contributors assume no responsibility or liability for any errors, issues, data loss, or damages resulting from the use of this software.
  • You are solely responsible for evaluating the suitability of this software for your use case and for any consequences of its use.
  • This project is not a substitute for Elastic's official tools, clients, or support channels.

For the complete license terms, see the LICENSE file.

License

Apache License 2.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kibana_py-0.1.0.tar.gz (63.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kibana_py-0.1.0-py3-none-any.whl (80.7 kB view details)

Uploaded Python 3

File details

Details for the file kibana_py-0.1.0.tar.gz.

File metadata

  • Download URL: kibana_py-0.1.0.tar.gz
  • Upload date:
  • Size: 63.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kibana_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6d9d0bf8810b81674baaaa4eda62eb3ad6942aece60e649c02830c252416b2b
MD5 9f83cd4095b3ce7ce5dc3cedfb5e1e05
BLAKE2b-256 1371d9e5d659494af40ff8cffc9058c4dd58c863a8ad84e1a992679a4b2f6877

See more details on using hashes here.

File details

Details for the file kibana_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kibana_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 80.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kibana_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc4568bf47e24bc4d3147f1e940de30f7b76a7445e30f4de9c90f3995510fb66
MD5 720257018d964dd5fbe15026b3f4eece
BLAKE2b-256 d7c5b3a4bba04bb3328d39f73c8541e5879c3a558b9750d07db5711f6094c892

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page