from kazoo.client import KazooClient config = { 'consumer_group': '<%= @consumer_group %>', 'topic': '<%= @topic %>' } def main(): zk = KazooClient() zk.start() partitions = zk.get_children('/consumers/%(consumer_group)s/offsets/%(topic)s' % config) num_partitions = int(zk.get('/brokers/topics/%(topic)s/0' % config)[0]) if len(partitions) != num_partitions: print "Croak! Partition fluctuation" return # and now go and connect to the broker and get the last offset available... if __name__ == '__main__': main()