def _parameter_valuespec_heartbeat_crm_resources():
    return Transform(
        Dictionary(elements=[
            (
                "expected_node",
                Alternative(
                    title=_("Expected node"),
                    help=
                    _("The hostname of the expected node to hold this resource."
                      ),
                    elements=[
                        FixedValue(value=None,
                                   totext="",
                                   title=_("Do not check the node")),
                        TextInput(allow_empty=False, title=_("Expected node")),
                    ],
                ),
            ),
        ], ),
        forth=_transform_opt_string,
    )
Esempio n. 2
0
 def _vs_diagnostics(self):
     # type: () -> ValueSpec
     return Dictionary(
         title=_("Collect diagnostic dump"),
         render="form",
         elements=[
             ("site", DropdownChoice(
                 title=_("Site"),
                 choices=config.get_wato_site_choices(),
             )),
             ("general",
              FixedValue(None,
                         totext=_("Collect information about OS and Checkmk version"),
                         title=_("General information"))),
             ("opt_info", ListChoice(
                 title=_("Optional information"),
                 choices=[],
             )),
         ],
         optional_keys=False,
     )
Esempio n. 3
0
def _valuespec_agent_config_proxmox_provisioned():
    return Alternative(
        title=_("Proxmox Provisioned Storage (Linux)"),
        help=
        _("This will deploy the agent plugin <tt>proxmox_provisioned</tt> for monitoring storage space."
          ),
        style="dropdown",
        elements=[
            Dictionary(
                title=_("Deploy plugin for Proxmox Storage"),
                elements=[
                    ("interval",
                     Age(title=_("Run asynchronously"),
                         label=_("Interval for collecting data"),
                         default_value=300)),
                ],
            ),
            FixedValue(None,
                       title=_("Do not deploy plugin for Proxmox Storage"),
                       totext=_("(disabled)")),
        ])
Esempio n. 4
0
 def _valuespec(self, credential: WebAuthnCredential) -> Dictionary:
     return Dictionary(
         title=_("Edit credential"),
         optional_keys=False,
         render="form",
         elements=[
             (
                 "registered_at",
                 FixedValue(
                     value=time.strftime(
                         "%Y-%m-%d %H:%M:%S",
                         time.localtime(credential["registered_at"])),
                     title=_("Registered at"),
                 ),
             ),
             (
                 "alias",
                 TextInput(title=_("Alias")),
             ),
         ],
     )
Esempio n. 5
0
 def _connection_choices(cls):
     conn_choices = [
         ("local", _("Connect to the local site"), FixedValue(
             None,
             totext="",
         )),
         ("tcp", _("Connect via TCP (IPv4)"), cls._tcp_socket_valuespec(ipv6=False)),
         ("tcp6", _("Connect via TCP (IPv6)"), cls._tcp_socket_valuespec(ipv6=True)),
         ("unix", _("Connect via UNIX socket"),
          Dictionary(
              elements=[
                  ("path", TextAscii(
                      label=_("Path:"),
                      size=40,
                      allow_empty=False,
                  )),
              ],
              optional_keys=False,
          )),
     ]
     return conn_choices
Esempio n. 6
0
 def _vs_parse_params(self):
     return Dictionary(
         elements=[
             ("field_delimiter",
              TextAscii(
                  title=_("Set field delimiter"),
                  default_value=";",
                  size=1,
                  allow_empty=False,
              )),
             ("has_title_line",
              FixedValue(
                  True,
                  title=_("Has title line"),
                  totext=_("The first line in the file contains titles."),
              )),
         ],
         render="form",
         title=_("File Parsing Settings"),
         default_keys=["has_title_line"],
     )
