2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/qpid/qpid_enqueuecount

49 lines
1.2 KiB
Text
Raw Normal View History

#!/usr/bin/env python
#
# Plugin to monitor Apache Qpid
2013-01-24 21:19:41 +01:00
# - graphs ingest rate (messages/sec) of queue(s) specified in config
#
# Parameters understood:
#
# queues (required) - space separated list of queues to display (regex allowed)
#
# Made by Jimmy Jones (jimmyjones2 AT gmx DOT co DOT uk)
2013-01-24 21:19:41 +01:00
#
# Licence: GPLv2
#
import re
import sys
import os
from qmf.console import Session
if not "queues" in os.environ:
print >> sys.stderr, "Missing env.queues in config"
sys.exit(-1)
output_queue = []
sess = Session()
broker = sess.addBroker()
queues = sess.getObjects(_class="queue", _package="org.apache.qpid.broker")
for q in queues:
for match in os.environ["queues"].split(" "):
if re.match(match, q.name):
output_queue.append(re.sub('[^a-zA-Z0-9_]', '_', q.name))
if len(sys.argv) > 1 and sys.argv[1] == "config":
print "graph_category Qpid";
print "graph_title Enqueue message rate";
print "graph_vlabel messages/second"
for queue in output_queue:
print "%s.label %s" % (queue, queue)
print "%s.min 0" % queue
print "%s.type COUNTER" % queue
else:
for q in queues:
qname = re.sub('[^a-zA-Z0-9_]', '_', q.name)
if qname in output_queue:
print "%s.value %u" % (qname, q.msgTotalEnqueues)
sess.delBroker(broker)