Exemplo n.º 1
0
 def displaySubscriptions(self):
     disp = Display(prefix="  ")
     heads = []
     jsonContainer =[]
     heads.append(Header("subscr"))
     heads.append(Header("queue"))
     heads.append(Header("conn"))
     heads.append(Header("procName"))
     heads.append(Header("procId"))
     heads.append(Header("browse", Header.Y))
     heads.append(Header("acked", Header.Y))
     heads.append(Header("excl", Header.Y))
     heads.append(Header("creditMode"))
     heads.append(Header("delivered", Header.COMMAS))
     heads.append(Header("sessUnacked", Header.COMMAS))
     rows = []
     subscriptions = self.broker.getAllSubscriptions()
     sessions = self.getSessionMap()
     connections = self.getConnectionMap()
     for s in subscriptions:
         row = []
         try:
             row.append(s.name)
             row.append(s.queueRef)
             session = sessions[s.sessionRef]
             connection = connections[session.connectionRef]
             row.append(connection.address)
             row.append(connection.remoteProcessName)
             row.append(connection.remotePid)
             row.append(s.browsing)
             row.append(s.acknowledged)
             row.append(s.exclusive)
             row.append(s.creditMode)
             row.append(s.delivered)
             row.append(session.unackedMessages)
             rows.append(row)
         except:
             pass
     title = "Subscriptions"
     if config._sortcol:
         sorter = Sorter(heads, rows, config._sortcol, config._limit, config._increasing)
         dispRows = sorter.getSorted()
     else:
         dispRows = rows
         
     if config._jsonoutput:
         jsonContainer.append(rows);
         print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
     else:
         disp.formattedTable(title, heads, dispRows)
Exemplo n.º 2
0
 def displayMemory(self):
     disp = Display(prefix="  ")
     heads = [Header('Statistic'), Header('Value', Header.COMMAS)]
     rows = []
     jsonContainer =[]
     memory = self.broker.getMemory()
     for k,v in memory.values.items():
         if k != 'name':
             rows.append([k, v])
             
     if config._jsonoutput:
         jsonContainer.append(rows);
         print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
     else:                
         disp.formattedTable('Broker Memory Statistics:', heads, rows)
Exemplo n.º 3
0
 def displayQueues(self):
     disp = Display(prefix="  ")
     heads = []
     jsonContainer =[]
     heads.append(Header("queue"))
     heads.append(Header("dur", Header.Y))
     heads.append(Header("autoDel", Header.Y))
     heads.append(Header("excl", Header.Y))
     heads.append(Header("msg", Header.KMG))
     heads.append(Header("msgIn", Header.KMG))
     heads.append(Header("msgOut", Header.KMG))
     heads.append(Header("bytes", Header.KMG))
     heads.append(Header("bytesIn", Header.KMG))
     heads.append(Header("bytesOut", Header.KMG))
     heads.append(Header("cons", Header.KMG))
     heads.append(Header("bind", Header.KMG))
     rows = []
     queues = self.broker.getAllQueues()
     for q in queues:
         row = []
         row.append(q.name)
         row.append(q.durable)
         row.append(q.autoDelete)
         row.append(q.exclusive)
         row.append(q.msgDepth)
         row.append(q.msgTotalEnqueues)
         row.append(q.msgTotalDequeues)
         row.append(q.byteDepth)
         row.append(q.byteTotalEnqueues)
         row.append(q.byteTotalDequeues)
         row.append(q.consumerCount)
         row.append(q.bindingCount)
         rows.append(row)
     title = "Queues"
     if config._sortcol:
         sorter = Sorter(heads, rows, config._sortcol, config._limit, config._increasing)
         dispRows = sorter.getSorted()
     else:
         dispRows = rows
         
     if config._jsonoutput:
         jsonContainer.append(rows);
         print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
     else:
         disp.formattedTable(title, heads, dispRows)
Exemplo n.º 4
0
 def displayAcl(self):
     acl = self.broker.getAcl()
     if not acl:
         print "ACL Policy Module is not installed"
         return
     disp = Display(prefix="  ")
     heads = [Header('Statistic'), Header('Value')]
     rows = []
     jsonContainer =[]
     rows.append(['policy-file',       acl.policyFile])
     rows.append(['enforcing',         YN(acl.enforcingAcl)])
     rows.append(['has-transfer-acls', YN(acl.transferAcl)])
     rows.append(['last-acl-load',     TimeLong(acl.lastAclLoad)])
     rows.append(['acl-denials',       Commas(acl.aclDenyCount)])
     
     if config._jsonoutput:
         jsonContainer.append(rows);
         print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
     else:
         disp.formattedTable('ACL Policy Statistics:', heads, rows)
