示例#1
0
    def _show_empty_folder_menu(self):
        menu_items = []

        if not self._folder.locked_hosts():
            menu_items.extend([
                MenuItem(
                    "newhost", _("Create new host"), "new", "hosts",
                    _("Add a new host to the monitoring (agent must be installed)"
                      )),
                MenuItem(
                    "newcluster", _("Create new cluster"), "new_cluster",
                    "hosts",
                    _("Use Check_MK clusters if an item can move from one host "
                      "to another at runtime"))
            ])

        if not self._folder.locked_subfolders():
            menu_items.extend([
                MenuItem(
                    "newfolder", _("Create new folder"), "newfolder", "hosts",
                    _("Folders group your hosts, can inherit attributes and can have permissions."
                      ))
            ])

        MainMenu(menu_items).show()
示例#2
0
    def page(self):
        if not self._tag_config.tag_groups and not self._tag_config.get_aux_tags():
            MainMenu(
                [
                    MenuItem(
                        "edit_tag",
                        _("Create new tag group"),
                        "new",
                        "hosttags",
                        _(
                            "Each tag group will create one dropdown choice in the host configuration."
                        ),
                    ),
                    MenuItem(
                        "edit_auxtag",
                        _("Create new auxiliary tag"),
                        "new",
                        "hosttags",
                        _(
                            "You can have these tags automatically added if certain primary tags are set."
                        ),
                    ),
                ]
            ).show()
            return

        self._show_customized_builtin_warning()

        self._render_tag_group_list()
        self._render_aux_tag_list()
示例#3
0
    def page(self):
        if isinstance(self._manpages, list):
            _render_manpage_list(self._titles, self._manpages, self._path[-1],
                                 self._topic_title)
            return

        if len(self._path) == 1 and self._has_second_level:
            # For some topics we render a second level in the same optic as the first level
            menu = MainMenu()
            for path_comp, subnode in self._manpages.items():
                url = makeuri(request, [("topic", "%s/%s" %
                                         (self._path[0], path_comp))])
                title = self._titles.get(path_comp, path_comp)
                helptext = self._get_check_plugin_stats(subnode)

                menu.add_item(
                    MenuItem(
                        mode_or_url=url,
                        title=title,
                        icon="check_plugins",
                        permission=None,
                        description=helptext,
                    ))
            menu.show()

        else:
            # For the others we directly display the tables
            entries = []
            for path_comp, subnode in self._manpages.items():
                title = self._titles.get(path_comp, path_comp)
                entries.append((title, subnode, path_comp))

            for title, subnode, path_comp in sorted(
                    entries, key=lambda x: x[0].lower()):
                _render_manpage_list(self._titles, subnode, path_comp, title)
示例#4
0
    def page(self):
        html.help(
            _("This catalog of check plugins gives you a complete listing of all plugins "
              "that are shipped with your Check_MK installation. It also allows you to "
              "access the rule sets for configuring the parameters of the checks and to "
              "manually create services in case you cannot or do not want to rely on the "
              "automatic service discovery."))

        search_form("%s: " % _("Search for check plugins"), "check_plugins")

        # The maxium depth of the catalog paths is 3. The top level is being rendered
        # like the WATO main menu. The second and third level are being rendered like
        # the global settings.

        if self._topic and not self._search:
            self._render_manpage_topic()

        elif self._search:
            for path, manpages in self._get_manpages_after_search():
                self._render_manpage_list(manpages, path,
                                          self._titles.get(path, path))

        else:
            menu = MainMenu()
            for topic, _has_second_level, title, helptext in self._man_page_catalog_topics(
            ):
                menu.add_item(
                    MenuItem(mode_or_url=html.makeuri([("topic", topic)]),
                             title=title,
                             icon="plugins_" + topic,
                             permission=None,
                             description=helptext))
            menu.show()
示例#5
0
    def page(self):
        html.help(
            _(
                "This catalog of check plugins gives you a complete listing of all plugins "
                "that are shipped with your Check_MK installation. It also allows you to "
                "access the rule sets for configuring the parameters of the checks and to "
                "manually create services in case you cannot or do not want to rely on the "
                "automatic service discovery."
            )
        )

        menu = MainMenu()
        for topic, _has_second_level, title, helptext in _man_page_catalog_topics():
            menu.add_item(
                MenuItem(
                    mode_or_url=makeuri(
                        request,
                        [("mode", "check_plugin_topic"), ("topic", topic)],
                    ),
                    title=title,
                    icon="plugins_" + topic,
                    permission=None,
                    description=helptext,
                )
            )
        menu.show()
示例#6
0
    def _show_empty_folder_menu(self):
        menu_items = []

        if not self._folder.locked_hosts():
            menu_items.extend([
                MenuItem(
                    mode_or_url=makeuri_contextless(global_request,
                                                    [("mode", "newhost"),
                                                     ("folder", self._folder.path())]),
                    title=_("Add host to the monitoring"),
                    icon="new",
                    permission="hosts",
                    description=
                    _("The host must have the Checkmk agent or SNMP or an API integration prepared."
                     ),
                ),
                MenuItem(
                    mode_or_url=makeuri_contextless(global_request,
                                                    [("mode", "newcluster"),
                                                     ("folder", self._folder.path())]),
                    title=_("Create cluster"),
                    icon="new_cluster",
                    permission="hosts",
                    description=_("Use Checkmk clusters if an item can move from one host "
                                  "to another at runtime."),
                )
            ])

        if not self._folder.locked_subfolders():
            menu_items.extend([
                MenuItem(
                    mode_or_url=makeuri_contextless(global_request,
                                                    [("mode", "newfolder"),
                                                     ("folder", self._folder.path())]),
                    title=_("Add folder"),
                    icon="newfolder",
                    permission="hosts",
                    description=_(
                        "Folders group your hosts, can inherit attributes and can have permissions."
                    ))
            ])

        MainMenu(menu_items).show()
示例#7
0
 def _page_no_groups(self):
     menu = MainMenu()
     menu.add_item(
         MenuItem(
             mode_or_url="edit_host_group",
             title=_("Create new host group"),
             icon="new",
             permission="groups",
             description=_("Host groups are used for visualization and filtering of host"),
         ))
     menu.show()
示例#8
0
 def _page_no_groups(self):
     menu = MainMenu()
     menu.add_item(
         MenuItem(
             mode_or_url="edit_contact_group",
             title=_("Create new contact group"),
             icon="new",
             permission="users",
             description=
             _("Contact groups are needed for assigning hosts and services to people (contacts)"
               )))
     menu.show()