コード例 #1
0
ファイル: automation.py プロジェクト: mazen-hasoun/checkmk
 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))
コード例 #2
0
ファイル: automation.py プロジェクト: bbaumer/checkmk
 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))
コード例 #3
0
ファイル: automation.py プロジェクト: tklecker/checkmk
    def _automation_push_profile(self):
        site_id = html.request.var("siteid")
        if not site_id:
            raise MKGeneralException(_("Missing variable siteid"))

        user_id = html.request.var("user_id")
        if not user_id:
            raise MKGeneralException(_("Missing variable user_id"))

        our_id = config.omd_site()

        if our_id is not None and our_id != site_id:
            raise MKGeneralException(
                _("Site ID mismatch. Our ID is '%s', but you are saying we are '%s'."
                  ) % (our_id, site_id))

        profile = html.request.var("profile")
        if not profile:
            raise MKGeneralException(
                _('Invalid call: The profile is missing.'))

        users = userdb.load_users(lock=True)
        users[UserId(user_id)] = watolib.mk_eval(profile)
        userdb.save_users(users)

        return True
コード例 #4
0
ファイル: automation.py プロジェクト: WennySoft/checkmk
 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"))
     cmdline_cmd, serialized_result = watolib.check_mk_local_automation_serialized(
         command=cmk_command,
         args=args,
         indata=indata,
         stdin_data=stdin_data,
         timeout=timeout,
     )
     # Don't use write_text() here (not needed, because no HTML document is rendered)
     response.set_data(
         self._format_cmk_automation_result(
             serialized_result=SerializedResult(serialized_result),
             cmk_command=cmk_command,
             cmdline_cmd=cmdline_cmd,
         ))