Module: check_mk
Branch: master
Commit: 7592eb169188d0ec9938a3a1db317278d1bfb37b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7592eb169188d0…
Author: Marcel Schulte <ms(a)mathias-kettner.de>
Date: Wed Jan 23 17:10:19 2019 +0100
6874 FIX mkbench: fixed searched command in processes
In script ~/bin/mkbench the helper processes where still searched for old commands.
Because of this the script never run successfully. This has been fixed now.
Change-Id: Ice1fc47e656b34fd801e55644618606264e307dc
---
bin/mkbench | 80 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 40 insertions(+), 40 deletions(-)
diff --git a/bin/mkbench b/bin/mkbench
index d9ade8d..eede979 100755
--- a/bin/mkbench
+++ b/bin/mkbench
@@ -524,10 +524,11 @@ class TestRunner(threading.Thread):
with open("%s/etc/rrdcached.conf" % omd_root(), "w") as f:
f.write("TIMEOUT=300\n" "RANDOM_DELAY=10\n"
"FLUSH_TIMEOUT=7200\n" "WRITE_THREADS=4\n")
- p = subprocess.Popen(["omd", "restart",
"rrdcached"],
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(
+ ["omd", "restart", "rrdcached"],
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
stdout = p.communicate()[0]
if p.returncode != 0:
raise MKGeneralException("Failed to restart rrdcached: %s" %
stdout)
@@ -559,9 +560,9 @@ class TestRunner(threading.Thread):
try:
self._while_waiting()
except MKSkipTestCase, e:
- self.test.info(
- "Skipping %s (%s): %s" %
- (test_case.name(),
fmt_timespan(test_case.duration()), e))
+ self.test.info("Skipping %s (%s): %s" %
+ (test_case.name(),
+ fmt_timespan(test_case.duration()), e))
result = TestCase.RESULT_SKIPPED
result_msg = "Skipped: %s" % e
break # Will iterate to next step (till test case end)
@@ -573,8 +574,8 @@ class TestRunner(threading.Thread):
time.sleep(1)
- self.test.info(
- "Finished %s (%s)" % (test_case.name(),
fmt_timespan(test_case.duration())))
+ self.test.info("Finished %s (%s)" % (test_case.name(),
+
fmt_timespan(test_case.duration())))
self._increase_hosts()
except MKFailTestCase, e:
@@ -662,15 +663,15 @@ class TestRunner(threading.Thread):
(self.test.system_info.block_device,
fmt_bytes(m.disk_usage.free)))
if m.cpu_load[1] > self.test.system_info.cpu_count * 1.2:
- raise MKFailTestCase(
- "The 5 min average CPU load %0.2f is higher than "
- "number of CPUs (%d)." % (m.cpu_load[1],
self.test.system_info.cpu_count))
+ raise MKFailTestCase("The 5 min average CPU load %0.2f is higher than
"
+ "number of CPUs (%d)." % (m.cpu_load[1],
+
self.test.system_info.cpu_count))
# Check memory threshold. There are different values provided by psutil.
# this value sounds good to me for testing.
if m.memory.available < 100 * 1024 * 1024:
- raise MKFailTestCase(
- "There is only %s memory available." %
(fmt_bytes(m.memory.available)))
+ raise MKFailTestCase("There is only %s memory available." %
+ (fmt_bytes(m.memory.available)))
# Initial scheduling of the CMC spreads the service checks for a maximum of
# 5 * check_interval. So we should terminate the test only after some
initialization
@@ -1054,9 +1055,8 @@ class Measurement(object):
return psutil.disk_io_counters()
def _get_site_state(self):
- self.site_state = subprocess.call(["omd", "status",
"--bare"],
- stdout=file(os.devnull, "w"),
- close_fds=True)
+ self.site_state = subprocess.call(
+ ["omd", "status", "--bare"],
stdout=file(os.devnull, "w"), close_fds=True)
def _get_site_stats(self):
if self.site_state not in [ 0, 2 ] \
@@ -2657,8 +2657,8 @@ class TestAgentBasedStandardHosts(TestCase):
host_name = self.host_name_template % num
ipaddress = get_host_ip(num)
- all_hosts.append(
- "%s|lan|ip-v4|cmk-agent|tcp|site:%s|ip-v4-only|prod|bench" %
(host_name, site_id()))
+
all_hosts.append("%s|lan|ip-v4|cmk-agent|tcp|site:%s|ip-v4-only|prod|bench" %
+ (host_name, site_id()))
ipaddresses[host_name] = ipaddress
@@ -2683,11 +2683,12 @@ class TestAgentBasedStandardHosts(TestCase):
shutil.copy(src_file, "%s/%s.mk" % (autochecks_dir, host_name))
def _discover_services_of_host(self, host_name):
- p = subprocess.Popen(["cmk", "-II", host_name],
- stdin=open(os.devnull),
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(
+ ["cmk", "-II", host_name],
+ stdin=open(os.devnull),
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
try:
stdout = p.communicate()[0]
@@ -2775,11 +2776,12 @@ class TestAgentBasedStandardHosts(TestCase):
def _create_rrds_of_host(self, host_name):
# Do 2 iterations to initialize the rrds that base on counter values
for _i in xrange(2):
- p = subprocess.Popen(["cmk", "-v", host_name],
- stdin=open(os.devnull),
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(
+ ["cmk", "-v", host_name],
+ stdin=open(os.devnull),
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
try:
stdout = p.communicate()[0]
@@ -2814,10 +2816,8 @@ class TestAgentBasedStandardHosts(TestCase):
def _activate_changes(self):
if self._test:
self._test.info(" Activating changes")
- p = subprocess.Popen(["cmk", "-R"],
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(
+ ["cmk", "-R"], close_fds=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
try:
stdout = p.communicate()[0]
@@ -3015,8 +3015,9 @@ class GeneralInformation(npyscreen.BoxTitle):
"",
"CPU load : %0.2f %0.2f %0.2f" % values.cpu_load,
"Memory : %0.2f %%" % values.memory.percent,
- "Disk %-6s: %s free" % (os.path.basename(
- self._runner.test.system_info.block_device),
fmt_bytes(values.disk_usage.free)),
+ "Disk %-6s: %s free" %
+ (os.path.basename(self._runner.test.system_info.block_device),
+ fmt_bytes(values.disk_usage.free)),
"Disk IO : r %s/s, w %s/s" %
(fmt_bytes(values.disk_io.read_bytes),
fmt_bytes(values.disk_io.write_bytes)),
]
@@ -3091,8 +3092,8 @@ class Log(npyscreen.BoxTitle):
lines = entry.split("\n")
for line in lines:
- entries.append(
- "%s %s" % (time.strftime("%H:%M:%S",
time.localtime(timestamp)), line))
+ entries.append("%s %s" % (time.strftime("%H:%M:%S",
time.localtime(timestamp)),
+ line))
self.entry_widget.clearBuffer()
self.entry_widget.buffer(entries, scroll_end=True)
@@ -3254,9 +3255,8 @@ def verify_is_site():
def verify_site_is_running():
- site_state = subprocess.call(["omd", "status",
"--bare"],
- stdout=file(os.devnull, "w"),
- close_fds=True)
+ site_state = subprocess.call(
+ ["omd", "status", "--bare"],
stdout=file(os.devnull, "w"), close_fds=True)
if site_state != 0:
raise MKGeneralException("Site needs to be running")