Module: check_mk
Branch: master
Commit: 7a795efec375bc6426234ae36e46bc5011ab4091
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a795efec375bc…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jun 8 08:58:43 2018 +0200
By popular demand: Enable mixed-indentation check.
Change-Id: I7b0d83c79b86d9a1e34d686a0e4bc1d91debb693
---
active_checks/check_cpu_peaks | 56 ++++++++++++++++++++--------------------
active_checks/check_notify_count | 2 +-
bin/mkbench | 6 ++---
cmk_base/data_sources/snmp.py | 2 +-
omd/packages/omd/omd | 32 +++++++++++------------
tests/pylint/pylintrc | 1 -
6 files changed, 49 insertions(+), 50 deletions(-)
diff --git a/active_checks/check_cpu_peaks b/active_checks/check_cpu_peaks
index 2baf6af..44c0c0e 100755
--- a/active_checks/check_cpu_peaks
+++ b/active_checks/check_cpu_peaks
@@ -112,10 +112,10 @@ try:
datasets.append(data[1])
step_secs = data[0]
- def sumsum(x):
- if None in x:
- return None
- return int(sum([y for y in x]))
+ def sumsum(x):
+ if None in x:
+ return None
+ return int(sum([y for y in x]))
#util_total = map(lambda x: int(sum([y for y in x if y != None])),
util_total = map(sumsum, zip(datasets[0], datasets[1], datasets[2]))
@@ -124,36 +124,36 @@ try:
peak_time = time.localtime(fromtime + step_secs * util_total.index(cpu_peak))
if opt_verbose:
- for idx, x in enumerate(datasets[0]):
- sys.stdout.write("idx: %d " % idx)
- sys.stdout.write("%s\t" % int(datasets[0][idx] or -1))
- sys.stdout.write("%s\t" % int(datasets[1][idx] or -1))
- sys.stdout.write("%s\n" % int(datasets[2][idx] or -1))
+ for idx, x in enumerate(datasets[0]):
+ sys.stdout.write("idx: %d " % idx)
+ sys.stdout.write("%s\t" % int(datasets[0][idx] or -1))
+ sys.stdout.write("%s\t" % int(datasets[1][idx] or -1))
+ sys.stdout.write("%s\n" % int(datasets[2][idx] or -1))
if is_windows:
- info = [ "CPU utilization from %s until %s" %\
- (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)),
- time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ]
+ info = [ "CPU utilization from %s until %s" %\
+ (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)),
+ time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ]
else:
- info = [ "CPU utilization (user, system, wait) from %s until %s" %\
- (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)),
- time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ]
+ info = [ "CPU utilization (user, system, wait) from %s until %s" %\
+ (time.strftime("%b %d %H:%M:%S", time.localtime(fromtime)),
+ time.strftime("%b %d %H:%M:%S", time.localtime(untiltime))) ]
if cpu_peak:
- info.append("Highest Peak of %d%% at %s" % (cpu_peak,
time.strftime("%b %d %H:%M:%S", peak_time)))
- state = 0
- if crit_level and cpu_peak <= crit_level:
- info.append("less than %d (!!)" % crit_level)
- state = 2
- elif warn_level and cpu_peak <= warn_level:
- info.append("less than %d (!)" % warn_level)
- state = 1
- sys.stdout.write("%s\n" % ", ".join(info))
- sys.exit(state)
+ info.append("Highest Peak of %d%% at %s" % (cpu_peak,
time.strftime("%b %d %H:%M:%S", peak_time)))
+ state = 0
+ if crit_level and cpu_peak <= crit_level:
+ info.append("less than %d (!!)" % crit_level)
+ state = 2
+ elif warn_level and cpu_peak <= warn_level:
+ info.append("less than %d (!)" % warn_level)
+ state = 1
+ sys.stdout.write("%s\n" % ", ".join(info))
+ sys.exit(state)
else:
- info.append("No data available in time period")
- state = 0
- sys.stdout.write("%s\n" % ": ".join(info))
+ info.append("No data available in time period")
+ state = 0
+ sys.stdout.write("%s\n" % ": ".join(info))
sys.exit(state)
diff --git a/active_checks/check_notify_count b/active_checks/check_notify_count
index cb581ea..ed03b55 100755
--- a/active_checks/check_notify_count
+++ b/active_checks/check_notify_count
@@ -71,7 +71,7 @@ for o,a in opts:
usage()
sys.exit(0)
elif o == '-r':
- timerange = int(a)
+ timerange = int(a)
elif o == '-w':
warn = int(a)
elif o == '-c':
diff --git a/bin/mkbench b/bin/mkbench
index 34154e3..bfdc457 100755
--- a/bin/mkbench
+++ b/bin/mkbench
@@ -730,8 +730,8 @@ class TestRunner(threading.Thread):
"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:
+ # 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)))
@@ -757,7 +757,7 @@ class TestRunner(threading.Thread):
if m.cpu_load[0] > self.test.system_info.cpu_count * 0.2:
return
- if m.memory.percent > 10:
+ if m.memory.percent > 10:
return
if m.site_stats and m.site_stats["helper_usage_cmk"]*100 > 10:
diff --git a/cmk_base/data_sources/snmp.py b/cmk_base/data_sources/snmp.py
index 746b193..9efd554 100644
--- a/cmk_base/data_sources/snmp.py
+++ b/cmk_base/data_sources/snmp.py
@@ -172,7 +172,7 @@ class SNMPDataSource(DataSource):
def _execute(self):
- import cmk_base.inventory_plugins
+ import cmk_base.inventory_plugins
self._verify_ipaddress()
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index b2482af..bac0d7f 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -278,7 +278,7 @@ def user_confirms(title, message, relpath, yes_choice, yes_text,
no_choice, no_t
if choice == "abort":
bail_out("Update aborted.")
elif choice == "shell":
- thedir = "/".join(user_path.split("/")[:-1])
+ thedir = "/".join(user_path.split("/")[:-1])
sys.stdout.write("\n Starting BASH. Type CTRL-D to continue.\n\n")
os.system("cd '%s' ; bash -i" % thedir)
else:
@@ -747,7 +747,7 @@ def create_skeleton_files(sitename, dir):
continue
if dirpath == "tmp" or dirpath.startswith("tmp/"):
continue
- create_skeleton_file(skelroot, sitedir, dirpath + "/" + entry,
replacements)
+ create_skeleton_file(skelroot, sitedir, dirpath + "/" + entry,
replacements)
def delete_user_file(user_path):
if not os.path.islink(user_path) and os.path.isdir(user_path):
@@ -1741,15 +1741,15 @@ def check_status(sitename, display=True, daemon=None,
bare=False):
state = os.system("%s/%s status >/dev/null 2>&1" % (rc_dir,
script)) >> 8
if display and (state != 5 or opt_verbose):
- if bare:
- sys.stdout.write(komponent + " ")
- else:
- sys.stdout.write("%-16s" % (komponent + ":"))
- sys.stdout.write(tty_bold)
+ if bare:
+ sys.stdout.write(komponent + " ")
+ else:
+ sys.stdout.write("%-16s" % (komponent + ":"))
+ sys.stdout.write(tty_bold)
- if bare:
- if state != 5 or opt_verbose:
- sys.stdout.write("%d\n" % state)
+ if bare:
+ if state != 5 or opt_verbose:
+ sys.stdout.write("%d\n" % state)
if state == 0:
if display and not bare:
@@ -1779,10 +1779,10 @@ def check_status(sitename, display=True, daemon=None,
bare=False):
exit_code = 2
ovstate = tty_yellow + "partially running"
if display:
- if bare:
- sys.stdout.write("OVERALL %d\n" % exit_code)
- else:
- sys.stdout.write("-----------------------\n")
+ if bare:
+ sys.stdout.write("OVERALL %d\n" % exit_code)
+ else:
+ sys.stdout.write("-----------------------\n")
sys.stdout.write("Overall state: %s\n" %
(tty_bold + ovstate + tty_normal))
return exit_code
@@ -2498,7 +2498,7 @@ def main_uninstall(args, options=None):
for path in [ g_info["OMD_PHYSICAL_BASE"],
"/omd",
- g_info["APACHE_CONF_DIR"] + "/zzz_omd.conf",
+ g_info["APACHE_CONF_DIR"] +
"/zzz_omd.conf",
"/etc/init.d/omd",
"/usr/bin/omd" ]:
shutil.rmtree(path, ignore_errors=True)
@@ -3262,7 +3262,7 @@ def main_umount(args, options=None):
continue
sys.stdout.write("%sUnmounting tmpfs of site %s%s..." % (tty_bold,
site, tty_normal))
- sys.stdout.flush()
+ sys.stdout.flush()
if not unmount_tmpfs(site, False, kill="kill" in options):
sys.stdout.write(tty_error + "\n")
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 084ab99..4225570 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -49,7 +49,6 @@ disable=
logging-not-lazy,
misplaced-comparison-constant,
missing-docstring,
- mixed-indentation,
multiple-imports,
multiple-statements,
no-else-return,