X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Favailability%2Fmonitor%2Fmonitor_process.py;h=53a6d8e4dc059ce0ed82373090b38af8d3b6dee1;hb=4f4edd840823ff6a0151e3f5220241183e27e560;hp=64e12f1dd37d806dee434ebb8bbaeded00dc2322;hpb=2733defda816a84d2b9c2e361a5970b9de4923f4;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py index 64e12f1dd..53a6d8e4d 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py @@ -29,24 +29,21 @@ class MonitorProcess(basemonitor.BaseMonitor): self.connection.wait(timeout=600) LOG.debug("ssh host success!") self.check_script = self.get_script_fullpath( - "script_tools/check_service.bash") + "ha_tools/check_process_python.bash") self.process_name = self._config["process_name"] def monitor_func(self): exit_status, stdout, stderr = self.connection.execute( "/bin/sh -s {0}".format(self.process_name), stdin=open(self.check_script, "r")) + if not stdout or int(stdout) <= 0: + LOG.info("the process (%s) is not running!" % self.process_name) + return False - if stdout and "running" in stdout: - LOG.info("check the envrioment success!") - return True - else: - LOG.error( - "the host envrioment is error, stdout:%s, stderr:%s" % - (stdout, stderr)) - return False + return True def verify_SLA(self): + LOG.debug("the _result:%s" % self._result) outage_time = self._result.get('outage_time', None) max_outage_time = self._config["sla"]["max_recover_time"] if outage_time > max_outage_time: @@ -69,7 +66,7 @@ def _test(): # pragma: no cover 'process_name': 'nova-api', 'host': "node1", 'monitor_time': 1, - 'SLA': {'max_recover_time': 5} + 'sla': {'max_recover_time': 5} } monitor_configs.append(config) @@ -77,7 +74,7 @@ def _test(): # pragma: no cover p.init_monitors(monitor_configs, context) p.start_monitors() p.wait_monitors() - p.verify() + p.verify_SLA() if __name__ == '__main__': # pragma: no cover