{ "info": { "author": "Shawn Seymour", "author_email": "shawn@devshawn.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Unix", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# kafka-connect-healthcheck\n\n[![Build Status](https://travis-ci.org/devshawn/kafka-connect-healthcheck.svg?branch=master)](https://travis-ci.org/devshawn/kafka-connect-healthcheck) [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/devshawn/kafka-connect-healthcheck.svg)](https://hub.docker.com/r/devshawn/kafka-connect-healthcheck) ![PyPI](https://img.shields.io/pypi/v/kafka-connect-healthcheck.svg?color=blue) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kafka-connect-healthcheck.svg) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n\n\nA simple healthcheck wrapper to monitor Kafka Connect.\n\n\n

\n \n

\n\nKafka Connect Healthcheck is a server that wraps the Kafka Connect API and provides a singular API endpoint to determine the health of a Kafka Connect instance. This can be used to alert or take action on unhealthy connectors and tasks. \n\nThis can be used in numerous ways. It can sit as a standalone service for monitoring purposes, it can be used as a sidecar container to mark Kafka Connect workers as unhealthy in Kubernetes, or it can be used to provide logs of when connectors/tasks failed and reasons for their failures.\n\nBy default, the root endpoint `/` will return `200 OK` healthy if all connectors and tasks are in a state other than `FAILED`. It will return `503 Service Unavailable` if any connector or tasks are in a `FAILED` state.\n\n## Usage\n\nKafka Connect Healthcheck can be installed as a command-line tool through `pip` or it can be used as a standalone Docker container. It could also be installed as a part of a custom Kafka Connect docker image.\n\n### Command-Line\nTo use `kafka-connect-healthcheck` from the command-line, you must have `python` and `pip` installed. Currently, only Python 3 is supported.\n\nYou can install `kafka-connect-healthcheck` via pip:\n\n```bash\npip install kafka-connect-healthcheck\n```\n\nTo start the healthcheck server, run:\n\n```bash\nkafka-connect-healthcheck\n```\n\nThe server will now be running on [localhost:18083][localhost].\n\n### Docker\nThe `kafka-connect-healthcheck` image can be found on Docker Hub. \n\nYou can pull down the latest image by running:\n\n```bash\ndocker pull devshawn/kafka-connect-healthcheck\n```\n\nTo start the healthcheck server, run:\n\n```bash\ndocker run --rm -it -p 18083:18083 devshawn/kafka-connect-healthcheck\n```\n\nThe server will now be running on [localhost:18083][localhost].\n\n## Configuration\nKafka Connect Healthcheck can be configured via command-line arguments or by environment variables. \n\n#### Port\nThe port for the `kafka-connect-healthcheck` API.\n\n| Usage | Value |\n|-----------------------|--------------------|\n| Environment Variable | `HEALTHCHECK_PORT` |\n| Command-Line Argument | `--port` |\n| Default Value | `18083` |\n\n#### Connect URL\nThe full URL of the Kafka Connect REST API. This is used to determine the health of the connect instance.\n\n| Usage | Value |\n|-----------------------|---------------------------|\n| Environment Variable | `HEALTHCHECK_CONNECT_URL` |\n| Command-Line Argument | `--connect-url` |\n| Default Value | `http://localhost:8083` |\n\n#### Connect Worker ID\nThe worker ID to monitor (usually the IP address of the connect worker). If none is set, all workers will be monitored and any failure will result in an unhealthy response.\n\n| Usage | Value |\n|-----------------------|---------------------------------|\n| Environment Variable | `HEALTHCHECK_CONNECT_WORKER_ID` |\n| Command-Line Argument | `--connect-worker-id` |\n| Default Value | None (all workers monitored) |\n\n**Note**: It is highly recommended to run an instance of the healthcheck for each worker if you're planning to restart containers based on the health.\n\n#### Unhealthy States\nA comma-separated list of connector and tasks states to be marked as unhealthy. \n\n| Usage | Value |\n|-----------------------|---------------------------------------------|\n| Environment Variable | `HEALTHCHECK_UNHEALTHY_STATES` |\n| Command-Line Argument | `--unhealthy-states` |\n| Default Value | `FAILED` |\n| Valid Values | `FAILED`, `PAUSED`, `UNASSIGNED`, `RUNNING` |\n\n**Note**: It's recommended to keep this defaulted to `FAILED`, but paused connectors or tasks can be marked as unhealthy by passing `FAILED,PAUSED`. \n\n#### Log Level\nThe level of logs to be shown by the application.\n\n| Usage | Value |\n|-----------------------|---------------------------------------------|\n| Environment Variable | `HEALTHCHECK_LOG_LEVEL` |\n| Command-Line Argument | `--log-level` |\n| Default Value | `INFO` |\n| Valid Values | `DEBUG`, `INFO`, `WARNING`, `ERROR` |\n\nAll healthy connector and task statuses are logged at `INFO`. Unhealthy ones are logged at `WARNING`. Any communication or HTTP errors are logged at `ERROR`.\n\n## API\nThe server provides a very simple HTTP API which can be used for liveness probes and monitoring alerts. We expose two endpoints:\n\n#### `GET /`\nGet the current health status of the Kafka Connect system. This could be used as a sidecar to determine the health of each Kafka Connect worker and their associated connectors and tasks.\n\n**Example Request**\n```bash\ncurl http://localhost:18083\n```\n\n**Example Healthy Response**\n\n200 OK\n```json\n{\n \"failures\": [],\n \"failure_states\": [\n \"FAILED\"\n ],\n \"healthy\": true\n}\n```\n\n**Example Unhealthy Response**\n\n503 Service Unavailable\n```json\n{\n \"failures\": [\n {\n \"type\": \"connector\",\n \"connector\": \"jdbc-source\",\n \"state\": \"FAILED\",\n \"worker_id\": \"127.0.0.1:8083\"\n },\n {\n \"type\": \"task\",\n \"connector\": \"jdbc-source\",\n \"id\": 0,\n \"state\": \"FAILED\",\n \"worker_id\": \"127.0.0.1:8083\",\n \"trace\": \"...\"\n }\n ],\n \"failure_states\": [\n \"FAILED\"\n ],\n \"healthy\": false\n}\n```\n\n#### `GET /ping`\nGet the current health status of the healthcheck server. This will always be successful as long as the server is still able to serve requests. This can be used as a ready or liveness probe in Kubernetes.\n\n**Example Request**\n```bash\ncurl http://localhost:18083/ping\n```\n\n**Example Response**\n\n200 OK\n```json\n{\n \"status\": \"UP\"\n}\n```\n\n## License\nCopyright (c) 2019 Shawn Seymour.\n\nLicensed under the [Apache 2.0 license][license].\n\n[localhost]: http://localhost:18083\n[license]: LICENSE\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/devshawn/kafka-connect-healthcheck", "keywords": "kafka,connect,health,healthcheck,wrapper,monitor,connector", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "kafka-connect-healthcheck", "package_url": "https://pypi.org/project/kafka-connect-healthcheck/", "platform": "", "project_url": "https://pypi.org/project/kafka-connect-healthcheck/", "project_urls": { "Homepage": "https://github.com/devshawn/kafka-connect-healthcheck" }, "release_url": "https://pypi.org/project/kafka-connect-healthcheck/0.1.0/", "requires_dist": [ "requests (>=2.21.0)" ], "requires_python": "", "summary": "A simple healthcheck wrapper to monitor Kafka Connect.", "version": "0.1.0" }, "last_serial": 5218690, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "494ee39332794ead791209940d06dd29", "sha256": "c2a4d625ce0aa6f3526c56810f99691a466a67a93cf7ab83b67b34376bc74aea" }, "downloads": -1, "filename": "kafka_connect_healthcheck-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "494ee39332794ead791209940d06dd29", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14917, "upload_time": "2019-05-02T18:31:48", "url": "https://files.pythonhosted.org/packages/c9/ea/c8ff64415ade7d5cdd829febe669e5a6cea1d52a3279e699bec8db13abc3/kafka_connect_healthcheck-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70bee2d6992d4bc5368f39ffa2042c61", "sha256": "8e4a8b5f13944858726dc783bb824d92d740163e09a536dacd8eee7fa85fe87f" }, "downloads": -1, "filename": "kafka-connect-healthcheck-0.1.0.tar.gz", "has_sig": false, "md5_digest": "70bee2d6992d4bc5368f39ffa2042c61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7012, "upload_time": "2019-05-02T18:31:50", "url": "https://files.pythonhosted.org/packages/68/ed/3e0387c0a37c33f833dfbaeac937b01571bec39d59914c1abd147e4fdb2e/kafka-connect-healthcheck-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "494ee39332794ead791209940d06dd29", "sha256": "c2a4d625ce0aa6f3526c56810f99691a466a67a93cf7ab83b67b34376bc74aea" }, "downloads": -1, "filename": "kafka_connect_healthcheck-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "494ee39332794ead791209940d06dd29", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14917, "upload_time": "2019-05-02T18:31:48", "url": "https://files.pythonhosted.org/packages/c9/ea/c8ff64415ade7d5cdd829febe669e5a6cea1d52a3279e699bec8db13abc3/kafka_connect_healthcheck-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70bee2d6992d4bc5368f39ffa2042c61", "sha256": "8e4a8b5f13944858726dc783bb824d92d740163e09a536dacd8eee7fa85fe87f" }, "downloads": -1, "filename": "kafka-connect-healthcheck-0.1.0.tar.gz", "has_sig": false, "md5_digest": "70bee2d6992d4bc5368f39ffa2042c61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7012, "upload_time": "2019-05-02T18:31:50", "url": "https://files.pythonhosted.org/packages/68/ed/3e0387c0a37c33f833dfbaeac937b01571bec39d59914c1abd147e4fdb2e/kafka-connect-healthcheck-0.1.0.tar.gz" } ] }