HariSekhon / Nagios-Plugins

450+ AWS, Hadoop, Cloud, Kafka, Docker, Elasticsearch, RabbitMQ, Redis, HBase, Solr, Cassandra, ZooKeeper, HDFS, Yarn, Hive, Presto, Drill, Impala, Consul, Spark, Jenkins, Travis CI, Git, MySQL, Linux, DNS, Whois, SSL Certs, Yum Security Updates, Kubernetes, Cloudera etc...
https://www.linkedin.com/in/HariSekhon
Other
1.14k stars 506 forks source link

check_rabbitmq.py #422

Closed rschrekker closed 6 months ago

rschrekker commented 6 months ago

I try to check RabbitMQ hosted at cloudamqp.com.

./check_rabbitmq.py -H 3.75.124.86 -S -P 5671 -u xpmonitor -p SECRET -O casual-olive-boar-01

UNKNOWN: Nagios Plugin Exception: AttributeError: module 'pika.exceptions' has no attribute 'RecursionError'.

DEBUG:

2024-05-01 11:25:32,538 - cli.py__parse_verbose__:379 - DEBUG - enabling debug logging 2024-05-01 11:25:32,538 - cli.pyverbose:303 - DEBUG - setting verbose to 3 2024-05-01 11:25:32,538 - cli.py__parse_timeout__:394 - DEBUG - getting $TIMEOUT value None 2024-05-01 11:25:32,538 - cli.py__parse_timeout__:404 - DEBUG - timeout not set, using default timeout 10 2024-05-01 11:25:32,538 - utils.pylog_option:2264 - INFO - timeout: 10 2024-05-01 11:25:32,538 - cli.pytimeout:260 - DEBUG - setting timeout to 10 secs 2024-05-01 11:25:32,538 - cli.pymain:165 - INFO - Hari Sekhon check_rabbitmq.py version 0.5.2 => CLI version 0.3.1 => Utils version 0.14.0 2024-05-01 11:25:32,538 - cli.pymain:166 - INFO - https://github.com/HariSekhon/Nagios-Plugins 2024-05-01 11:25:32,538 - cli.pymain:167 - INFO - verbose level: 3 (DEBUG) 2024-05-01 11:25:32,538 - utils.pylog_option:2264 - INFO - timeout: 10 2024-05-01 11:25:32,538 - cli.pymain:170 - DEBUG - setting timeout alarm (10) 2024-05-01 11:25:32,538 - utils.pylog_option:2264 - INFO - host: 3.75.124.86 2024-05-01 11:25:32,538 - utils.pylog_option:2264 - INFO - port: 5671 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - user: xpmonitor 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - password: 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - vhost: casual-olive-boar-01 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - exchange: 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - exchange type: direct 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - queue: None 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - routing key: None 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - no ack: True 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - connection attempts: 1 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - retry delay: 0 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - non-durable: False 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - sleep_secs: 1.0 2024-05-01 11:25:32,539 - pubsub_nagiosplugin.pysleep_secs:117 - DEBUG - setting sleep secs to 1.0 secs 2024-05-01 11:25:32,539 - utils.pylog_option:2264 - INFO - sleep secs: 1.0 2024-05-01 11:25:32,539 - threshold.pyinit:50 - DEBUG - warning threshold simple = upper 2024-05-01 11:25:32,539 - threshold.pyinit:51 - DEBUG - warning threshold positive = True 2024-05-01 11:25:32,539 - threshold.pyinit:52 - DEBUG - warning threshold integer = True 2024-05-01 11:25:32,539 - threshold.pyinit:53 - DEBUG - warning threshold min = None 2024-05-01 11:25:32,539 - threshold.pyinit:54 - DEBUG - warning threshold max = None 2024-05-01 11:25:32,539 - threshold.py__parse_threshold__:72 - DEBUG - warning threshold given = '1' 2024-05-01 11:25:32,540 - threshold.py__parse_threshold__:106 - DEBUG - warning threshold upper boundary = 1.0 2024-05-01 11:25:32,540 - threshold.py__parse_threshold__:107 - DEBUG - warning threshold lower boundary = None 2024-05-01 11:25:32,540 - utils.pylog_option:2264 - INFO - warning: 1 2024-05-01 11:25:32,540 - threshold.pyinit:50 - DEBUG - critical threshold simple = upper 2024-05-01 11:25:32,540 - threshold.pyinit:51 - DEBUG - critical threshold positive = True 2024-05-01 11:25:32,540 - threshold.pyinit:52 - DEBUG - critical threshold integer = True 2024-05-01 11:25:32,540 - threshold.pyinit:53 - DEBUG - critical threshold min = None 2024-05-01 11:25:32,540 - threshold.pyinit:54 - DEBUG - critical threshold max = None 2024-05-01 11:25:32,540 - threshold.py__parse_threshold__:72 - DEBUG - critical threshold given = '2' 2024-05-01 11:25:32,540 - threshold.py__parse_threshold__:106 - DEBUG - critical threshold upper boundary = 2.0 2024-05-01 11:25:32,540 - threshold.py__parse_threshold__:107 - DEBUG - critical threshold lower boundary = None 2024-05-01 11:25:32,540 - utils.pylog_option:2264 - INFO - critical: 2 2024-05-01 11:25:32,540 - pubsub_nagiosplugin.pyrun:122 - INFO - subscribing 2024-05-01 11:25:32,540 - nagiosplugin.pymain:261 - DEBUG - exception: 'AttributeError' 2024-05-01 11:25:32,541 - nagiosplugin.pymain:262 - DEBUG - Traceback (most recent call last): File "./check_rabbitmq.py", line 168, in run super(CheckRabbitMQ, self).run() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/pubsub_nagiosplugin.py", line 123, in run self.subscribe() File "./check_rabbitmq.py", line 263, in subscribe parameters = pika.ConnectionParameters(host=self.host, File "/usr/local/lib/python3.8/dist-packages/pika/connection.py", line 656, in init raise TypeError('unexpected kwargs: %r' % (kwargs,)) TypeError: unexpected kwargs: {'heartbeat_interval': 1, 'ssl': False, 'backpressure_detection': True}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/nagiosplugin.py", line 246, in main super(NagiosPlugin, self).main() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/cli.py", line 179, in main self.run() File "./check_rabbitmq.py", line 169, in run except (pika.exceptions.AMQPError, pika.exceptions.ChannelError, pika.exceptions.RecursionError): AttributeError: module 'pika.exceptions' has no attribute 'RecursionError'