Esempio n. 7
0
 def spec(self):
     return Dictionary(
         title=_("Create notification with the following parameters"),
         optional_keys=["url_prefix"],
         hidden_keys=["webhook_url"],
         elements=[
             ("routing_key",
              CascadingDropdown(
                  title=_("PagerDuty Service Integration Key"),
                  help=_("After setting up a new Service in PagerDuty you will receive an "
                         "Integration key associated with that service. Copy that value here."),
                  choices=[("routing_key", _("Integration Key"), TextAscii(size=32)),
                           ("store", _("Key from password store"),
                            DropdownChoice(sorted=True, choices=passwordstore_choices))],
              )),
             ("webhook_url",
              FixedValue("https://events.pagerduty.com/v2/enqueue",
                         title=_("API Endpoint from PagerDuty V2"))),
             ("url_prefix", _get_url_prefix_specs(local_site_url)),
         ],
     )
Esempio n. 8
0
def process_match_options():
    return Alternative(
        title=_("Process Matching"),
        elements=[
            TextInput(
                title=_("Exact name of the process without arguments"),
                label=_("Executable:"),
                size=50,
            ),
            Transform(
                RegExp(
                    size=50,
                    label=_("Command line:"),
                    mode=RegExp.prefix,
                    validate=forbid_re_delimiters_inside_groups,
                ),
                title=_("Regular expression matching command line"),
                help=_(
                    "This regex must match the <i>beginning</i> of the complete "
                    "command line of the process including arguments.<br>"
                    "When using groups, matches will be instantiated "
                    "during process discovery. e.g. (py.*) will match python, python_dev "
                    "and python_test and discover 3 services. At check time, because "
                    "python is a substring of python_test and python_dev it will aggregate"
                    "all process that start with python. If that is not the intended behavior "
                    "please use a delimiter like '$' or '\\b' around the group, e.g. (py.*)$<br>"
                    "In manual check groups are aggregated"
                ),
                forth=lambda x: x[1:],  # remove ~
                back=lambda x: "~" + x,  # prefix ~
            ),
            FixedValue(
                None,
                totext="",
                title=_("Match all processes"),
            ),
        ],
        match=match_alt,
        default_value="/usr/sbin/foo",
    )
Esempio n. 9
0
def _parameter_valuespec_multipath_count():
    return Alternative(
        help=_(
            "This rules sets the expected number of active paths for a multipath LUN "
            "on ESX servers"),
        title=_("Match type"),
        elements=[
            FixedValue(
                None,
                title=_("OK if standby count is zero or equals active paths."),
                totext="",
            ),
            Dictionary(
                title=_("Custom settings"),
                elements=[
                    (element,
                     Transform(Tuple(
                         title=description,
                         elements=[
                             Integer(title=_("Critical if less than")),
                             Integer(title=_("Warning if less than")),
                             Integer(title=_("Warning if more than")),
                             Integer(title=_("Critical if more than")),
                         ],
                     ),
                               forth=lambda x: len(x) == 2 and (
                                   0,
                                   0,
                                   x[0],
                                   x[1],
                               ) or x)) for (element, description) in
                    [("active", _("Active paths")), ("dead", _("Dead paths")),
                     ("disabled",
                      _("Disabled paths")), (
                          "standby",
                          _("Standby paths")), ("unknown", _("Unknown paths"))]
                ],
            ),
        ],
    )
Esempio n. 10
0
def user_match_options(extra_elements=None):
    if extra_elements is None:
        extra_elements = []

    return Alternative(
        title=_("Name of operating system user"),
        style="dropdown",
        elements=[
            TextAscii(title=_("Exact name of the operating system user"),
                      label=_("User:"******"Regular expression matching username"),
                help=_(
                    "This regex must match the <i>beginning</i> of the complete "
                    "username"),
                forth=lambda x: x[1:],  # remove ~
                back=lambda x: "~" + x,  # prefix ~
            ),
            FixedValue(
                None,
                totext="",
                title=_("Match all users"),
            )
        ] + extra_elements,
        match=match_alt,
        help=
        _('<p>The user specification is a user name (string). The '
          'inventory will then trigger only if that user matches the user the '
          'process is running as. The resulting check will require such '
          'user. If user is not '
          'selected the created check will not look for a specific user.</p> '
          '<p>Windows users are specified by the namespace followed '
          'by the actual user name. For example "\\\\NT AUTHORITY\\NETWORK '
          'SERVICE" or "\\\\CHKMKTEST\\Administrator".</p> '),
    )
