Author: tross
Date: Wed Nov 13 20:45:23 2013
New Revision: 1541700

URL: http://svn.apache.org/r1541700
Log:
NO-JIRA - Added general router data to management (added -g option to qdstat).

Modified:
    qpid/dispatch/trunk/src/router_agent.c
    qpid/dispatch/trunk/tools/src/py/qdstat

Modified: qpid/dispatch/trunk/src/router_agent.c
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/router_agent.c?rev=1541700&r1=1541699&r2=1541700&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/router_agent.c (original)
+++ qpid/dispatch/trunk/src/router_agent.c Wed Nov 13 20:45:23 2013
@@ -61,6 +61,14 @@ static void dx_router_query_router(dx_ro
     dx_agent_value_string(cor, "area",      router->router_area);
     dx_agent_value_string(cor, "router_id", router->router_id);
 
+    char *mode = "";
+    switch (router->router_mode) {
+    case DX_ROUTER_MODE_STANDALONE:  mode = "Standalone";  break;
+    case DX_ROUTER_MODE_INTERIOR:    mode = "Interior";    break;
+    case DX_ROUTER_MODE_EDGE:        mode = "Edge";        break;
+    }
+    dx_agent_value_string(cor, "mode", mode);
+
     sys_mutex_lock(router->lock);
     dx_agent_value_uint(cor, "addr_count", DEQ_SIZE(router->addrs));
     dx_agent_value_uint(cor, "link_count", DEQ_SIZE(router->links));

Modified: qpid/dispatch/trunk/tools/src/py/qdstat
URL: 
http://svn.apache.org/viewvc/qpid/dispatch/trunk/tools/src/py/qdstat?rev=1541700&r1=1541699&r2=1541700&view=diff
==============================================================================
--- qpid/dispatch/trunk/tools/src/py/qdstat (original)
+++ qpid/dispatch/trunk/tools/src/py/qdstat Wed Nov 13 20:45:23 2013
@@ -73,7 +73,7 @@ def OptionsAndArguments(argv):
     parser.add_option_group(group1)
 
     group2 = OptionGroup(parser, "Command Options")
-    group2.add_option("-g", "--general", help="Show General Broker Stats",  
action="store_const", const="g",   dest="show")
+    group2.add_option("-g", "--general", help="Show General Router Stats",  
action="store_const", const="g",   dest="show")
     group2.add_option("-c", "--connections", help="Show Connections",       
action="store_const", const="c",   dest="show")
     group2.add_option("-l", "--links", help="Show Router Links",            
action="store_const", const="l",   dest="show")
     group2.add_option("-n", "--nodes", help="Show Router Nodes",            
action="store_const", const="n",   dest="show")
@@ -160,6 +160,39 @@ class BusManager:
             return "-"
         return addr[1:]
 
+    def displayGeneral(self):
+        disp = Display(prefix="  ")
+        heads = []
+        heads.append(Header("attr"))
+        heads.append(Header("value"))
+        rows = []
+
+        request = Message()
+        response = Message()
+
+        request.address = self.address
+        request.reply_to = self.reply
+        request.correlation_id = 1
+        request.properties = {u'operation':u'GET', 
u'type':u'org.apache.qpid.dispatch.router'}
+
+        self.M.put(request)
+        self.M.send()
+
+        self.M.recv()
+        self.M.get(response)
+
+        router = response.body[0]
+        rows.append(('Mode',          router['mode']))
+        rows.append(('Area',          router['area']))
+        rows.append(('Router Id',     router['router_id']))
+        rows.append(('Address Count', router['addr_count']))
+        rows.append(('Link Count',    router['link_count']))
+        rows.append(('Node Count',    router['node_count']))
+
+        title = "Router Statistics"
+        dispRows = rows
+        disp.formattedTable(title, heads, dispRows)
+
     def displayRouterLinks(self):
         disp = Display(prefix="  ")
         heads = []
@@ -336,6 +369,7 @@ class BusManager:
         elif main == 'n': self.displayRouterNodes()
         elif main == 'a': self.displayAddresses()
         elif main == 'm': self.displayMemory()
+        elif main == 'g': self.displayGeneral()
         elif main == 'c': self.displayConnections()
 
     def display(self, names):



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to