diff --git a/swh/icinga_plugins/base_check.py b/swh/icinga_plugins/base_check.py --- a/swh/icinga_plugins/base_check.py +++ b/swh/icinga_plugins/base_check.py @@ -1,16 +1,21 @@ -# Copyright (C) 2019 The Software Heritage developers +# Copyright (C) 2019-2022 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information +from typing import Dict + class BaseCheck: - def __init__(self, obj): - self.warning_threshold = obj.get( - "warning_threshold", self.DEFAULT_WARNING_THRESHOLD + DEFAULT_WARNING_THRESHOLD = 60 + DEFAULT_CRITICAL_THRESHOLD = 120 + + def __init__(self, obj: Dict[str, str]) -> None: + self.warning_threshold = float( + obj.get("warning_threshold", self.DEFAULT_WARNING_THRESHOLD) ) - self.critical_threshold = obj.get( - "critical_threshold", self.DEFAULT_CRITICAL_THRESHOLD + self.critical_threshold = float( + obj.get("critical_threshold", self.DEFAULT_CRITICAL_THRESHOLD) ) def get_status(self, value):