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/...
Possible future?:
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.1.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for connectmon-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bed6171042d4eb02f783b00d88ffd6e1f95ffa3e10cc0102cfea279333ee8508 |
|
MD5 | 64c14251aed5e2e98c64db53fe7398f2 |
|
BLAKE2b-256 | 22665d051df302f62487324b1dd009a3b9f63ec143326741273a776e7b7678ef |