def _get_service_description(self, hostname, check_plugin_name, item): # type: (HostName, CheckPluginName, Item) -> ServiceName # TODO: re-enable once the GUI is using Python3 #return cmk.base.export.service_description(hostname, check_plugin_name, item) assert item is not None return watolib.check_mk_local_automation( "get-service-name", [hostname, check_plugin_name, item])
def _from_vars(self): self._check_type = html.request.get_ascii_input_mandatory("check_type", "") if not re.match("^[a-zA-Z0-9_.]+$", self._check_type): 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 = watolib.check_mk_local_automation("get-check-information") 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 ['check-mk', "check-mk-inventory"]: self._manpage = { "type": "check_mk", "service_description": "Check_MK%s" % ("" if self._check_type == "check-mk" else " Discovery"), **self._manpage, }
def _execute_cmk_automation(self): cmk_command = html.request.var("automation") args = watolib.mk_eval(html.request.var("arguments")) indata = watolib.mk_eval(html.request.var("indata")) stdin_data = watolib.mk_eval(html.request.var("stdin_data")) timeout = watolib.mk_eval(html.request.var("timeout")) result = watolib.check_mk_local_automation(cmk_command, args, indata, stdin_data, timeout) # Don't use write_text() here (not needed, because no HTML document is rendered) html.write(repr(result))
def _execute_cmk_automation(self): cmk_command = request.get_str_input_mandatory("automation") args = watolib.mk_eval(request.get_str_input_mandatory("arguments")) indata = watolib.mk_eval(request.get_str_input_mandatory("indata")) stdin_data = watolib.mk_eval(request.get_str_input_mandatory("stdin_data")) timeout = watolib.mk_eval(request.get_str_input_mandatory("timeout")) result = watolib.check_mk_local_automation(cmk_command, args, indata, stdin_data, timeout) # Don't use write_text() here (not needed, because no HTML document is rendered) response.set_data(repr(result))
def _from_vars(self): self._check_type = html.request.get_ascii_input_mandatory("check_type", "") # TODO: There is one check "sap.value-groups" which will be renamed to "sap.value_groups". # As long as the old one is available, allow a minus here. if not re.match("^[-a-zA-Z0-9_.]+$", self._check_type): raise MKUserError("check_type", _("Invalid check type")) # TODO: remove call of automation and then the automation. This can be done once the check_info # data is also available in the "cmk." module because the get-check-manpage automation not only # fetches the man page. It also contains info from check_info. What a hack. self._manpage = watolib.check_mk_local_automation("get-check-manpage", [self._check_type]) if self._manpage is None: raise MKUserError(None, _("There is no manpage for this check."))