Exemplo n.º 5
0
 def displayExchange(self):
     disp = Display(prefix="  ")
     heads = []
     jsonContainer =[]
     heads.append(Header("exchange"))
     heads.append(Header("type"))
     heads.append(Header("dur", Header.Y))
     heads.append(Header("bind", Header.KMG))
     heads.append(Header("msgIn", Header.KMG))
     heads.append(Header("msgOut", Header.KMG))
     heads.append(Header("msgDrop", Header.KMG))
     heads.append(Header("byteIn", Header.KMG))
     heads.append(Header("byteOut", Header.KMG))
     heads.append(Header("byteDrop", Header.KMG))
     rows = []
     exchanges = self.broker.getAllExchanges()
     for ex in exchanges:
         row = []
         row.append(ex.name)
         row.append(ex.type)
         row.append(ex.durable)
         row.append(ex.bindingCount)
         row.append(ex.msgReceives)
         row.append(ex.msgRoutes)
         row.append(ex.msgDrops)
         row.append(ex.byteReceives)
         row.append(ex.byteRoutes)
         row.append(ex.byteDrops)
         rows.append(row)
     title = "Exchanges"
     if config._sortcol:
         sorter = Sorter(heads, rows, config._sortcol, config._limit, config._increasing)
         dispRows = sorter.getSorted()
     else:
         dispRows = rows
         
     if config._jsonoutput:
         jsonContainer.append(rows);
         print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
     else:
         disp.formattedTable(title, heads, dispRows)
Exemplo n.º 6
0
    def displayConn(self):

        disp = Display(prefix="  ")
        heads = []
        jsonContainer =[]
        heads.append(Header('connection'))
        heads.append(Header('cproc'))
        heads.append(Header('cpid'))
        heads.append(Header('mech'))
        heads.append(Header('auth'))
        heads.append(Header('connected', Header.DURATION))
        heads.append(Header('idle', Header.DURATION))
        heads.append(Header('msgIn', Header.KMG))
        heads.append(Header('msgOut', Header.KMG))
        rows = []
        connections = self.broker.getAllConnections()
        broker = self.broker.getBroker()
        for conn in connections:
            row = []
            row.append(conn.address)
            row.append(conn.remoteProcessName)
            row.append(conn.remotePid)
            row.append(conn.saslMechanism)
            row.append(conn.authIdentity)
            row.append(broker.getUpdateTime() - conn.getCreateTime())
            row.append(broker.getUpdateTime() - conn.getUpdateTime())
            row.append(conn.msgsFromClient)
            row.append(conn.msgsToClient)
            rows.append(row)
        title = "Connections"
        if config._sortcol:
            sorter = Sorter(heads, rows, config._sortcol, config._limit, config._increasing)
            dispRows = sorter.getSorted()
        else:
            dispRows = rows
            
        if config._jsonoutput:
            jsonContainer.append(rows);
            print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
        else:
            disp.formattedTable(title, heads, dispRows)
Exemplo n.º 7
0
    def displayQueue(self, name):
        queue = self.broker.getQueue(name)
        if not queue:
            print "Queue '%s' not found" % name
            return

        disp = Display(prefix="  ")
        heads = []
        jsonContainer =[]
        heads.append(Header('Name'))
        heads.append(Header('Durable', Header.YN))
        heads.append(Header('AutoDelete', Header.YN))
        heads.append(Header('Exclusive', Header.YN))
        heads.append(Header('FlowStopped', Header.YN))
        heads.append(Header('FlowStoppedCount', Header.COMMAS))
        heads.append(Header('Consumers', Header.COMMAS))
        heads.append(Header('Bindings', Header.COMMAS))
        rows = []
        rows.append([queue.name, queue.durable, queue.autoDelete, queue.exclusive,
                     queue.flowStopped, queue.flowStoppedCount,
                     queue.consumerCount, queue.bindingCount])
        if config._jsonoutput:
            jsonContainer.append(rows);
        else:
            disp.formattedTable("Properties:", heads, rows)
            print

        heads = []
        heads.append(Header('Property'))
        heads.append(Header('Value'))
        rows = []
        rows.append(['arguments', queue.arguments])
        rows.append(['alt-exchange', queue.altExchange])
        if config._jsonoutput:
            jsonContainer.append(rows);
        else:
            disp.formattedTable("Optional Properties:", heads, rows)
            print

        heads = []
        heads.append(Header('Statistic'))
        heads.append(Header('Messages', Header.COMMAS))
        heads.append(Header('Bytes', Header.COMMAS))
        rows = []
        rows.append(['queue-depth',                queue.msgDepth,           queue.byteDepth])
        rows.append(['total-enqueues',             queue.msgTotalEnqueues,   queue.byteTotalEnqueues])
        rows.append(['total-dequeues',             queue.msgTotalDequeues,   queue.byteTotalDequeues])
        rows.append(['persistent-enqueues',        queue.msgPersistEnqueues, queue.bytePersistEnqueues])
        rows.append(['persistent-dequeues',        queue.msgPersistDequeues, queue.bytePersistDequeues])
        rows.append(['transactional-enqueues',     queue.msgTxnEnqueues,     queue.byteTxnEnqueues])
        rows.append(['transactional-dequeues',     queue.msgTxnDequeues,     queue.byteTxnDequeues])
        rows.append(['flow-to-disk-depth',         queue.msgFtdDepth,        queue.byteFtdDepth])
        rows.append(['flow-to-disk-enqueues',      queue.msgFtdEnqueues,     queue.byteFtdEnqueues])
        rows.append(['flow-to-disk-dequeues',      queue.msgFtdDequeues,     queue.byteFtdDequeues])
        rows.append(['acquires',                   queue.acquires,           None])
        rows.append(['releases',                   queue.releases,           None])
        rows.append(['discards-ttl-expired',       queue.discardsTtl,        None])
        rows.append(['discards-limit-overflow',    queue.discardsOverflow,   None])
        rows.append(['discards-ring-overflow',     queue.discardsRing,       None])
        rows.append(['discards-lvq-replace',       queue.discardsLvq,        None])
        rows.append(['discards-subscriber-reject', queue.discardsSubscriber, None])
        rows.append(['discards-purged',            queue.discardsPurge,      None])
        rows.append(['reroutes',                   queue.reroutes,           None])
        
        if config._jsonoutput:
            jsonContainer.append(rows);
            print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
        else:
            disp.formattedTable("Statistics:", heads, rows)
