summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-05-14 03:44:45 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-05-14 03:44:45 +0000
commita3c2d24f421faef2928ec63db70633838d472032 (patch)
treea052e36e8f28a8b6a947b69dd9c157af6b56bea0 /src/lib
parent8cd988d6347e79d5ff8b36f3dd625d1b45e5ef40 (diff)
downloadbcfg2-a3c2d24f421faef2928ec63db70633838d472032.tar.gz
bcfg2-a3c2d24f421faef2928ec63db70633838d472032.tar.bz2
bcfg2-a3c2d24f421faef2928ec63db70633838d472032.zip
Implement perf-reporting client
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5227 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Admin/Perf.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/Server/Admin/Perf.py b/src/lib/Server/Admin/Perf.py
new file mode 100644
index 000000000..0cbb93e17
--- /dev/null
+++ b/src/lib/Server/Admin/Perf.py
@@ -0,0 +1,37 @@
+import Bcfg2.Options
+import Bcfg2.Proxy
+import Bcfg2.Server.Admin
+
+import sys
+
+class Perf(Bcfg2.Server.Admin.Mode):
+ __shorthelp__ = ("Query server for performance data")
+ __longhelp__ = (__shorthelp__ + "\n\nbcfg2-admin perf")
+ __usage__ = ("bcfg2-admin perf")
+
+ def __init__(self, configfile):
+ Bcfg2.Server.Admin.Mode.__init__(self, configfile)
+
+ def __call__(self, args):
+ output = [('Name', 'Min', 'Max', 'Mean')]
+ optinfo = {
+ 'server': Bcfg2.Options.SERVER_LOCATION,
+ 'user': Bcfg2.Options.CLIENT_USER,
+ 'password': Bcfg2.Options.SERVER_PASSWORD,
+ 'key': Bcfg2.Options.SERVER_KEY,
+ 'certificate' : Bcfg2.Options.CLIENT_CERT,
+ 'ca' : Bcfg2.Options.CLIENT_CA
+ }
+ setup = Bcfg2.Options.OptionParser(optinfo)
+ setup.parse(sys.argv[2:])
+ proxy = Bcfg2.Proxy.ComponentProxy(setup['server'],
+ setup['user'],
+ setup['password'],
+ key = setup['key'],
+ cert = setup['certificate'],
+ ca = setup['ca'])
+ data = proxy.get_statistics()
+ for key, value in data.iteritems():
+ output.append((key, ) + tuple(["%.06f" % (item) for item in value]))
+ self.print_table(output)
+