Esempio n. 11
0
def _valuespec_agent_config_windows_patch_day():
    return Alternative(
        title=_("Windows Patch Day (Windows)"),
        help=
        _("This will deploy the agent plugin <tt>windows_patch_day.ps1</tt> to check the Windows update installation time."
          "As option you can set the maximum amount of updates in history that should be transfered. It is also possible to"
          "filter unwanted update entries like the daily Windows Defender Pattern updates."
          ),
        elements=[
            Dictionary(
                title=_("Deploy plugin for Windows patch day"),
                elements=[
                    ("updatecount",
                     Integer(
                         title=_("Update history count"),
                         unit=_("Updates"),
                         default_value=40,
                     )),
                    ("filterstring",
                     ListOfStrings(
                         title=_("Unwanted updates (Regular Expressions)"),
                         help=
                         _('Regular expressions matching the begining of the installed update name.'
                           ),
                         orientation="horizontal",
                         default_value=[
                             "Security Intelligence-Update für Microsoft Defender Antivirus",
                             "Update für Microsoft Defender Antivirus-Antischadsoftwareplattform",
                             "Windows-Tool zum Entfernen bösartiger Software"
                         ],
                     )),
                ],
                optional_keys=False,
            ),
            FixedValue(None,
                       title=_("Do not deploy the Windows Patch day plugin"),
                       totext=_("(disabled)")),
        ],
    )
Esempio n. 12
0
 def valuespec(self):
     return Alternative(
         title=_("Show more / Show less"),
         orientation="horizontal",
         help=_("In some places like e.g. the main menu Checkmk divides "
                "features, filters, input fields etc. in two categories, showing "
                "more or less entries. With this option you can set a default "
                "mode for unvisited menus. Alternatively, you can enforce to "
                "show more, so that the round button with the three dots is not "
                "shown at all."),
         elements=[
             FixedValue(
                 None,
                 title=_("Use the default show mode"),
                 totext="",
             ),
             DropdownChoice(
                 title=_("Set custom show mode"),
                 choices=show_mode_choices(),
             ),
         ],
     )
def _valuespec():
    return Alternative(
        title=_("HCI Cluster Monitoring (Windows)"),
        help=
        _("The plugin <tt>hci_cluster</tt> allows monitoring of Cluster Nodes, Resources, Storage Pools or Disks."
          ),
        elements=[
            Dictionary(title=_("Deploy HCI Cluster plugin"),
                       elements=[
                           ("domain",
                            TextAscii(title=_("Domain"), allow_empty=False)),
                           ("cluster_filter",
                            TextAscii(title=_("Cluster Filter"),
                                      help="Use * as a Wildcard",
                                      allow_empty=False)),
                       ],
                       required_keys=["domain", "cluster_filter"]),
            FixedValue(None,
                       title=_("Do not deploy plugin"),
                       totext=_("(disabled)")),
        ],
    )
Esempio n. 14
0
 def valuespec(self):
     return Transform(Dictionary(
         title=_("Disable Notifications"),
         help=_("When this option is active you will not get <b>any</b> "
                "alerts or other notifications via email, SMS or similar. "
                "This overrides all other notification settings and rules, so make "
                "sure that you know what you do. Moreover you can specify a timerange "
                "where no notifications are generated."),
         elements=[("disable",
                    FixedValue(
                        True,
                        title=_("Temporarily disable <b>all</b> notifications!"),
                        totext="",
                    )),
                   ("timerange",
                    Tuple(title=_("Customize timerange"),
                          elements=[
                              AbsoluteDate(title=_("From:"), include_time=True),
                              AbsoluteDate(title=_("To:"), include_time=True),
                          ]))],
     ),
                      forth=self._transform_disable_notification)
