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.config import settings
from connectmon.api import API
from pprint import pprint
## Setup your API you can get your environment variables from connectmon.config.settings
connect = API(settings.CONNECT_URL)
if not connect.is_reachable():
raise Exception("Cluster is not reachable")
## Get a list of connectors and their status
connectors = connect.get_all_connector_status()
## Restart any failed or paused connectors and collect messages along the way
errors_and_warning = connect.restart_failed_connectors_if_any(connectors)
## If any channels have been registered in the configuration supplied through CONFIG_PATH
## And there were any connectors or tasks to reset
## Then process each channel
if settings.CHANNELS and len(errors_and_warnings) > 0:
for channel in settings.CHANNELS.channels:
if channel.type == "teams":
print(f"Sending message to {channel.name}...")
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.1.0.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for connectmon-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d45d04ebb1fd63a45e4c611c35ef04e60afccdb6c53246c8628ac4f20b7ba58 |
|
MD5 | 2d316eb2c81c278c7e97f8ea17ce8802 |
|
BLAKE2b-256 | 34b79f2f4ea50274f5d413bf753566286bae8fb58504e6bc29c849ce4e8aa842 |