Python client for Kibana
Project description
Kibana Python Client
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 supportkibana-py[orjson]- High-performance JSON serializationkibana-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
- Documentation - Complete documentation on ReadTheDocs
- Examples - Working code examples
- Contributing - Contribution guidelines
- Maintainers - Maintainer ownership and release responsibilities
- Code of Conduct - Community participation standards
- Changelog - Release history
- Issue Tracker - Report bugs or request features
- Kibana API Docs - Official Kibana API documentation
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kibana_py-0.1.9.tar.gz.
File metadata
- Download URL: kibana_py-0.1.9.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a200b0e2bf82e58b2a36d251a991bd6f5623a93600e19cb7a554e90eecf5d0
|
|
| MD5 |
87f7b5e5e09875fb919bda972f5522eb
|
|
| BLAKE2b-256 |
9f130d59aef8028c437f59da69f6325bfa45b4ab447a0f7eb75b3d260639f136
|
Provenance
The following attestation bundles were made for kibana_py-0.1.9.tar.gz:
Publisher:
release.yml on pedro-angel/kibana-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kibana_py-0.1.9.tar.gz -
Subject digest:
c6a200b0e2bf82e58b2a36d251a991bd6f5623a93600e19cb7a554e90eecf5d0 - Sigstore transparency entry: 1237369297
- Sigstore integration time:
-
Permalink:
pedro-angel/kibana-py@c2cc86dae046eafe3a785c679a149c7c76bf5724 -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/pedro-angel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2cc86dae046eafe3a785c679a149c7c76bf5724 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kibana_py-0.1.9-py3-none-any.whl.
File metadata
- Download URL: kibana_py-0.1.9-py3-none-any.whl
- Upload date:
- Size: 80.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfe6ec376cb7ac5307d1b9beb61526d3c9391b1bca35651d98f665277d22a42a
|
|
| MD5 |
12b8015e8c8dd7d951144688a489f88c
|
|
| BLAKE2b-256 |
736f5c5cf396e1dbcdf8c82931b8ee21ef7808cc7c4c5282fa469182250ae0ec
|
Provenance
The following attestation bundles were made for kibana_py-0.1.9-py3-none-any.whl:
Publisher:
release.yml on pedro-angel/kibana-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kibana_py-0.1.9-py3-none-any.whl -
Subject digest:
dfe6ec376cb7ac5307d1b9beb61526d3c9391b1bca35651d98f665277d22a42a - Sigstore transparency entry: 1237369317
- Sigstore integration time:
-
Permalink:
pedro-angel/kibana-py@c2cc86dae046eafe3a785c679a149c7c76bf5724 -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/pedro-angel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c2cc86dae046eafe3a785c679a149c7c76bf5724 -
Trigger Event:
push
-
Statement type: