Skip to main content

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 Default
CONNECT_URL string The URL of the Connect cluster "http://localhost:8083"
ENVIRONMENT string The environment the application is running in "dev"
LOG_LEVEL string The log level for the application "INFO"
LOG_FORMAT string The log format for the application "(asctime)s - ..."
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


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.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

connectmon-0.2.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file connectmon-0.2.2.tar.gz.

File metadata

  • Download URL: connectmon-0.2.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Darwin/22.2.0

File hashes

Hashes for connectmon-0.2.2.tar.gz
Algorithm Hash digest
SHA256 079be8d577e2593b29cc7df53fd74cefd58ee69730e4384480ddfd802a4c6e18
MD5 041e435771f3213092ddb003a4089a20
BLAKE2b-256 3fcab765c18620ba087de5d503f26d3f09cc2fc8d4dbc2e5215d1c728764086d

See more details on using hashes here.

Provenance

File details

Details for the file connectmon-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: connectmon-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.8.10 Darwin/22.2.0

File hashes

Hashes for connectmon-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 09f78247aa6f1ddf33e8c6cfb1b63e2f10fbc53c4bcce27848caf3657698838a
MD5 1715dd5fadaa25062136e04eae806bc7
BLAKE2b-256 6b24b0dd2b886d661e3482451400e04c62857680ca2a0ae973509988cbf486a2

See more details on using hashes here.

Provenance

Supported by

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