Menu Search

find_agents.py

import qpid_messaging
import qmf2

class FindAgents(qmf2.ConsoleHandler):

  def __init__(self, session):
    qmf2.ConsoleHandler.__init__(self, session)

  def agentAdded(self, agent):
    print "Agent Added: %r" % agent

  def agentDeleted(self, agent, reason):
    print "Agent Deleted: %r reason: %s" % (agent, reason)

  def agentRestarted(self, agent):
    print "Agent Restarted: %r" % agent

  def agentSchemaUpdated(self, agent):
    print "Agent Schema Updated: %r" % agent

  def eventRaised(self, agent, data, timestamp, severity):
    print "Event: data=%r time=%d sev=%d" % (data.getProperties(), timestamp, severity)



url     = "localhost"
options = ""

connection = qpid_messaging.Connection(url, options)
connection.open()

session = qmf2.ConsoleSession(connection)
session.open()
session.setAgentFilter("[]")

main = FindAgents(session)
main.run()

Download this file