This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

klag

A command line interface for inspecting Kafka consumer group offsets which are stored on the brokers (Kafka 0.8.2+).

Features

  • Discover and display all active or specific consumer groups and topics.
  • View offsets for partition start and end, consumer offsets, and the remaining messages.
  • Output in several formats (human, json, discrete json records for indexing/monitoring).
  • Built in polling at a specified interval.

Installation

pip install klag

or

python setup.py install

Examples

usage: klag [-h] [-b LIST] [-g JSON] [--groups-file FILE] [-d] [-c] [-p]
            [-s N] [-o FILE] [-f FORMAT] [--log-level LEVEL] [--version]

Kafka 0.8.2+ consumer monitoring.

optional arguments:
  -h, --help            show this help message and exit
  -b LIST, --brokers LIST
                        Comma separated list of Kafka brokers
  -g JSON, --groups JSON
                        Consumer groups and list of topics for each group to
                        check (even if dead). JSON structured as
                        '{"<group_id>":["<topic>"]}'
  --groups-file FILE    JSON file containing consumer groups and list of
                        topics for each group to check (even if dead). JSON
                        structured as '{"<group_id>":["<topic>"]}'
  -d, --discover        Include all active consumer groups and topics in
                        output
  -c, --cache           Consumer groups that go dead (all consumers
                        disconnect) will continue to be checked. Used with
                        '-s'
  -p, --partitions      Include partition metrics in output
  -s N, --seconds N     Repeat check every N seconds
  -o FILE, --output-file FILE
                        Write output to a file
  -f FORMAT, --format FORMAT
                        Write output using the specified format structure
                        {default,json,json-pretty,json-discrete}
  --log-level LEVEL     Set the application logging level
  --version             show program's version number and exit

To see all consumer groups that are connected and their topics, just run the klag command. It will attempt to connect to a Kafka broker at localhost:9092 as a default.

$ klag

If your broker is not local, specify the --brokers flag.

$ klag -b <remote-broker>
Group     Topic                                                        Remaining
================================================================================
my-group                                                                [STABLE]
          topic-1                                                             21
          topic-2                                                             15

To see data about the consumption of individual topic partitions, add the --partitions flag.

$ klag -p
Group     Topic     Partition       Earliest    Consumed      Latest   Remaining
================================================================================
my-group                                                                [STABLE]
          topic-1                                                             21
                    0                  52152      460290      460298           8
                    1                  52538      460963      460968           5
                    2                  52291      460805      460813           8
          topic-2                                                             15
                    0                      0      187180      187182           2
                    1                      0      187979      187984           5
                    2                      0      187026      187034           8

To focus on specific consumer groups and topics, use the --groups parameter.

$ klag -g '{"my-group":["topic-2"]}'
Group     Topic                                                        Remaining
================================================================================
my-group                                                                [STABLE]
          topic-2                                                             15

To output the information in a more machine readable format, use the --format parameter. This is ideal for producing records for a monitoring system.

$ klag -g '{"my-group":["topic-2"]}' -f json-discrete
{"consumer_lag": 15, "group": "my-group", "topic": "topic-2", "state": "Stable"}

To run klag continuously you may specify the --seconds parameter, which will print the consumer data at the specified interval. Running continuously in conjunction with the --discover flag will add consumer groups when they connect, and remove them when they disconnect. If you wish to keep monitoring the topics for consumer groups that have disconnected, enable caching with the --cache flag.

Release History

Release History

1.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
klag-1.0.2.tar.gz (7.2 kB) Copy SHA256 Checksum SHA256 Source May 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting