Python 我有个问题,我没有';t能否连接到我的主题卡夫卡消费者?
我有问题,我无法连接到我的主题卡夫卡,我需要插件Nagios来检查卡夫卡主题中的事件ospf和bgp日志 你有解决这个问题的脚本吗?我从心底感谢你Python 我有个问题,我没有';t能否连接到我的主题卡夫卡消费者?,python,apache-kafka,Python,Apache Kafka,我有问题,我无法连接到我的主题卡夫卡,我需要插件Nagios来检查卡夫卡主题中的事件ospf和bgp日志 你有解决这个问题的脚本吗?我从心底感谢你 from kafka import KafkaConsumer import sys username = "soufiane" password = "student" security_protocol = "SASL_SSL" bootstrap_servers = ['10.103
from kafka import KafkaConsumer
import sys
username = "soufiane"
password = "student"
security_protocol = "SASL_SSL"
bootstrap_servers = ['10.103.239.83:9092']
topicName = 'tcn-ospf'
consumer = KafkaConsumer(topicName, bootstrap_servers=bootstrap_servers,
auto_offset_reset='earliest', ssl_check_hostname=True, security_protocol=security_protocol,
sasl_plain_username=username,
sasl_plain_password=password)
try:
for message in consumer:
print("%s:%d:%d: key=%s value=%s" % (
message.topic, message.partition, message.offset, message.key, message.value,))
except KeyboardInterrupt:
print('UNKNOWN: failed to check topic kafka')
sys.exit(3)