コード例 #1
0
ファイル: interfaces.py プロジェクト: arusa/checkmk
def _vs_single_discovery():
    return CascadingDropdown(
        title=_("Configure discovery of single interfaces"),
        choices=[
            (
                True,
                _("Discover single interfaces"),
                Dictionary(
                    elements=[
                        (
                            'item_appearance',
                            _vs_item_appearance(
                                _("Appearance of network interface"),
                                _("This option makes checkmk use either the interface description, "
                                  "alias or port number as item."),
                            ),
                        ),
                        (
                            "pad_portnumbers",
                            DropdownChoice(
                                choices=[
                                    (True, _('Pad port numbers with zeros')),
                                    (False, _('Do not pad')),
                                ],
                                title=_("Port numbers"),
                                help=
                                _("If this option is activated, checkmk will pad port numbers of "
                                  "network interfaces with zeroes so that the descriptions of all "
                                  "ports of a host or switch have the same length and thus are "
                                  "sorted correctly in the GUI."),
                            ),
                        ),
                        (
                            "labels",
                            Labels(
                                world=Labels.World.CONFIG,
                                label_source=Labels.Source.RULESET,
                                help=
                                _("Create service labels that get discovered by this rule."
                                  ),
                                title=
                                _("Generate service labels for discovered interfaces"
                                  ),
                            ),
                        ),
                    ],
                    optional_keys=["labels"],
                ),
            ),
            (
                False,
                _("Do not discover single interfaces"),
                FixedValue(
                    {},
                    totext="",
                ),
            ),
        ],
        sorted=False,
    )
コード例 #2
0
ファイル: ps.py プロジェクト: surajrb/checkmk
def _valuespec_inventory_processes_rules():
    return Transform(
        Dictionary(
            title=_('Process Discovery'),
            help=
            _("This ruleset defines criteria for automatically creating checks for running "
              "processes based upon what is running when the service discovery is "
              "done. These services will be created with default parameters. They will get "
              "critical when no process is running and OK otherwise. You can parameterize "
              "the check with the ruleset <i>State and count of processes</i>."
              ),
            elements=[
                ('descr', process_discovery_descr_option()),
                ('match', process_match_options()),
                ('user',
                 user_match_options([
                     FixedValue(
                         False,
                         title=_('Grab user from found processess'),
                         totext='',
                         help=
                         _('Specifying "grab user" makes the created check expect the process to '
                           'run as the same user as during inventory: the user name will be '
                           'hardcoded into the check. In that case if you put %u into the service '
                           'description, that will be replaced by the actual user name during '
                           'inventory. You need that if your rule might match for more than one '
                           'user - your would create duplicate services with the same description '
                           'otherwise.'))
                 ])),
                ("cgroup", cgroup_match_options()),
                ("label",
                 Labels(
                     Labels.World.CONFIG,
                     title=_("Host Label"),
                     help=
                     _("Here you can set host labels that automatically get created when discovering the services."
                       ),
                 )),
                ('default_params',
                 Dictionary(
                     title=_("Default parameters for detected services"),
                     help=
                     _("Here you can select default parameters that are being set "
                       "for detected services. Note: the preferred way for setting parameters is to use "
                       "the rule set <a href=\"wato.py?varname=checkgroup_parameters:ps&mode=edit_ruleset\"> "
                       "State and Count of Processes</a> instead. "
                       "A change there will immediately be active, while a change in this rule "
                       "requires a re-discovery of the services."),
                     elements=process_level_elements(),
                     ignored_keys=["match_groups"],
                     required_keys=["cpu_rescale_max"])),
            ],
            required_keys=["descr", "default_params"],
        ),
        forth=convert_inventory_processes,
    )
コード例 #3
0
 def valuespec(self):
     return Labels(world=Labels.World.CONFIG,
                   label_source=Labels.Source.EXPLICIT)
コード例 #4
0
ファイル: interfaces.py プロジェクト: maxmalysh/checkmk
def _vs_grouping():
    return CascadingDropdown(
        title=_("Configure grouping of interfaces"),
        help=_(
            'Normally, the interface checks create a single service for each interface. By defining '
            'interface groups, multiple interfaces can be combined together. For each group, a '
            'single service is created. This services reports the total traffic amount summed over '
            'all group members.'),
        choices=[
            (
                False,
                _("Do not group interfaces"),
                FixedValue(
                    {"group_items": []},
                    totext="",
                ),
            ),
            (
                True,
                _("Create the following interface groups"),
                Dictionary(
                    elements=[
                        (
                            "group_items",
                            ListOf(
                                title=_("Interface groups"),
                                add_label=_("Add pattern"),
                                valuespec=Dictionary(
                                    elements=[
                                        (
                                            "group_name",
                                            TextAscii(
                                                title=_("Group name"),
                                                help=_("Name of group in service description"),
                                                allow_empty=False,
                                            ),
                                        ),
                                        (
                                            'member_appearance',
                                            _vs_item_appearance(
                                                _("Appearance of group members in service output"),
                                                _("When listing the group members in the output of the service "
                                                  "monitoring the group, this option makes checkmk use either "
                                                  "the interface description, alias or port number."
                                                 ),
                                            ),
                                        ),
                                    ],
                                    optional_keys=False,
                                ),
                                allow_empty=False,
                            ),
                        ),
                        (
                            "labels",
                            Labels(
                                world=Labels.World.CONFIG,
                                label_source=Labels.Source.RULESET,
                                help=_("Create service labels for all groups "
                                       "that result from this rule."),
                                title=_("Generate service labels for created groups"),
                            ),
                        ),
                    ],
                    optional_keys=["labels"],
                ),
            ),
        ],
        sorted=False,
    )