Nagios-Plugins icon indicating copy to clipboard operation
Nagios-Plugins copied to clipboard

Docker check_kafka.pl "CRITICAL: Error: Cannot connect to broker: topic='mi_topic'"

Open GAberasturi opened this issue 5 years ago • 3 comments

Hi,

downloaded docker imagen

C:\Windows\system32>docker images
REPOSITORY                        TAG                 IMAGE ID            CREATED             SIZE
harisekhon/nagios-plugins         latest              d121ed7115dd        6 days ago          414MB

C:\Windows\system32>

Executed the command to test one topic

C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.pl -B server1:9092,server2:9092,server3:9092
 -T mi_topic -p 0
CRITICAL: Error: Cannot connect to broker: topic='mi_topic'

Trace begun at /usr/local/share/perl5/Kafka/Connection.pm line 1592
Kafka::Connection::_error('Kafka::Connection=HASH(0x185a4d0)', -1004, 'topic=\'mi_topic\'', 'request', 'HASH(0x1864c18)', 'io_error', '
Kafka::Exception::IO=HASH(0x1878c70)') called at /usr/local/share/perl5/Kafka/Connection.pm line 1021
Kafka::Connection::receive_response_to_request('Kafka::Connection=HASH(0x185a4d0)', 'HASH(0x1864c18)') called at /usr/local/share/perl5/Kafka/Consumer.pm l
ine 658
Kafka::Consumer::_query_offsets('Kafka::Consumer=HASH(0x1864540)', 'mi_topic', 0, -1, undef, 0) called at /usr/local/share/perl5/Kafka/
Consumer.pm line 626
Kafka::Consumer::offsets('Kafka::Consumer=HASH(0x1864540)', 'mi_topic', 0, -1) called at /github/nagios-plugins/check_kafka.pl line 313
main::__ANON__ at /github/nagios-plugins/lib/HariSekhonUtils.pm line 565
eval {...} at /github/nagios-plugins/lib/HariSekhonUtils.pm line 565
HariSekhonUtils::try('CODE(0x1859ca8)') called at /github/nagios-plugins/check_kafka.pl line 383

C:\Windows\system32>

Brokers are up and working

C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.pl -B server1:9092,server2:9092,server3:9092 --list-topics
Topics:

__confluent.support.metrics
__consumer_offsets
mi_topic

Just in case I have tested zookeeper and the plugin works fine:

C:\Windows\system32>docker run harisekhon/nagios-plugins check_zookeeper.pl -H server1 -P 2181
OK: ZooKeeper Mode follower, avg latency 0, outstanding requests 0, version 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
(state file wasn't found, stats will be available from next run)

C:\Windows\system32>docker run harisekhon/nagios-plugins check_zookeeper.pl -H server2 -P 2181
OK: ZooKeeper Mode leader, avg latency 0, outstanding requests 0, version 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT (s
tate file wasn't found, stats will be available from next run)

C:\Windows\system32>docker run harisekhon/nagios-plugins check_zookeeper.pl -H server3 -P 2181
OK: ZooKeeper Mode follower, avg latency 1, outstanding requests 0, version 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
(state file wasn't found, stats will be available from next run)

C:\Windows\system32>

So not seems a connectivity issue.

Any suggestion?

Thanks in advanced.

BTW: testing --list-topics with check_kafka.py is not working :-(

C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.py -B server1:9092,server2:9092,server3:9092
 --list-topics
Kafka Topics:

CRITICAL: NoBrokersAvailable: NoBrokersAvailable. Could not connect to Kafka broker(s) 'server1:9092, server2:9092, server3:9092'

C:\Windows\system32>

GAberasturi avatar Oct 03 '18 20:10 GAberasturi

Try using -v -v -v with each plugin to get debug output and paste here.

You can use anonymize.py from DevOps Python Tools repo if you want to redact your hostname/IP addresses from the text before pasting it here.

HariSekhon avatar Nov 05 '18 18:11 HariSekhon

Hello,

Requiered outputs.

C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.pl -B server1:9092,server2:9092,server3:9092
 --list-topics
Topics:

__confluent.support.metrics
__consumer_offsets
mi_topic
C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.pl -B server1:9092,server2:9092,server3:9092 -T mi_topic -p 0 -vvv
verbose mode on

check_kafka.pl version 0.3  =>  Hari Sekhon Utils version 1.18.14

broker host:              server1
broker port:              9092
broker host:              server2
broker port:              9092
broker host:              server3
broker port:              9092
host:                     server1
port:                     9092
topic:                    mi_topic
partition:                0
required acks:            1
send-max-attempts:        1
receive-max-attempts:     1
retry-backoff:            200
sleep:                    0.5

setting timeout to 10 secs

connecting to Kafka brokers server1:9092,server2:9092,server3:9092

Metadata:

Kafka topic '__confluent.support.metrics' partitions:
UNKNOWN: '__confluent.support.metrics' '__confluent' field not found. API may have changed. Please try latest version from https://github.com/harisekhon/na
gios-plugins, re-run on command line with -vvv and if problem persists paste full output from -vvv mode in to a ticket requesting a fix/update at https://g
ithub.com/harisekhon/nagios-plugins/issues/new

C:\Windows\system32>

Not sure why is trying to check '__confluent.support.metrics' topic if I put 'mi_topic'

C:\Windows\system32>docker run harisekhon/nagios-plugins check_kafka.py -B server1:9092,server2:9092,server3:9092 --list-topics -vvv
2018-11-06 18:56:18,290 - cli.py[__parse_timeout__:387](1) - DEBUG - getting $TIMEOUT value None
2018-11-06 18:56:18,297 - cli.py[__parse_timeout__:397](1) - DEBUG - timeout not set, using default timeout 10
2018-11-06 18:56:18,298 - utils.py[log_option:2213](1) - INFO  - timeout:  10
2018-11-06 18:56:18,299 - cli.py[timeout:254](1) - DEBUG - setting timeout to 10 secs
2018-11-06 18:56:18,299 - cli.py[main:159](1) - INFO  - Hari Sekhon check_kafka.py version 0.5.2 =>  CLI version 0.3 =>  Utils version 0.11.5
2018-11-06 18:56:18,300 - cli.py[main:160](1) - INFO  - https://github.com/harisekhon/nagios-plugins
2018-11-06 18:56:18,300 - cli.py[main:161](1) - INFO  - verbose level: 3 (DEBUG)
2018-11-06 18:56:18,301 - utils.py[log_option:2213](1) - INFO  - timeout:  10
2018-11-06 18:56:18,304 - cli.py[main:164](1) - DEBUG - setting timeout alarm (10)
2018-11-06 18:56:18,446 - utils.py[log_option:2213](1) - INFO  - host:port:  server1:9092
2018-11-06 18:56:18,498 - utils.py[log_option:2213](1) - INFO  - host:port:  server2:9092
2018-11-06 18:56:18,498 - utils.py[log_option:2213](1) - INFO  - host:port:  server3:9092
2018-11-06 18:56:18,499 - utils.py[log_option:2213](1) - INFO  - brokers:  server1:9092, server2:9092, server3:90
92
Kafka Topics:

CRITICAL: NoBrokersAvailable: NoBrokersAvailable. Could not connect to Kafka broker(s) 'server1:9092, server2:9092, server3:9092'

Traceback (most recent call last):
  File "/github/nagios-plugins/pylib/harisekhon/nagiosplugin/nagiosplugin.py", line 242, in main
    super(NagiosPlugin, self).main()
  File "/github/nagios-plugins/pylib/harisekhon/cli.py", line 171, in main
    self.process_args()
  File "/github/nagios-plugins/check_kafka.py", line 170, in process_args
    raise CriticalError(self.exception_msg())
CriticalError: NoBrokersAvailable: NoBrokersAvailable. Could not connect to Kafka broker(s) 'server1:9092, server2:9092, server3:9092'

C:\Windows\system32>

Let me know if you need more information or tests

Thank you very much.

GAberasturi avatar Nov 06 '18 19:11 GAberasturi

I have the same issue with check_kafka.py :( and list-topics script works fine.

KlavsKlavsen avatar Jun 21 '19 11:06 KlavsKlavsen