diff options
| author | Carl C. Trieloff <cctrieloff@apache.org> | 2008-04-24 15:24:51 +0000 |
|---|---|---|
| committer | Carl C. Trieloff <cctrieloff@apache.org> | 2008-04-24 15:24:51 +0000 |
| commit | 841ceb18e777e49ccddc189419265f5e0b20fedf (patch) | |
| tree | cdd95ace16bdd35e40970ee6861f8b8e1c67c0ea /python/commands/qpid-queue-stats | |
| parent | d42b7bc8854f30c397c65641bc7adaeb21808e21 (diff) | |
| download | qpid-python-841ceb18e777e49ccddc189419265f5e0b20fedf.tar.gz | |
QPID-953 from tross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@651290 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/commands/qpid-queue-stats')
| -rwxr-xr-x | python/commands/qpid-queue-stats | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/python/commands/qpid-queue-stats b/python/commands/qpid-queue-stats index 6e3579edfd..ff28e5b50c 100755 --- a/python/commands/qpid-queue-stats +++ b/python/commands/qpid-queue-stats @@ -24,7 +24,6 @@ import getopt import sys import socket import qpid -import uuid from threading import Condition from qpid.management import managementClient from qpid.peer import Closed @@ -86,14 +85,18 @@ class BrokerManager: def ConnectToBroker (self): try: self.spec = qpid.spec.load (specpath) + self.sessionId = "%s.%d" % (os.uname()[1], os.getpid()) self.conn = Connection (connect (self.broker.host, self.broker.port), self.spec) self.conn.start () self.mclient = managementClient (self.spec, None, self.configCb, self.instCb) - self.mchannel = self.mclient.addChannel (self.conn.session(str(uuid.uuid4()))) + self.mchannel = self.mclient.addChannel (self.conn.session(self.sessionId)) except socket.error, e: print "Connect Error:", e exit (1) + def Disconnect (self): + self.mclient.removeChannel (self.mchannel) + def configCb (self, context, classKey, row, timestamps): className = classKey[1] if className != "queue": @@ -131,12 +134,16 @@ class BrokerManager: (name, deltaTime / 1000000000, obj.msgDepthLow, obj.msgDepthHigh, enqueueRate, dequeueRate) - def Overview (self): + def Display (self): self.ConnectToBroker () print "Queue Name Sec Depth Range Enq Rate Deq Rate" print "===================================================================================================" - while True: - sleep (1) + try: + while True: + sleep (1) + except KeyboardInterrupt: + pass + self.Disconnect () ## ## Main Program @@ -156,4 +163,4 @@ for opt in optlist: nargs = len (cargs) bm = BrokerManager () bm.SetBroker (Broker (host)) -bm.Overview () +bm.Display () |