UNKNOWN: Nagios Plugin Exception: Traceback (most recent call last): File "./check_rabbitmq.py", line 168, in run super(CheckRabbitMQ, self).run() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/pubsub_nagiosplugin.py", line 123, in run self.subscribe() File "./check_rabbitmq.py", line 263, in subscribe parameters = pika.ConnectionParameters(host=self.host, File "/usr/local/lib/python3.8/dist-packages/pika/connection.py", line 656, in init raise TypeError('unexpected kwargs: %r' % (kwargs,)) TypeError: unexpected kwargs: {'heartbeat_interval': 1, 'ssl': False, 'backpressure_detection': True}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/nagiosplugin.py", line 246, in main super(NagiosPlugin, self).main() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/cli.py", line 179, in main self.run() File "./check_rabbitmq.py", line 169, in run except (pika.exceptions.AMQPError, pika.exceptions.ChannelError, pika.exceptions.RecursionError): AttributeError: module 'pika.exceptions' has no attribute 'RecursionError'. Please try latest version from https:/github.com/HariSekhon/Nagios-Plugins and if problem persists paste the full output using the --debug switch in to a ticket for a fix/update at https://github.com/HariSekhon/Nagios-Plugins/issues

Traceback (most recent call last): File "./check_rabbitmq.py", line 168, in run super(CheckRabbitMQ, self).run() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/pubsub_nagiosplugin.py", line 123, in run self.subscribe() File "./check_rabbitmq.py", line 263, in subscribe parameters = pika.ConnectionParameters(host=self.host, File "/usr/local/lib/python3.8/dist-packages/pika/connection.py", line 656, in init raise TypeError('unexpected kwargs: %r' % (kwargs,)) TypeError: unexpected kwargs: {'heartbeat_interval': 1, 'ssl': False, 'backpressure_detection': True}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/nagiosplugin/nagiosplugin.py", line 246, in main super(NagiosPlugin, self).main() File "/opt/opsview/monitoringscripts/plugins/Nagios-Plugins/pylib/harisekhon/cli.py", line 179, in main self.run() File "./check_rabbitmq.py", line 169, in run except (pika.exceptions.AMQPError, pika.exceptions.ChannelError, pika.exceptions.RecursionError): AttributeError: module 'pika.exceptions' has no attribute 'RecursionError'

HariSekhon commented 6 months ago

The upstream developers changed the pika library, huge breaking changes. It'll probably work if you stick to the library version in the requirements.txt.

Since I'm not using RabbitMQ any more, I don't have any plans to rewrite the code to work with the newer library versions in the near future.

You're welcome to submit a pull request for the newer library versions if you have time.

rschrekker commented 6 months ago

Installed the required pika version, which also gives an error unfortunately.

pip install pika==0.10.0 Collecting pika==0.10.0 Downloading pika-0.10.0-py2.py3-none-any.whl (92 kB) |████████████████████████████████| 92 kB 466 kB/s Installing collected packages: pika Attempting uninstall: pika Found existing installation: pika 1.3.2 Uninstalling pika-1.3.2: Successfully uninstalled pika-1.3.2 Successfully installed pika-0.10.0

./check_rabbitmq.py -S -H 3.75.124.86 -P 5671 -u xpmonitor -p SECRET -O casual-olive-boar-01 --debug

Traceback (most recent call last): File "./check_rabbitmq.py", line 54, in import pika File "/usr/local/lib/python3.8/dist-packages/pika/init.py", line 22, in from pika.adapters import BaseConnection File "/usr/local/lib/python3.8/dist-packages/pika/adapters/init.py", line 39, in from pika.adapters.libev_connection import LibevConnection File "/usr/local/lib/python3.8/dist-packages/pika/adapters/libev_connection.py", line 103 self.async = None ^

rschrekker commented 6 months ago

o wait.. i also see this in the requirements.txt

pika 0.10 doesn't work on Python 3.7 due to async becoming keyword - https://github.com/pika/pika/issues/921

im using python 3.8