def render(self, what): html.write_text(_('Downtime Comment') + ": ") html.text_input("_down_comment", "", size=60, submit="") html.hr() html.button("_down_from_now", _("From now for")) html.nbsp() html.number_input("_down_minutes", 60, size=4, submit="_down_from_now") html.write_text(" " + _("minutes")) html.hr() for time_range in config.user_downtime_timeranges: html.button("_downrange__%s" % time_range['end'], _u(time_range['title'])) if what != "aggr" and config.user.may("action.remove_all_downtimes"): html.write_text(" - ") html.button("_down_remove", _("Remove all")) html.hr() if config.adhoc_downtime and config.adhoc_downtime.get("duration"): adhoc_duration = config.adhoc_downtime.get("duration") adhoc_comment = config.adhoc_downtime.get("comment", "") html.button("_down_adhoc", _("Adhoc for %d minutes") % adhoc_duration) html.nbsp() html.write_text(_('with comment') + ": ") html.write(adhoc_comment) html.hr() html.button("_down_custom", _("Custom time range")) html.datetime_input("_down_from", time.time(), submit="_down_custom") html.write_text(" " + _('to') + " ") html.datetime_input("_down_to", time.time() + 7200, submit="_down_custom") html.hr() html.checkbox("_down_flexible", False, label="%s " % _('flexible with max. duration')) html.time_input("_down_duration", 2, 0) html.write_text(" " + _('(HH:MM)')) if what == "host": html.hr() html.checkbox("_include_childs", False, label=_('Also set downtime on child hosts')) html.write_text(" ") html.checkbox("_include_childs_recurse", False, label=_('Do this recursively')) elif what == "service": html.hr() html.checkbox("_on_hosts", False, label=_('Schedule downtimes on the affected ' '<b>hosts</b> instead of on the individual ' 'services')) if self._has_recurring_downtimes(): html.hr() html.checkbox("_down_do_recur", False, label=_("Repeat this downtime on a regular basis every")) html.write_text(" ") from cmk.gui.cee.plugins.wato.cmc import recurring_downtimes_types # pylint: disable=no-name-in-module recurring_selections = [ (str(k), v) for (k, v) in sorted(recurring_downtimes_types().items()) ] html.dropdown("_down_recurring", recurring_selections, deflt="3") html.write_text(_("(This only works when using CMC)"))
def display(self): html.write_text(_("From: ")) htmlvar = self.htmlvars[0] current_value = html.request.var(htmlvar, "") html.number_input(htmlvar, current_value) if self._unit: html.write(self._unit) html.write_text(" " + _("To: ")) htmlvar = self.htmlvars[1] current_value = html.request.var(htmlvar, "") html.number_input(htmlvar, current_value) if self._unit: html.write(self._unit)
def page(self): html.begin_form("random") forms.header(_("Create Random Hosts")) forms.section(_("Number to create")) html.write_text("%s: " % _("Hosts to create in each folder")) html.number_input("count", 10) html.set_focus("count") html.br() html.write_text("%s: " % _("Number of folders to create in each level")) html.number_input("folders", 10) html.br() html.write_text("%s: " % _("Levels of folders to create")) html.number_input("levels", 1) forms.end() html.button("start", _("Start!"), "submit") html.hidden_fields() html.end_form()
def render(self, what): html.button("_resched_checks", _("Reschedule")) html.write_text(" " + _("and spread over") + " ") html.number_input("_resched_spread", 0, size=3) html.write_text(" " + _("minutes") + " ")
def _show_start_form(self): html.begin_form("parentscan", method="POST") html.hidden_fields() # Mode of action html.open_p() if not self._complete_folder: num_selected = len(get_hosts_from_checkboxes()) html.write_text( _("You have selected <b>%d</b> hosts for parent scan. ") % num_selected) html.p( _("The parent scan will try to detect the last gateway " "on layer 3 (IP) before a host. This will be done by " "calling <tt>traceroute</tt>. If a gateway is found by " "that way and its IP address belongs to one of your " "monitored hosts, that host will be used as the hosts " "parent. If no such host exists, an artifical ping-only " "gateway host will be created if you have not disabled " "this feature.")) forms.header(_("Settings for Parent Scan")) self._settings = config.user.load_file( "parentscan", { "where": "subfolder", "alias": _("Created by parent scan"), "recurse": True, "select": "noexplicit", "timeout": 8, "probes": 2, "ping_probes": 5, "max_ttl": 10, "force_explicit": False, }) # Selection forms.section(_("Selection")) if self._complete_folder: html.checkbox("recurse", self._settings["recurse"], label=_("Include all subfolders")) html.br() html.radiobutton( "select", "noexplicit", self._settings["select"] == "noexplicit", _("Skip hosts with explicit parent definitions (even if empty)") + "<br>") html.radiobutton( "select", "no", self._settings["select"] == "no", _("Skip hosts hosts with non-empty parents (also if inherited)") + "<br>") html.radiobutton("select", "ignore", self._settings["select"] == "ignore", _("Scan all hosts") + "<br>") # Performance forms.section(_("Performance")) html.open_table() html.open_tr() html.open_td() html.write_text(_("Timeout for responses") + ":") html.close_td() html.open_td() html.number_input("timeout", self._settings["timeout"], size=2) html.write_text(_("sec")) html.close_td() html.close_tr() html.open_tr() html.open_td() html.write_text(_("Number of probes per hop") + ":") html.close_td() html.open_td() html.number_input("probes", self._settings["probes"], size=2) html.close_td() html.close_tr() html.open_tr() html.open_td() html.write_text(_("Maximum distance (TTL) to gateway") + ":") html.close_td() html.open_td() html.number_input("max_ttl", self._settings["max_ttl"], size=2) html.close_td() html.close_tr() html.open_tr() html.open_td() html.write_text(_("Number of PING probes") + ":") html.help( _("After a gateway has been found, Check_MK checks if it is reachable " "via PING. If not, it is skipped and the next gateway nearer to the " "monitoring core is being tried. You can disable this check by setting " "the number of PING probes to 0.")) html.close_td() html.open_td() html.number_input("ping_probes", self._settings.get("ping_probes", 5), size=2) html.close_td() html.close_tr() html.close_table() # Configuring parent forms.section(_("Configuration")) html.checkbox( "force_explicit", self._settings["force_explicit"], label= _("Force explicit setting for parents even if setting matches that of the folder" )) # Gateway creation forms.section(_("Creation of gateway hosts")) html.write_text(_("Create gateway hosts in")) html.open_ul() html.radiobutton( "where", "subfolder", self._settings["where"] == "subfolder", _("in the subfolder <b>%s/Parents</b>") % watolib.Folder.current_disk_folder().title()) html.br() html.radiobutton( "where", "here", self._settings["where"] == "here", _("directly in the folder <b>%s</b>") % watolib.Folder.current_disk_folder().title()) html.br() html.radiobutton("where", "there", self._settings["where"] == "there", _("in the same folder as the host")) html.br() html.radiobutton("where", "nowhere", self._settings["where"] == "nowhere", _("do not create gateway hosts")) html.close_ul() html.write_text(_("Alias for created gateway hosts") + ": ") html.text_input("alias", self._settings["alias"]) forms.end() # Start button html.button("_start", _("Start")) html.hidden_fields() html.end_form()
def display(self): html.write_text(_("from:") + " ") html.number_input(self.ident + "_from") html.write_text(" %s: " % _("to")) html.number_input(self.ident + "_to")