Esempio n. 15
0
    def _valuespec(self):
        if self._new:
            # Cannot use ID() here because old versions of the GUI allowed time periods to start
            # with numbers and so on. The ID() valuespec does not allow it.
            name_element: ValueSpec = TextInput(
                title=_("Internal ID"),
                regex=r"^[-a-z0-9A-Z_]*$",
                regex_error=_(
                    "Invalid timeperiod name. Only the characters a-z, A-Z, 0-9, "
                    "_ and - are allowed."),
                allow_empty=False,
                size=80,
                validate=self._validate_id,
            )
        else:
            name_element = FixedValue(self._name, )

        return Dictionary(
            title=_("Time period"),
            elements=[
                ("name", name_element),
                (
                    "alias",
                    TextInput(
                        title=_("Alias"),
                        help=_("An alias or description of the timeperiod"),
                        allow_empty=False,
                        size=80,
                        validate=self._validate_alias,
                    ),
                ),
                ("weekdays", self._vs_weekdays()),
                ("exceptions", self._vs_exceptions()),
                ("exclude", self._vs_exclude()),
            ],
            render="form",
            optional_keys=False,
        )
Esempio n. 16
0
def cgroup_match_options():
    return Tuple(
        title=_("Operating system control group information"),
        elements=[
            Alternative(
                style="dropdown",
                elements=[
                    TextAscii(title=_("Exact content of the operating system control group info"),
                              label=_("Control group:"),
                              size=50),
                    Transform(
                        RegExp(
                            size=50,
                            mode=RegExp.prefix,
                        ),
                        title=_("Regular expression matching control group info"),
                        help=_("This regex must match the <i>beginning</i> of the complete "
                               "control group information"),
                        forth=lambda x: x[1:],  # remove ~
                        back=lambda x: "~" + x,  # prefix ~
                    ),
                    FixedValue(
                        None,
                        totext="",
                        title=_("Match all control groups"),
                    )
                ],
                match=match_alt,
                help=
                _('<p>The control group information is currently only specified by the linux agent'
                  ' (cgroup). If it is present and this rule is set, the inventory will only trigger'
                  ' if the control group of the corresponding process matches.'
                  ' For instance: you can use this rule to exclude all processes belonging to'
                  ' a docker container by specifying the expression "%s" (without the quotes),'
                  ' and selecting "%s".</p>') % (r'.*/docker/', _("Invert matching"))),
            Checkbox(label=_("Invert matching"), default_value=False),
        ],
    )
Esempio n. 17
0
def _valuespec_special_agents_proxmox_ve():
    return Dictionary(
        elements=[
            ("username", TextInput(title=_("Username"), allow_empty=False)),
            ("password",
             IndividualOrStoredPassword(title=_("Password"),
                                        allow_empty=False)),
            ("port", Integer(title=_("Port"), default_value=8006)),
            (
                "no-cert-check",
                FixedValue(
                    value=True,
                    title=_("Disable SSL certificate validation"),
                    totext=_("SSL certificate validation is disabled"),
                ),
            ),
            (
                "timeout",
                Integer(
                    title=_("Connect Timeout"),
                    help=_("The network timeout in seconds"),
                    default_value=60,
                    minvalue=1,
                    unit=_("seconds"),
                ),
            ),
            (
                "log-cutoff-weeks",
                Integer(
                    title=_("Maximum log age"),
                    help=_("Age in weeks of log data to fetch"),
                    default_value=2,
                    unit=_("weeks"),
                ),
            ),
        ],
        title=_("Proxmox VE"),
    )
Esempio n. 18
0
def _parameter_valuespec_hivemanager_devices():
    return Dictionary(elements=[
        ('max_clients',
         Tuple(
             title=_("Number of clients"),
             help=_("Number of clients connected to a Device."),
             elements=[
                 Integer(title=_("Warning at"), unit=_("clients")),
                 Integer(title=_("Critical at"), unit=_("clients")),
             ],
         )),
        ('max_uptime',
         Tuple(
             title=_("Maximum uptime of Device"),
             elements=[
                 Age(title=_("Warning at")),
                 Age(title=_("Critical at")),
             ],
         )),
        ('alert_on_loss',
         FixedValue(
             False,
             totext="",
             title=_("Do not alert on connection loss"),
         )),
        ("warn_states",
         ListChoice(
             title=_("States treated as warning"),
             choices=hivemanger_states,
             default_value=['Maybe', 'Major', 'Minor'],
         )),
        ("crit_states",
         ListChoice(
             title=_("States treated as critical"),
             choices=hivemanger_states,
             default_value=['Critical'],
         )),
    ], )
Esempio n. 19
0
 def __init__(self, **kwargs):
     kwargs["elements"] = [
         ("port",
          Integer(
              title=_("TCP port"),
              minvalue=1,
              maxvalue=65535,
              default_value=kwargs.pop("tcp_port", 6557),
          )),
         ("only_from",
          ListOfStrings(
              title=_("Restrict access to IP addresses"),
              help=
              _("The access to Livestatus via TCP will only be allowed from the "
                "configured source IP addresses. You can either configure specific "
                "IP addresses or networks in the syntax <tt>10.3.3.0/24</tt>."
                ),
              valuespec=IPNetwork(),
              orientation="horizontal",
              allow_empty=False,
              default_value=["0.0.0.0", "::/0"],
          )),
         ("tls",
          FixedValue(
              True,
              title=_("Encrypt communication"),
              totext=_("Encrypt TCP Livestatus connections"),
              help=
              _("Since Check_MK 1.6 it is possible to encrypt the TCP Livestatus "
                "connections using SSL. This is enabled by default for sites that "
                "enable Livestatus via TCP with 1.6 or newer. Sites that already "
                "have this option enabled keep the communication unencrypted for "
                "compatibility reasons. However, it is highly recommended to "
                "migrate to an encrypted communication."),
          )),
     ]
     kwargs["optional_keys"] = ["only_from", "tls"]
     super(LivestatusViaTCP, self).__init__(**kwargs)
Esempio n. 20
0
def _parameter_valuespec_phion_vpnusers():
    return Dictionary(elements=[
        (
            'users',
            Alternative(
                title=_('Levels for number of Phion VPN Users'),
                elements=[
                    FixedValue(
                        None,
                        title=_('No Levels'),
                        totext=_('Do not impose levels, always be OK'),
                    ),
                    Tuple(
                        title=_('Fixed Levels'),
                        elements=[
                            Integer(title=_('Warning at'), ),
                            Integer(title=_('Critical at'), ),
                        ],
                    ),
                ],
            ),
        ),
    ])
Esempio n. 21
0
 def _vs_diagnostics(self) -> Dictionary:
     return Dictionary(
         title=_("Collect diagnostic dump"),
         render="form",
         elements=[
             ("site", DropdownChoice(
                 title=_("Site"),
                 choices=config.get_wato_site_choices(),
             )),
             ("general",
              FixedValue(True,
                         title=_("General information"),
                         totext=_("Collect information about OS and Checkmk version"),
                         help=_("Collect information about OS, Checkmk version and edition, "
                                "Time, Core, Python version and paths, Architecture"))),
             ("opt_info",
              Dictionary(
                  title=_("Optional information"),
                  elements=self._get_optional_information_elements(),
              )),
         ],
         optional_keys=False,
     )
Esempio n. 22
0
def _parameter_valuespec_ibm_svc_enclosure():
    return Dictionary(elements=[("levels_lower_online_canisters",
                                 Alternative(
                                     title="Lower levels for online canisters",
                                     elements=[
                                         FixedValue(
                                             False,
                                             title=_("All must be online"),
                                             totext="",
                                         ),
                                         Tuple(
                                             title=_("Specify levels"),
                                             elements=[
                                                 Integer(title=_("Warning below"),
                                                         minvalue=-1,
                                                         unit=_("online canisters")),
                                                 Integer(title=_("Critical below"),
                                                         minvalue=-1,
                                                         unit=_("online canisters")),
                                             ],
                                         ),
                                     ],
                                 ))],)
