Пример #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)
Пример #2
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)
Пример #3
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)
Пример #4
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)