|
@@ -1,6 +1,7 @@
|
|
import os
|
|
import os
|
|
import time
|
|
import time
|
|
import click
|
|
import click
|
|
|
|
+import json
|
|
from kamcli.cli import pass_context
|
|
from kamcli.cli import pass_context
|
|
from kamcli.iorpc import command_ctl
|
|
from kamcli.iorpc import command_ctl
|
|
|
|
|
|
@@ -26,14 +27,29 @@ def cli(ctx, norefresh):
|
|
clear = lambda : os.system('tput reset')
|
|
clear = lambda : os.system('tput reset')
|
|
count = 0
|
|
count = 0
|
|
slist = [ "rcv_requests", "fwd_requests", "rcv_replies", "fwd_replies",
|
|
slist = [ "rcv_requests", "fwd_requests", "rcv_replies", "fwd_replies",
|
|
- "sent_replies", "tmx:", "usrloc:" ]
|
|
|
|
|
|
+ "free_size", "sent_replies", "tmx:", "usrloc:" ]
|
|
if norefresh is True:
|
|
if norefresh is True:
|
|
- command_ctl(ctx, 'stats.get_statistics', slist)
|
|
|
|
|
|
+ command_ctl(ctx, 'stats.get_statistics', slist, {"func": cmd_moni_result_print})
|
|
else:
|
|
else:
|
|
while True:
|
|
while True:
|
|
count = count + 1
|
|
count = count + 1
|
|
- command_ctl(ctx, 'stats.get_statistics', slist)
|
|
|
|
|
|
+ command_ctl(ctx, 'stats.get_statistics', slist, {"func": cmd_moni_result_print})
|
|
|
|
+ print
|
|
print "[cycle #: " + str(count) + "; if constant make sure server is running]"
|
|
print "[cycle #: " + str(count) + "; if constant make sure server is running]"
|
|
time.sleep(2)
|
|
time.sleep(2)
|
|
clear()
|
|
clear()
|
|
|
|
|
|
|
|
+
|
|
|
|
+##
|
|
|
|
+#
|
|
|
|
+#
|
|
|
|
+def cmd_moni_result_print(ctx, response, params=None):
|
|
|
|
+ ctx.vlog("formatting the response for command ps")
|
|
|
|
+ print
|
|
|
|
+ rdata = json.loads(response)
|
|
|
|
+ if "result" in rdata:
|
|
|
|
+ rd = rdata["result"]
|
|
|
|
+ for a,b in zip(rd[::2],rd[1::2]):
|
|
|
|
+ print '{:<40}{:<}'.format(a,b)
|
|
|
|
+ else:
|
|
|
|
+ print json.dumps(rdata, indent=4, separators=(',', ': '))
|