Esempio n. 23
0
 def _tls_valuespec(cls):
     return CascadingDropdown(
         title=_("Encryption"),
         choices=[
             (
                 "plain_text",
                 _("Plain text (Unencrypted)"),
                 FixedValue(
                     {}, totext=_("Use plain text, unencrypted transport")),
             ),
             ("encrypted", _("Encrypt data using TLS"),
              Dictionary(
                  elements=[
                      ("verify",
                       Checkbox(
                           title=_("Verify server certificate"),
                           label=
                           _("Verify the Livestatus server certificate using the local site CA"
                             ),
                           default_value=True,
                           help=
                           _("Either verify the server certificate using the site local CA or accept "
                             "any certificate offered by the server. It is highly recommended to "
                             "leave this enabled."),
                       )),
                  ],
                  optional_keys=None,
              )),
         ],
         help=
         _("When connecting to Check_MK versions older than 1.6 you can only use plain text "
           "transport. Starting with Check_MK 1.6 it is possible to use encrypted Livestatus "
           "communication. Sites created with 1.6 will automatically use encrypted communication "
           "by default. Sites created with previous versions need to be configured manually to "
           "enable the encryption. Have a look at <a href=\"werk.py?werk=7017\">werk #7017</a> "
           "for further information."),
     )
Esempio n. 24
0
    def _basic_elements(self):
        if self._new:
            vs_id = ID(
                title=_("Tag ID"),
                size=60,
                allow_empty=False,
                help=_("The internal ID of the tag is used as it's unique identifier "
                       "It cannot be changed later."),
            )
        else:
            vs_id = FixedValue(
                self._id,
                title=_("Tag ID"),
            )

        return [
            ("id", vs_id),
            ("title", TextUnicode(
                title=_("Title"),
                size=60,
                allow_empty=False,
            )),
            ("topic", self._get_topic_valuespec()),
        ]
Esempio n. 25
0
    def _vs_topic(cls):
        choices = cls._topic_choices()

        return Alternative(
            elements=[
                FixedValue(
                    None,
                    title=_("Use default topic"),
                    totext="",
                ),
                OptionalDropdownChoice(
                    title=_("Individual topic"),
                    choices=choices,
                    default_value=choices[0][0] if choices else "",
                    explicit=TextInput(
                        size=30,
                        allow_empty=False,
                    ),
                    otherlabel="%s" % _("Add new topic"),
                ),
            ],
            title=_("Topic") + "<sup>*</sup>",
            orientation="horizontal",
        )
Esempio n. 26
0
def _parameter_valuespec_hyperv_vms():
    return Alternative(
        title=_("Translation of VM state to monitoring state"),
        style="dropdown",
        elements=[
            Dictionary(
                title=_("Direct mapping of VM state to monitoring state"),
                help=_("Define a direct translation of the possible states of the VM to monitoring "
                       "states, i.e. to the result of the check. This overwrites the default "
                       "mapping used by the check."),
                elements=[(vm_state,
                           MonitoringState(title=_("Monitoring state if VM state is %s" % vm_state),
                                           default_value=default_value))
                          for vm_state, default_value in VM_STATES_DEFVALS]),
            FixedValue(
                {"compare_discovery": True},
                title=_("Compare against discovered state"),
                totext=_("Compare the current state of the VM against the discovered state"),
                help=_("Compare the current state of the VM against the state at the point in time "
                       "when the VM was discovered. If the two states do not match, the service "
                       "will go to CRIT. Note that this only works if the check is not executed as "
                       "a manual check. If you choose this option for manual checks, the service "
                       "will go always to UNKN.")),
        ])
Esempio n. 27
0
 def _vs_host_name(self):
     return FixedValue(
         value=self._host.name(),
         title=_("Hostname"),
     )
