browbeat/lib/Connmon.py
Joe Talerico 8a542ef8ec Migrate browbeat.sh to Python
Learning the Ansible API for this migration. Very simple script
that will use the browbeat checks

+ Added Pbench start/stop 01/11/16
+ Moved ansible to config 01/11/16
+ Adding ansible hosts option 01/11/16
+ Connmon added (start/stop) still nothing with results 01/12/16
+ New Rally YAML format... (nova example) 01/12/16
+ Create results directory 01/12/16
+ Created lib with classes 01/13/16
+ Updated Scenarios 01/14/16
+ Updated other workloads to new format 01/15/16
+ Switched to dict get method 01/15/16
+ Removed pyc files and updated 01/15/16
+ updated genhost file 01/15/16
+ Update Ansible for connmon finished pbench work 01/15/16
+ Catch if user tries to run without Ansible or Ansible2 01/26/16
+ Minor changes 01/26/16
+ Bug fix... 01/27/16
+ (akrzos) added keystone yamls and browbeat-complete.yaml
+ Moved BrowbeatRally to Rally and broke connmon out of Tools
+ (akrzos) Implemented per Rally test scenario task args.
+ Updated Docs, removed old browbeat.sh
+ (akrzos) Cleaned up lib/Rally.py and added cinder scenarios to browbeat configs.
+ Fix Connmon install issue
+ (akrzos) Added parameters to neutron task yamls
+ (akrzos) Changed connmon to stop logging immediately after rally task completes.
Change-Id: I338c3463e25f38c2ec7667c7dfc8b5424acba8c2
2016-01-29 21:24:34 +01:00

46 lines
1.5 KiB
Python

from Tools import *
class Connmon :
def __init__(self,config):
self.logger = logging.getLogger('browbeat.Connmon')
self.config = config
self.tools = Tools(self.config)
return None
# Start connmond
def start_connmon(self):
self.stop_connmon()
tool="connmond"
connmond=self.tools.find_cmd(tool)
if not connmond :
self.logger.error("Unable to find {}".format(tool))
as_sudo = self.config['browbeat']['sudo']
cmd = ""
if as_sudo :
cmd +="sudo "
cmd += "screen -X -S connmond kill"
self.tools.run_cmd(cmd)
self.logger.info("Starting connmond")
cmd = ""
cmd +="{} --config /etc/connmon.cfg > /tmp/connmond 2>&1 &".format(connmond)
return self.tools.run_cmd(cmd)
# Stop connmond
def stop_connmon(self):
self.logger.info("Stopping connmond")
return self.tools.run_cmd("pkill -9 connmond")
# Create Connmon graphs
def connmon_graphs(self,result_dir,test_name):
cmd="python graphing/connmonplot.py {}/connmon/{}.csv".format(result_dir,
test_name)
return self.tools.run_cmd(cmd)
# Move connmon results
def move_connmon_results(self,result_dir,test_name):
path = "%s/connmon" % result_dir
if not os.path.exists(path) :
os.mkdir(path)
return shutil.move("/tmp/connmon_results.csv",
"{}/connmon/{}.csv".format(result_dir,test_name))