Пример #1
0
def _valuespec_discovery_systemd_units_services_rules() -> Transform:
    return Transform(
        Dictionary(
            title=_("Systemd single services discovery"),
            elements=[
                (
                    "descriptions",
                    ListOf(
                        TextOrRegExp(),
                        title=_("Restrict by description"),
                        help=_(
                            "Restrict the systemd services by description."),
                        allow_empty=False,
                    ),
                ),
                (
                    "names",
                    ListOf(
                        TextOrRegExp(),
                        title=_("Restrict by service unit name"),
                        help=_("Restrict the systemd services by unit name."),
                        allow_empty=False,
                    ),
                ),
                (
                    "states",
                    ListChoice(
                        choices=[
                            ("active", "active"),
                            ("inactive", "inactive"),
                            ("failed", "failed"),
                        ],
                        title=_("Restrict by state"),
                        allow_empty=False,
                    ),
                ),
            ],
            help=
            _("Configure the discovery of single systemd services. To be discovered, a service "
              "must match at least one description condition, one name condition and one state "
              "condition, if configured. To simply discover all systemd services, do not "
              "configure any restrictions. Note that independently of this ruleset, some systemd "
              "service units which are used by the Checkmk agent ('check-mk-agent@...') will "
              "never be discovered because they appear and disappear frequently."
              ),
            empty_text=_(
                "No restrictions (discover all systemd service units)"),
        ),
        forth=_discovery_forth,
    )
Пример #2
0
def _valuespec_inventory_df_rules():
    return Transform(
        valuespec=Dictionary(
            title=_("Filesystem discovery"),
            elements=[
                (
                    "mountpoint_for_block_devices",
                    DropdownChoice(
                        title=_("Mountpoint for block devices (brtfs)"),
                        choices=[
                            ("volume_name_as_mountpoint",
                             _("Use volume name as mountpoint")),
                            ("uuid_as_mountpoint",
                             _("Use UUID as mountpoint")),
                        ],
                        default_value="volume_name_as_mountpoint",
                    ),
                ),
                (
                    "item_appearance",
                    DropdownChoice(
                        title=_("Item appearance"),
                        choices=[
                            ("mountpoint", _("Use mountpoint")),
                            ("volume_name_and_mountpoint",
                             _("Use volume name and mountpoint")),
                            ("uuid_and_mountpoint",
                             _("Use UUID and mountpoint")),
                        ],
                        default_value="mountpoint",
                    ),
                ),
                (
                    "grouping_behaviour",
                    DropdownChoice(
                        title=_("Grouping applies to"),
                        choices=[
                            ("mountpoint", _("mountpoint only")),
                            ("volume_name_and_mountpoint",
                             _("volume name and mountpoint")),
                            ("uuid_and_mountpoint", _("UUID and mountpoint")),
                        ],
                        help=_(
                            "Specifies how the <a href='wato.py?mode=edit_ruleset&varname=filesystem_groups'>Filesystem grouping patterns</a>"
                            " feature processes this filesystem."),
                        default_value="mountpoint",
                    ),
                ),
                (
                    "ignore_fs_types",
                    ListChoice(
                        title=_("Filesystem types to ignore"),
                        choices=[
                            ("tmpfs", "tmpfs"),
                            ("nfs", "nfs"),
                            ("smbfs", "smbfs"),
                            ("cifs", "cifs"),
                            ("iso9660", "iso9660"),
                        ],
                        default_value=[
                            "tmpfs", "nfs", "smbfs", "cifs", "iso9660"
                        ],
                    ),
                ),
                (
                    "never_ignore_mountpoints",
                    ListOf(
                        valuespec=TextOrRegExp(),
                        title=_("Mountpoints to never ignore"),
                        help=_(
                            "Regardless of filesystem type, these mountpoints will always be discovered."
                            "Regular expressions are supported."),
                    ),
                ),
            ],
            validate=_validate_discovery_filesystem_params,
        ),
        forth=_transform_discovery_filesystem_params,
    )