Module: check_mk
Branch: master
Commit: 4d84ff8b95d0640ce50a9d55f01bff7f1e2241b8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d84ff8b95d064…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Sep 27 12:47:01 2018 +0200
Format -> format_str
Change-Id: I4b53adb7de225852cfa9df8e879a7f460ee19790
---
checks/jolokia_metrics | 8 ++++----
checks/mysql | 4 ++--
cmk/gui/plugins/sidebar/shipped.py | 4 ++--
cmk/log.py | 4 ++--
cmk_base/core_nagios.py | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/checks/jolokia_metrics b/checks/jolokia_metrics
index c3ff118..dec049a 100644
--- a/checks/jolokia_metrics
+++ b/checks/jolokia_metrics
@@ -989,7 +989,7 @@ def check_jolokia_metrics_cache(metrics, totals, item, params, info):
break
for metric in metrics:
- type_, scale, format = type_map.get(metric, (int, 1,"%d"))
+ type_, scale, format_str = type_map.get(metric, (int, 1,"%d"))
val = type_(parsed[inst]["CacheStatistics"][cache][metric]) *
scale
if isinstance(val, float) and val == 0.0:
@@ -997,12 +997,12 @@ def check_jolokia_metrics_cache(metrics, totals, item, params,
info):
# were all 0, so this float is 0/0, we want to display it as 1 as to not
cause
# an alert
val = 1.0 * scale
- yield 0, ("%s: " + format) % (metric, val), [(metric, val)]
+ yield 0, ("%s: " + format_str) % (metric, val), [(metric, val)]
for total in totals:
- type_, scale, format = type_map.get(total, (int, 1,"%d"))
+ type_, scale, format_str = type_map.get(total, (int, 1,"%d"))
val = type_(parsed[inst]["CacheStatistics"][cache][total]) * scale
- yield 0, ("%s: " + format) % (total, val), []
+ yield 0, ("%s: " + format_str) % (total, val), []
except KeyError:
# some element of the item was missing
pass
diff --git a/checks/mysql b/checks/mysql
index 906efad..81b9752 100644
--- a/checks/mysql
+++ b/checks/mysql
@@ -135,11 +135,11 @@ def check_mysql_sessions(item, params, parsed):
perfdata = []
status = 0
- for value, perfvar, what, format, unit in [
+ for value, perfvar, what, format_str, unit in [
( total_sessions, "total_sessions", "total",
"%d", "" ),
( running_sessions, "running_sessions", "running",
"%d", "" ),
( connects, "connect_rate", "connections",
"%.2f", "/s")]:
- infos.append((format + " %s%s") % (value, what, unit))
+ infos.append((format_str + " %s%s") % (value, what, unit))
if what in params:
warn, crit = params[what]
if value >= crit:
diff --git a/cmk/gui/plugins/sidebar/shipped.py b/cmk/gui/plugins/sidebar/shipped.py
index cc30456..896c365 100644
--- a/cmk/gui/plugins/sidebar/shipped.py
+++ b/cmk/gui/plugins/sidebar/shipped.py
@@ -356,7 +356,7 @@ def render_performance():
finally:
sites.live().set_only_sites(None)
- for what, col, format in \
+ for what, col, format_str in \
[("Service checks", 0, "%.2f/s"),
("Host checks", 1, "%.2f/s"),
("External commands", 2, "%.2f/s"),
@@ -364,7 +364,7 @@ def render_performance():
("Process creations", 4, "%.2f/s"),
("New log messages", 5, "%.2f/s"),
("Cached log messages", 6, "%d")]:
- write_line(what + ":", format % sum(row[col] for row in data))
+ write_line(what + ":", format_str % sum(row[col] for row in data))
if only_sites is None and len(config.allsites()) == 1:
try:
diff --git a/cmk/log.py b/cmk/log.py
index bf5cd4e..50436eb 100644
--- a/cmk/log.py
+++ b/cmk/log.py
@@ -119,11 +119,11 @@ def get_logger(name):
return logger.getChild(name)
-def get_formatter(format="%(asctime)s [%(levelno)s] [%(name)s %(process)d]
%(message)s"):
+def get_formatter(format_str="%(asctime)s [%(levelno)s] [%(name)s %(process)d]
%(message)s"):
"""Returns a new message formater instance that uses the standard
Check_MK log format by default. You can also set another format
if you like."""
- return _logging.Formatter(format)
+ return _logging.Formatter(format_str)
def setup_console_logging():
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index 5229298..3f260bd 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -873,8 +873,8 @@ def _extra_conf_of(confdict, hostname, service, exclude=None):
continue
if values:
- format = " %-29s %s\n"
- result += format % (key, values[0])
+ result += " %-29s %s\n" % (key, values[0])
+
return result