jasonmcintosh / rabbitmq-nagios-plugins Goto Github PK
View Code? Open in Web Editor NEWSet of python based rabbitmq plugins
License: Apache License 2.0
Set of python based rabbitmq plugins
License: Apache License 2.0
Would be nice if the overview script would actually hit the overview api. Something like this would do well I believe:
#!/usr/bin/env python
from pynagios import make_option
from base_rabbit_check import BaseRabbitCheck
class RabbitQueueCheck(BaseRabbitCheck):
"""
performs a nagios compliant check on a single queue and
attempts to catch all errors. expected usage is with a critical threshold of 0
"""
#vhost = make_option("--vhost", dest="vhost", help="RabbitMQ vhost", type="string", default='%2F')
overview = ''
overview = make_option("--overview", dest="overview", help="messages, object", type="string")
def makeUrl(self):
"""
forms self.url, a correct url to polling a rabbit queue
"""
try:
if self.options.use_ssl is True:
self.url = "https://%s:%s/api/overview" % (self.options.hostname, self.options.port)
else:
self.url = "http://%s:%s/api/overview" % (self.options.hostname, self.options.port)
return True
except Exception, e:
self.rabbit_error = 3
self.rabbit_note = "problem forming api url:", e
return False
def testOptions(self):
"""
returns false if necessary options aren't present
"""
if not self.options.hostname or not self.options.port:
return False
return True
def setPerformanceData(self, data, result):
if self.options.overview == "messages":
result.set_perf_data("messages", data['queue_totals']['messages'])
result.set_perf_data("rate", data['queue_totals']['messages_details']['rate'])
result.set_perf_data("messages_ready", data['queue_totals']['messages_ready'])
result.set_perf_data("messages_unacknowledged", data['queue_totals']['messages_unacknowledged'])
else:
result.set_perf_data("channels", data['object_totals']['channels'])
result.set_perf_data("connections", data['object_totals']['connections'])
result.set_perf_data("consumers", data['object_totals']['consumers'])
result.set_perf_data("exchanges", data['object_totals']['exchanges'])
result.set_perf_data("queues", data['object_totals']['queues'])
#result.set_perf_data("rabbit_error", self.rabbit_error)
return result
def parseResult(self, data):
if self.options.overview == "messages":
result = self.response_for_value(data['queue_totals'])
result.message = data['queue_totals']
else:
result = self.response_for_value(data['object_totals'])
result.message = data['object_totals']
return result
if name == "main":
obj = RabbitQueueCheck()
obj.check().exit()
The check_rabbit_server.py script shows this error msg:
UNKNOWN: Error occurred:local variable 'nodeData' referenced before assignment
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.