diff options
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/etcd_traffic.py')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/etcd_traffic.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/etcd_traffic.py b/roles/openshift_health_checker/openshift_checks/etcd_traffic.py index 40c87873d..b4c8957e9 100644 --- a/roles/openshift_health_checker/openshift_checks/etcd_traffic.py +++ b/roles/openshift_health_checker/openshift_checks/etcd_traffic.py @@ -1,6 +1,6 @@ """Check that scans journalctl for messages caused as a symptom of increased etcd traffic.""" -from openshift_checks import OpenShiftCheck, get_var +from openshift_checks import OpenShiftCheck class EtcdTraffic(OpenShiftCheck): @@ -9,19 +9,18 @@ class EtcdTraffic(OpenShiftCheck): name = "etcd_traffic" tags = ["health", "etcd"] - @classmethod - def is_active(cls, task_vars): + def is_active(self): """Skip hosts that do not have etcd in their group names.""" - group_names = get_var(task_vars, "group_names", default=[]) + group_names = self.get_var("group_names", default=[]) valid_group_names = "etcd" in group_names - version = get_var(task_vars, "openshift", "common", "short_version") - valid_version = version in ("3.4", "3.5", "1.4", "1.5") + version = self.get_major_minor_version(self.get_var("openshift_image_tag")) + valid_version = version in ((3, 4), (3, 5)) - return super(EtcdTraffic, cls).is_active(task_vars) and valid_group_names and valid_version + return super(EtcdTraffic, self).is_active() and valid_group_names and valid_version - def run(self, tmp, task_vars): - is_containerized = get_var(task_vars, "openshift", "common", "is_containerized") + def run(self): + is_containerized = self.get_var("openshift", "common", "is_containerized") unit = "etcd_container" if is_containerized else "etcd" log_matchers = [{ @@ -30,9 +29,7 @@ class EtcdTraffic(OpenShiftCheck): "unit": unit }] - match = self.execute_module("search_journalctl", { - "log_matchers": log_matchers, - }, task_vars) + match = self.execute_module("search_journalctl", {"log_matchers": log_matchers}) if match.get("matched"): msg = ("Higher than normal etcd traffic detected.\n" |