Module: sems
Branch: master
Commit: 271fcfacba04bfcf9f06ec77271769e33f658a29
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=271fcfacba04bfcf9f06ec77271769e33f658a29

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Thu May  3 17:28:54 2012 +0200

monitoring: tools: add --full option to list scripts

---

 apps/monitoring/tools/sems-list-active-calls |   20 ++++++++++++++++++--
 apps/monitoring/tools/sems-list-calls        |   19 +++++++++++++++++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/apps/monitoring/tools/sems-list-active-calls 
b/apps/monitoring/tools/sems-list-active-calls
index b144745..a7269c7 100755
--- a/apps/monitoring/tools/sems-list-active-calls
+++ b/apps/monitoring/tools/sems-list-active-calls
@@ -1,7 +1,23 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-
 from xmlrpclib import *
+import pprint
+import sys
+
+if len(sys.argv) == 2 and sys.argv[1] == '--help':
+  print "usage: %s [--full]" % sys.argv[0]
+  sys.exit(1)
+
 s = ServerProxy('http://localhost:8090')
 print "Active calls: %d" % s.calls()
-print s.di('monitoring','listActive')
+ids = s.di('monitoring','listActive')
+
+pp = pprint.PrettyPrinter(indent=4)
+pp.pprint(ids)
+
+if len(sys.argv) == 2 and sys.argv[1] == '--full':
+  for callid in ids:
+      attrs = s.di('monitoring','get', callid)
+      print '----- %s -----' % callid
+      pp.pprint(attrs)
+
diff --git a/apps/monitoring/tools/sems-list-calls 
b/apps/monitoring/tools/sems-list-calls
index ce752da..1d4ac63 100755
--- a/apps/monitoring/tools/sems-list-calls
+++ b/apps/monitoring/tools/sems-list-calls
@@ -1,7 +1,22 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-
 from xmlrpclib import *
+import pprint
+import sys
+
+if len(sys.argv) == 2 and sys.argv[1] == '--help':
+  print "usage: %s [--full]" % sys.argv[0]
+  sys.exit(1)
+
 s = ServerProxy('http://localhost:8090')
 print "Active calls: %d" % s.calls()
-print s.di('monitoring','list')
+ids = s.di('monitoring','list')
+
+pp = pprint.PrettyPrinter(indent=4)
+pp.pprint(ids)
+
+if len(sys.argv) == 2 and sys.argv[1] == '--full':
+  for callid in ids:
+      attrs = s.di('monitoring','get', callid)
+      print '----- %s -----' % callid
+      pp.pprint(attrs)

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to