Esempio n. 28
0
def _valuespec_inv_domino_tasks_rules():
    return Transform(
        Dictionary(
            title=_('Lotus Domino task discovery'),
            help=_(
                "This rule controls the discovery of tasks on Lotus Domino systems. "
                "Any changes later on require a host re-discovery"),
            elements=[
                ('descr',
                 TextInput(
                     title=_('Service Description'),
                     allow_empty=False,
                     help=
                     _('<p>The service description may contain one or more occurances of <tt>%s</tt>. In this '
                       'case, the pattern must be a regular expression prefixed with ~. For each '
                       '<tt>%s</tt> in the description, the expression has to contain one "group". A group '
                       'is a subexpression enclosed in brackets, for example <tt>(.*)</tt> or '
                       '<tt>([a-zA-Z]+)</tt> or <tt>(...)</tt>. When the inventory finds a task '
                       'matching the pattern, it will substitute all such groups with the actual values when '
                       'creating the check. In this way one rule can create several checks on a host.</p>'
                       '<p>If the pattern contains more groups than occurrences of <tt>%s</tt> in the service '
                       'description, only the first matching subexpressions are used for the service '
                       'descriptions. The matched substrings corresponding to the remaining groups '
                       'are nevertheless copied into the regular expression.</p>'
                       '<p>As an alternative to <tt>%s</tt> you may also use <tt>%1</tt>, <tt>%2</tt>, etc. '
                       'These expressions will be replaced by the first, second, ... matching group, allowing '
                       'you to reorder things.</p>'),
                 )),
                (
                    'match',
                    Alternative(
                        title=_("Task Matching"),
                        elements=[
                            TextInput(
                                title=_("Exact name of the task"),
                                size=50,
                            ),
                            Transform(
                                RegExp(
                                    size=50,
                                    mode=RegExp.prefix,
                                ),
                                title=_(
                                    "Regular expression matching command line"
                                ),
                                help=
                                _("This regex must match the <i>beginning</i> of the task"
                                  ),
                                forth=lambda x: x[1:],  # remove ~
                                back=lambda x: "~" + x,  # prefix ~
                            ),
                            FixedValue(
                                None,
                                totext="",
                                title=_("Match all tasks"),
                            )
                        ],
                        match=lambda x:
                        (not x and 2) or (x[0] == '~' and 1 or 0),
                        default_value='foo')),
                (
                    'default_params',
                    Dictionary(
                        title=_('Check parameters'),
                        elements=[
                            (
                                'levels',
                                _vs_levels(
                                    _("Please note that if you specify and also if you modify "
                                      "levels here, the change is activated only during an "
                                      "inventory. Saving this rule is not enough. This is due to "
                                      "the nature of inventory rules.")),
                            ),
                        ],
                        optional_keys=False,
                    ),
                ),
            ],
            optional_keys=False,
        ),
        forth=_transform_inv_domino_tasks_rules,
    )
Esempio n. 29
0
             ("onmagic",
              _("If the status is non-OK or a magic factor is set")),
             ("always", _("Always")),
         ],
         default_value="onmagic",
     )),
]

# Note: This hack is only required on very old filesystem checks (prior August 2013)
fs_levels_elements_hack: List[_Tuple[str, ValueSpec]] = [
    # Beware: this is a nasty hack that helps us to detect new-style parameters.
    # Something hat has todo with float/int conversion and has not been documented
    # by the one who implemented this.
    ("flex_levels", FixedValue(
        None,
        totext="",
        title="",
    )),
]

fs_reserved_elements: List[_Tuple[str, ValueSpec]] = [
    ("show_reserved",
     DropdownChoice(
         title=_("Show space reserved for the <tt>root</tt> user"),
         help=
         _("Check_MK treats space that is reserved for the <tt>root</tt> user on Linux and Unix as "
           "used space. Usually, 5% are being reserved for root when a new filesystem is being created. "
           "With this option you can have Check_MK display the current amount of reserved but yet unused "
           "space."),
         choices=[
             (True, _("Show reserved space")),
Esempio n. 30
0
 def item_spec(self):
     """Not used as condition, only for the rule value valuespec"""
     return FixedValue(
         None,
         totext='',
     )