dhcpkit_kafka.server_extension package

This handler provides a looking glass into DHCP server operations by sending interesting information on Kafka

class dhcpkit_kafka.server_extension.KafkaHandler(source_address: Tuple[str, int], brokers: Iterable[Tuple[str, int]], topic_name: str, server_name: str)[source]

Bases: dhcpkit.ipv6.server.handlers.Handler

Option handler that provides a looking glass into DHCP server operations by logging information about requests and responses into an SQLite database.

The primary key is (duid, interface_id, remote_id)

analyse_post(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Finish the Kafka message and send it.

Parameters:bundle – The transaction bundle
analyse_pre(bundle: dhcpkit.ipv6.server.transaction_bundle.TransactionBundle)[source]

Start building the Kafka message.

Parameters:bundle – The transaction bundle
connect()[source]

Connect the producer to the broker.

kafka = None

The Kafka client

kafka_producer = None

The Kafka producer

kafka_topic = None

The Kafka topic we publish to

last_connect_attempt = None

Remember when the last connection attempt was for reconnect rate-limiting

worker_init()[source]

Initialise the Kafka client in each worker