Ejemplo n.º 1
0
 def get_elements(self):
     checks = get_check_information().plugin_infos
     elements = {
         cn: "%s - %s" % (cn, c["title"])
         for (cn, c) in checks.items() if c.get("group") == self._checkgroup
     }
     return elements
Ejemplo n.º 2
0
    def _from_vars(self) -> None:
        self._check_plugin_name = request.get_ascii_input_mandatory(
            "check_type", "")

        check_builtins = ["check-mk", "check-mk-inventory"]
        if (not re.match("^[a-zA-Z0-9_.]+$", self._check_plugin_name)
                and self._check_plugin_name not in check_builtins):
            raise MKUserError("check_type", _("Invalid check type"))

        manpage = man_pages.load_man_page(self._check_plugin_name)
        if manpage is None:
            raise MKUserError(None, _("There is no manpage for this check."))
        self._manpage = manpage

        checks = get_check_information().plugin_infos
        if (check_info := checks.get(self._check_plugin_name)) is not None:
            self._check_type = "check_mk"
            self._service_description = check_info["service_description"]
            self._ruleset: Optional[
                str] = f"checkgroup_parameters:{check_info['check_ruleset_name']}"
Ejemplo n.º 3
0
    def _from_vars(self):
        self._check_type = request.get_ascii_input_mandatory("check_type", "")

        builtin_check_types = ["check-mk", "check-mk-inventory"]
        if (not re.match("^[a-zA-Z0-9_.]+$", self._check_type)
                and self._check_type not in builtin_check_types):
            raise MKUserError("check_type", _("Invalid check type"))

        manpage = man_pages.load_man_page(self._check_type)
        if manpage is None:
            raise MKUserError(None, _("There is no manpage for this check."))
        self._manpage = manpage

        checks = get_check_information().plugin_infos
        if self._check_type in checks:
            self._manpage = {
                "type": "check_mk",
                **checks[self._check_type],
                **self._manpage,
            }
        elif self._check_type.startswith("check_"):  # Assume active check
            self._manpage = {
                "type": "active",
                **self._manpage,
            }
        elif self._check_type in builtin_check_types:
            self._manpage = {
                "type":
                "check_mk",
                "service_description":
                "Check_MK%s" %
                ("" if self._check_type == "check-mk" else " Discovery"),
                **self._manpage,
            }
        else:
            raise MKUserError(
                None,
                _("Could not detect type of manpage: %s. Maybe the check is missing "
                  ) % self._check_type,
            )