Exemplo n.º 8
0
    def displayBroker(self):
        disp = Display(prefix="  ")
        heads = []
        jsonContainer =[]
        heads.append(Header('uptime', Header.DURATION))
        heads.append(Header('cluster', Header.NONE))
        heads.append(Header('connections', Header.COMMAS))
        heads.append(Header('sessions', Header.COMMAS))
        heads.append(Header('exchanges', Header.COMMAS))
        heads.append(Header('queues', Header.COMMAS))
        rows = []
        broker = self.broker.getBroker()
        cluster = self.broker.getCluster()
        clusterInfo = cluster and cluster.clusterName + "<" + cluster.status + ">" or "<standalone>"
        connections = self.getConnectionMap()
        sessions = self.getSessionMap()
        exchanges = self.getExchangeMap()
        queues = self.getQueueMap()
        row = (broker.getUpdateTime() - broker.getCreateTime(),
               clusterInfo,
               len(connections), len(sessions),
               len(exchanges), len(queues))
        rows.append(row)
        
        if config._jsonoutput:
            jsonContainer.append(rows);
        else:
            disp.formattedTable('Broker Summary:', heads, rows)
        

        if 'queueCount' not in broker.values:
            return

        print
        heads = []
        heads.append(Header('Statistic'))
        heads.append(Header('Messages', Header.COMMAS))
        heads.append(Header('Bytes', Header.COMMAS))
        rows = []
        rows.append(['queue-depth',         broker.msgDepth, broker.byteDepth])
        rows.append(['total-enqueues',      broker.msgTotalEnqueues, broker.byteTotalEnqueues])
        rows.append(['total-dequeues',      broker.msgTotalDequeues, broker.byteTotalDequeues])
        rows.append(['persistent-enqueues', broker.msgPersistEnqueues, broker.bytePersistEnqueues])
        rows.append(['persistent-dequeues', broker.msgPersistDequeues, broker.bytePersistDequeues])
        rows.append(['transactional-enqueues', broker.msgTxnEnqueues, broker.byteTxnEnqueues])
        rows.append(['transactional-dequeues', broker.msgTxnDequeues, broker.byteTxnDequeues])
        rows.append(['flow-to-disk-depth', broker.msgFtdDepth, broker.byteFtdDepth])
        rows.append(['flow-to-disk-enqueues', broker.msgFtdEnqueues, broker.byteFtdEnqueues])
        rows.append(['flow-to-disk-dequeues', broker.msgFtdDequeues, broker.byteFtdDequeues])
        rows.append(['acquires', broker.acquires, None])
        rows.append(['releases', broker.releases, None])
        rows.append(['discards-no-route', broker.discardsNoRoute, None])
        rows.append(['discards-ttl-expired', broker.discardsTtl, None])
        rows.append(['discards-limit-overflow', broker.discardsOverflow, None])
        rows.append(['discards-ring-overflow', broker.discardsRing, None])
        rows.append(['discards-lvq-replace', broker.discardsLvq, None])
        rows.append(['discards-subscriber-reject', broker.discardsSubscriber, None])
        rows.append(['discards-purged', broker.discardsPurge, None])
        rows.append(['reroutes', broker.reroutes, None])
        rows.append(['abandoned', broker.abandoned, None])
        rows.append(['abandoned-via-alt', broker.abandonedViaAlt, None])
        

        if config._jsonoutput:
            jsonContainer.append(rows);
            print json.dumps(jsonContainer,sort_keys=True,indent=4, separators=(',', ': '))
        else:
            disp.formattedTable('Aggregate Broker Statistics:', heads, rows)