A tool for monitoring tasks and connectors in Kafka Connect.
Project description
ConnectMon
A tool for monitoring tasks and connectors in Kafka Connect.
Installation
With pip
pip install connectmon
With poetry
poetry add connectmon
Usage
from connectmon import env, API
from connectmon.utils import build_teams_message
## Setup Kafka Connect Rest API client and check if cluster is reachable
connect = API(env.CONNECT_URL)
if not connect.is_reachable():
raise Exception("Cluster is not reachable")
## Get all connectors and check if any are in a failed state
connectors = connect.get_all_connector_status()
## Restart failed connectors and tasks
errors_and_warnings = connect.restart_failed_connectors_if_any(connectors)
## Send message to Teams channel if any errors or warnings
if env.CHANNELS and len(errors_and_warnings) > 0:
for channel in env.CHANNELS.channels:
print(f"Sending message to {channel.name}...")
if channel.type == "teams":
teams_msg = build_teams_message(channel.url, errors_and_warnings)
teams_msg.send()
Configuration
Name | Type | Description |
---|---|---|
CONNECT_URL | string | The URL of the Connect cluster |
ENVIRONMENT | string | The environment the application is running in |
LOG_LEVEL | string | The log level for the application |
LOG_FORMAT | string | The log format for the application |
CONFIG_PATH | Optional string | The path to the configuration file |
If CONFIG_PATH
is provided, the application will attempt to load
configuration from the file, which will set settings.CHANNELS
with the
channels configured in the supplied configuration file.
A config file could look like this
channels:
- name: my-teams-team-name
type: teams
url: https://my-org.webhook.office.com/webhookb2/...
include:
- i-want-to-monitor-this-connector
- this-too
exclude:
- who-cares-about-this-connector
- this-is-someone-elses-problem
Current only Microsoft Teams is supported. More will come if requested.
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
connectmon-0.2.0.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for connectmon-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ede490012cf4b5ddb14ff3270db5ccd1b0d3f80d162cf9347f1d41af65393d0a |
|
MD5 | 96f75dbb86bd7eaaba70a27ed556869e |
|
BLAKE2b-256 | 2a041f5b380ffc1ce3cd189a177e965f34584aa3bfcaff44c324b0bc1eda9123 |