Exemple #1
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),
        ],
    )
Exemple #2
0
def process_match_options():
    return Alternative(
        title=_("Process Matching"),
        style="dropdown",
        elements=[
            TextAscii(
                title=_("Exact name of the process without argments"),
                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')
Exemple #3
0
def _parameter_valuespec_k8s_if():
    return Dictionary(elements=[
        ("errors",
         Alternative(
             title=_("Levels for error rates"),
             help=
             _("These levels make the check go warning or critical whenever the "
               "<b>percentual error rate</b> or the <b>absolute error rate</b> of the monitored interface reaches "
               "the given bounds. The percentual error rate is computed by dividing number of "
               "errors by the total number of packets (successful plus errors)."
               ),
             elements=[
                 Tuple(title=_("Percentual levels for error rates"),
                       elements=[
                           Percentage(title=_("Warning at"),
                                      unit=_("percent errors"),
                                      default_value=0.01,
                                      display_format='%.3f'),
                           Percentage(title=_("Critical at"),
                                      unit=_("percent errors"),
                                      default_value=0.1,
                                      display_format='%.3f')
                       ]),
                 Tuple(title=_("Absolute levels for error rates"),
                       elements=[
                           Integer(title=_("Warning at"), unit=_("errors")),
                           Integer(title=_("Critical at"), unit=_("errors"))
                       ])
             ])),
        ("discards",
         Tuple(
             title=_("Absolute levels for discards rates"),
             elements=[
                 Integer(title=_("Warning at"), unit=_("discards")),
                 Integer(title=_("Critical at"), unit=_("discards"))
             ],
         )),
    ], )
Exemple #4
0
def _valuespec_inventory_solaris_services_rules():
    return Dictionary(
        title=_("Solaris Service Discovery"),
        elements=[
            ('descriptions', ListOfStrings(title=_("Descriptions"))),
            ('categories', ListOfStrings(title=_("Categories"))),
            ('names', ListOfStrings(title=_("Names"))),
            ('instances', ListOfStrings(title=_("Instances"))),
            ('states',
             ListOf(
                 DropdownChoice(choices=[
                     ("online", _("online")),
                     ("disabled", _("disabled")),
                     ("maintenance", _("maintenance")),
                     ("legacy_run", _("legacy run")),
                 ], ),
                 title=_("States"),
             )),
            ('outcome',
             Alternative(
                 title=_("Service name"),
                 style="dropdown",
                 elements=[
                     FixedValue("full_descr",
                                title=_("Full Description"),
                                totext=""),
                     FixedValue("descr_without_prefix",
                                title=_("Description without type prefix"),
                                totext=""),
                 ],
             )),
        ],
        help=
        _('This rule can be used to configure the discovery of the Solaris services check. '
          'You can configure specific Solaris services to be monitored by the Solaris check by '
          'selecting them by description, category, name, or current state during the discovery.'
          ),
    )
Exemple #5
0
def _valuespec_if_groups():
    node_name_elements = [("node_name", TextAscii(title=_("Node name")))
                         ]  # type: List[DictionaryEntry]
    return Transform(Alternative(
        title=_('Network interface groups'),
        help=
        _('Normally the Interface checks create a single service for interface. '
          'By defining if-group patterns multiple interfaces can be combined together. '
          'A single service is created for this interface group showing the total traffic amount '
          'of its members. You can configure if interfaces which are identified as group interfaces '
          'should not show up as single service. You can restrict grouped interfaces by iftype and the '
          'item name of the single interface.'),
        style="dropdown",
        elements=[
            ListOf(
                title=_("Groups on single host"),
                add_label=_("Add pattern"),
                valuespec=Dictionary(elements=vs_elements_if_groups_group +
                                     vs_elements_if_groups_matches,
                                     required_keys=["group_name", "group_presence"]),
            ),
            ListOf(magic="@!!",
                   title=_("Groups on cluster"),
                   add_label=_("Add pattern"),
                   valuespec=Dictionary(elements=vs_elements_if_groups_group +
                                        [("node_patterns",
                                          ListOf(
                                              title=_("Patterns for each node"),
                                              add_label=_("Add pattern"),
                                              valuespec=Dictionary(elements=node_name_elements +
                                                                   vs_elements_if_groups_matches,
                                                                   required_keys=["node_name"]),
                                              allow_empty=False,
                                          ))],
                                        optional_keys=[])),
        ],
    ),
                     forth=transform_if_groups_forth)
Exemple #6
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")),
                                             ],
                                         ),
                                     ],
                                 ))],)
Exemple #7
0
def get_vs_user_idle_timeout():
    return Alternative(
        title=_("Session idle timeout"),
        elements=[
            FixedValue(
                None,
                title=_("Use the global configuration"),
                totext="",
            ),
            FixedValue(
                False,
                title=_("Disable the login timeout"),
                totext="",
            ),
            Age(
                title=_("Set an individual idle timeout"),
                display=["minutes", "hours", "days"],
                minvalue=60,
                default_value=3600,
            ),
        ],
        orientation="horizontal",
    )
Exemple #8
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'), ),
                        ],
                    ),
                ],
            ),
        ),
    ])
Exemple #9
0
def _parameter_valuespec_msoffice_licenses():
    return Dictionary(elements=[
        ("usage",
         Alternative(
             title=_("Upper levels for license usage"),
             elements=[
                 Tuple(
                     title=_("Upper absolute levels"),
                     elements=[
                         Integer(title=_("Warning at")),
                         Integer(title=_("Critical at"))
                     ],
                 ),
                 Tuple(
                     title=_("Upper percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at"), default_value=80.0),
                         Percentage(title=_("Critical at"), default_value=90.0)
                     ],
                 ),
             ],
         )),
    ])
Exemple #10
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(),
             ),
         ],
     )
Exemple #11
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> '),
    )
Exemple #12
0
def _vs_license():
    return Alternative(
        title=_("Levels for Number of Licenses"),
        default_value=None,
        elements=[
            Tuple(
                title=_("Absolute levels for unused licenses"),
                elements=[
                    Integer(title=_("Warning below"),
                            default_value=5,
                            unit=_("unused licenses")),
                    Integer(title=_("Critical below"),
                            default_value=0,
                            unit=_("unused licenses")),
                ],
            ),
            Tuple(
                title=_("Percentual levels for unused licenses"),
                elements=[
                    Percentage(title=_("Warning below"), default_value=10.0),
                    Percentage(title=_("Critical below"), default_value=0),
                ],
            ),
            FixedValue(
                None,
                totext=_("Critical when all licenses are used"),
                title=_("Go critical if all licenses are used"),
            ),
            FixedValue(
                False,
                title=_("Always report OK"),
                totext=
                _("Alerting depending on the number of used licenses is disabled"
                  ),
            ),
        ],
    )
Exemple #13
0
 def parameter_valuespec(self):
     return Dictionary(
         help=_(
             "The memory levels for one specific module of this host. This is relevant for hosts that have "
             "several distinct memory areas, e.g. pluggable cards"),
         elements=[
             ("levels",
              Alternative(
                  title=_("Memory levels"),
                  elements=[
                      Tuple(
                          title=_(
                              "Specify levels in percentage of total RAM"),
                          elements=[
                              Percentage(
                                  title=_("Warning at a memory usage of"),
                                  default_value=80.0,
                                  maxvalue=None),
                              Percentage(
                                  title=_("Critical at a memory usage of"),
                                  default_value=90.0,
                                  maxvalue=None)
                          ],
                      ),
                      Tuple(
                          title=_(
                              "Specify levels in absolute usage values"),
                          elements=[
                              Filesize(title=_("Warning at")),
                              Filesize(title=_("Critical at"))
                          ],
                      ),
                  ],
              )),
         ],
         optional_keys=[],
     )
Exemple #14
0
def _valuespec_special_agents_dell_storage():
    return Dictionary(
        title=_('Dell Storage via Dell Storage API'),
        help=_('This rule selects the Dell Storage API agent instead of '
               'the normal Check_MK Agent and allows monitoring of '
               'Dell Storage Manager systems and volumes by REST. '
               'You can configure your connection settings here.'),
        elements=[
            ('url',
             HTTPUrl(
                 title=
                 _('URL of the Dell Storage API, e.g. https://host:3033/api/rest/'
                   ),
                 allow_empty=False,
             )),
            ('user',
             TextAscii(
                 title=_('Dell Storage API username.'),
                 allow_empty=False,
             )),
            ('password',
             IndividualOrStoredPassword(
                 title=_('Dell Storage API password'),
                 allow_empty=False,
             )),
            ('ignore_cert',
             Alternative(title=_('SSL certificate checking'),
                         elements=[
                             FixedValue(True,
                                        title=_('Ignore Cert'),
                                        totext=''),
                             FixedValue(False,
                                        title=_('Check Cert'),
                                        totext=''),
                         ],
                         default_value=False)),
        ])
Exemple #15
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",
        )
Exemple #16
0
def _parameter_valuespec_volume_groups():
    return Dictionary(
        elements=[
            ("levels",
             Alternative(
                 title=_("Levels for volume group"),
                 show_alternative_title=True,
                 default_value=(80.0, 90.0),
                 match=match_dual_level_type,
                 elements=[
                     get_free_used_dynamic_valuespec("used", "volume group"),
                     Transform(
                         get_free_used_dynamic_valuespec("free",
                                                         "volume group",
                                                         default_value=(20.0, 10.0)),
                         title=_("Levels for volume group free space"),
                         forth=transform_filesystem_free,
                         back=transform_filesystem_free,
                     )
                 ],
             )),
        ],
        optional_keys=False,
    )
Exemple #17
0
def _parameter_valuespec_general_flash_usage():
    return Alternative(elements=[
        Tuple(
            title=_("Specify levels in percentage of total Flash"),
            elements=[
                Percentage(
                    title=_("Warning at a usage of"),
                    # xgettext: no-python-format
                    label=_("% of Flash"),
                    maxvalue=None,
                ),
                Percentage(
                    title=_("Critical at a usage of"),
                    # xgettext: no-python-format
                    label=_("% of Flash"),
                    maxvalue=None,
                )
            ]),
        Tuple(title=_("Specify levels in absolute usage values"),
              elements=[
                  Integer(title=_("Warning at"), unit=_("MB")),
                  Integer(title=_("Critical at"), unit=_("MB"))
              ]),
    ])
Exemple #18
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.")),
        ])
Exemple #19
0
 def _vs_count_ok_count(cls, title: str, defval: int,
                        defvalperc: int) -> Alternative:
     return Alternative(
         title=title,
         match=lambda x: str(x).endswith("%") and 1 or 0,
         elements=[
             Integer(
                 title=_("Explicit number"),
                 label=_("Number of OK-nodes"),
                 minvalue=0,
                 default_value=defval,
             ),
             Transform(
                 valuespec=Percentage(
                     label=_("Percent of OK-nodes"),
                     display_format="%.0f",
                     default_value=defvalperc,
                 ),
                 title=_("Percentage"),
                 forth=lambda x: float(x[:-1]),
                 back=lambda x: "%d%%" % x,
             ),
         ],
     )
Exemple #20
0
def _parameter_valuespec_cisco_mem():
    elements: List[DictionaryEntry] = [
        (
            "levels",
            Alternative(
                title=_("Levels for memory usage"),
                elements=[
                    Tuple(
                        title=_("Specify levels in percentage of total RAM"),
                        elements=[
                            Percentage(
                                title=_("Warning at a usage of"),
                                # xgettext: no-python-format
                                unit=_("% of RAM"),
                                maxvalue=None),
                            Percentage(
                                title=_("Critical at a usage of"),
                                # xgettext: no-python-format
                                unit=_("% of RAM"),
                                maxvalue=None)
                        ],
                    ),
                    Tuple(
                        title=_("Specify levels in absolute usage values"),
                        elements=[
                            Integer(title=_("Warning at"), unit=_("MB")),
                            Integer(title=_("Critical at"), unit=_("MB"))
                        ],
                    ),
                ],
            )),
    ]
    return Transform(
        Dictionary(elements=elements + size_trend_elements),
        forth=_transform_wrapper,
    )
def _parameter_valuespec_memory():
    return Dictionary(elements=[
        (
            "levels",
            Alternative(
                title=_("Levels for Cisco CPU memory"),
                help=
                _("The performance graph will always display the occupied memory. "
                  "This is independent of the actual check levels which can be set "
                  "for both free and occupied memory levels."),
                default_value=(150.0, 200.0),
                match=match_dual_level_type,
                elements=[
                    Alternative(
                        title=_("Levels for occupied memory"),
                        help=_(
                            "Specify the threshold levels for the occupied memory. The occupied memory "
                            "consists of used and kernel reserved memory."),
                        elements=[
                            Tuple(
                                title=_(
                                    "Specify levels in percentage of total RAM"
                                ),
                                elements=[
                                    Percentage(
                                        title=_("Warning at a usage of"),
                                        maxvalue=None),
                                    Percentage(
                                        title=_("Critical at a usage of"),
                                        maxvalue=None),
                                ],
                            ),
                            Tuple(
                                title=_("Specify levels in absolute values"),
                                elements=[
                                    Integer(title=_("Warning at"),
                                            unit=_("MB")),
                                    Integer(title=_("Critical at"),
                                            unit=_("MB")),
                                ],
                            ),
                        ],
                    ),
                    Transform(
                        Alternative(elements=[
                            Tuple(
                                title=_(
                                    "Specify levels in percentage of total RAM"
                                ),
                                elements=[
                                    Percentage(
                                        title=_("Warning if less than"),
                                        maxvalue=None,
                                    ),
                                    Percentage(
                                        title=_("Critical if less than"),
                                        maxvalue=None,
                                    ),
                                ],
                            ),
                            Tuple(
                                title=_("Specify levels in absolute values"),
                                elements=[
                                    Integer(title=_("Warning if below"),
                                            unit=_("MB")),
                                    Integer(title=_("Critical if below"),
                                            unit=_("MB")),
                                ],
                            ),
                        ], ),
                        title=_("Levels for free memory"),
                        help=_(
                            "Specify the threshold levels for the free memory space. The free memory "
                            "excludes the reserved kernel memory."),
                        forth=lambda val: tuple(-x for x in val),
                        back=lambda val: tuple(-x for x in val),
                    ),
                ],
            ),
        ),
    ], )
Exemple #22
0
 def valuespec(self):
     return Dictionary(
         elements=[
             (
                 "start",
                 Alternative(
                     title=_("Started"),
                     elements=[
                         FixedValue(
                             None,
                             totext=_("No scan has been started yet."),
                         ),
                         AbsoluteDate(
                             include_time=True,
                             default_value=0,
                         ),
                     ],
                 ),
             ),
             (
                 "end",
                 Alternative(
                     title=_("Finished"),
                     elements=[
                         FixedValue(
                             None,
                             totext=_("No scan has finished yet."),
                         ),
                         FixedValue(
                             True,
                             totext="",  # currently running
                         ),
                         AbsoluteDate(
                             include_time=True,
                             default_value=0,
                         ),
                     ],
                 ),
             ),
             (
                 "state",
                 Alternative(
                     title=_("State"),
                     elements=[
                         FixedValue(
                             None,
                             totext="",  # Not started or currently running
                         ),
                         FixedValue(
                             True,
                             totext=_("Succeeded"),
                         ),
                         FixedValue(
                             False,
                             totext=_("Failed"),
                         ),
                     ],
                 ),
             ),
             ("output", TextUnicode(title=_("Output"), )),
         ],
         title=_("Last Scan Result"),
         optional_keys=[],
         default_text=_("No scan performed yet."),
     )
Exemple #23
0
def _parameter_valuespec_memory():
    return Transform(
        Dictionary(
            elements=[
                (
                    "levels",
                    Alternative(
                        title=_("Levels for memory"),
                        show_alternative_title=True,
                        default_value=(150.0, 200.0),
                        match=match_dual_level_type,
                        help=
                        _("The used and free levels for the memory on UNIX systems take into account the "
                          "currently used memory (RAM or Swap) by all processes and sets this in relation "
                          "to the total RAM of the system. This means that the memory usage can exceed 100%. "
                          "A usage of 200% means that the total size of all processes is twice as large as "
                          "the main memory, so <b>at least</b> half of it is currently swapped out. For systems "
                          "without Swap space you should choose levels below 100%."
                          ),
                        elements=[
                            Alternative(
                                title=_("Levels for used memory"),
                                elements=[
                                    Tuple(
                                        title=
                                        _("Specify levels in percentage of total RAM"
                                          ),
                                        elements=[
                                            Percentage(title=_(
                                                "Warning at a usage of"),
                                                       maxvalue=None),
                                            Percentage(title=_(
                                                "Critical at a usage of"),
                                                       maxvalue=None)
                                        ],
                                    ),
                                    Tuple(
                                        title=_(
                                            "Specify levels in absolute values"
                                        ),
                                        elements=[
                                            Integer(title=_("Warning at"),
                                                    unit=_("MiB")),
                                            Integer(title=_("Critical at"),
                                                    unit=_("MiB"))
                                        ],
                                    ),
                                ],
                            ),
                            Transform(
                                Alternative(elements=[
                                    Tuple(
                                        title=
                                        _("Specify levels in percentage of total RAM"
                                          ),
                                        elements=[
                                            Percentage(
                                                title=_(
                                                    "Warning if less than"),
                                                maxvalue=None,
                                            ),
                                            Percentage(
                                                title=_(
                                                    "Critical if less than"),
                                                maxvalue=None,
                                            )
                                        ],
                                    ),
                                    Tuple(
                                        title=_(
                                            "Specify levels in absolute values"
                                        ),
                                        elements=[
                                            Integer(
                                                title=_("Warning if below"),
                                                unit=_("MiB")),
                                            Integer(
                                                title=_("Critical if below"),
                                                unit=_("MiB"))
                                        ],
                                    ),
                                ], ),
                                title=_("Levels for free memory"),
                                help=
                                # xgettext: no-python-format
                                _("Keep in mind that if you have 1GB RAM and 1GB Swap you need to "
                                  "specify 120% or 1200MB to get an alert if there is only 20% free RAM available. "
                                  "The free memory levels do not work with the fortigate check, because it does "
                                  "not provide total memory data."),
                                forth=lambda val: tuple(-x for x in val),
                                back=lambda val: tuple(-x for x in val),
                            )
                        ],
                    ),
                ),
                ("average",
                 Integer(
                     title=_("Averaging"),
                     help=
                     _("If this parameter is set, all measured values will be averaged "
                       "over the specified time interval before levels are being applied. Per "
                       "default, averaging is turned off."),
                     unit=_("minutes"),
                     minvalue=1,
                     default_value=60,
                 )),
            ],
            optional_keys=["average"],
        ),
        forth=lambda t: isinstance(t, tuple) and {"levels": t} or t,
    )
Exemple #24
0
def _parameter_valuespec_if():
    # Transform old traffic related levels which used "traffic" and "traffic_minimum"
    # keys where each was configured with an Alternative valuespec
    return Transform(
        Dictionary(
            ignored_keys=[
                "aggregate",
                "discovered_oper_status",
                "discovered_admin_status",
                "discovered_speed",
            ],  # Created by discovery
            elements=[
                ("errors_in", _vs_if_errors("IN")),
                ("errors_out", _vs_if_errors("OUT")),
                ("speed",
                 OptionalDropdownChoice(
                     title=_("Operating speed"),
                     help=_("If you use this parameter then the check goes warning if the "
                            "interface is not operating at the expected speed (e.g. it "
                            "is working with 100Mbit/s instead of 1Gbit/s.<b>Note:</b> "
                            "some interfaces do not provide speed information. In such cases "
                            "this setting is used as the assumed speed when it comes to "
                            "traffic monitoring (see below)."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second")))),
                ("state",
                 Optional(ListChoice(
                     title=_("Allowed operational states:"),
                     choices=defines.interface_oper_states(),
                     allow_empty=False,
                 ),
                          title=_("Operational state"),
                          help=_(
                              "If you activate the monitoring of the operational state "
                              "(<tt>ifOperStatus</tt>), the check will go critical if the current "
                              "state of the interface does not match one of the expected states."),
                          label=_("Ignore the operational state"),
                          none_label=_("ignore"),
                          negate=True)),
                ("map_operstates",
                 ListOf(
                     Tuple(orientation="horizontal",
                           elements=[
                               ListChoice(
                                   choices=defines.interface_oper_states(),
                                   allow_empty=False,
                               ),
                               MonitoringState()
                           ]),
                     title=_('Map operational states'),
                     help=_(
                         'Map the operational state (<tt>ifOperStatus</tt>) to a monitoring state.')
                 )),
                ("admin_state",
                 Optional(
                     ListChoice(
                         title=_("Allowed admin states:"),
                         choices=_admin_states(),
                         allow_empty=False,
                     ),
                     title=_("Admin state (SNMP with 64-bit counters only)"),
                     help=_("If you activate the monitoring of the admin state "
                            "(<tt>ifAdminStatus</tt>), the check will go critical if the "
                            "current state of the interface does not match one of the expected "
                            "states. " + _note_for_admin_state_options()),
                     label=_("Ignore the admin state"),
                     none_label=_("ignore"),
                     negate=True)),
                ("map_admin_states",
                 ListOf(
                     Tuple(orientation="horizontal",
                           elements=[
                               ListChoice(
                                   choices=_admin_states(),
                                   allow_empty=False,
                               ),
                               MonitoringState(),
                           ]),
                     title=_('Map admin states (SNMP with 64-bit counters only)'),
                     help=_("Map the admin state (<tt>ifAdminStatus</tt>) to a monitoring state. " +
                            _note_for_admin_state_options()),
                 )),
                ("assumed_speed_in",
                 OptionalDropdownChoice(
                     title=_("Assumed input speed"),
                     help=_(
                         "If the automatic detection of the link speed does not work "
                         "or the switch's capabilities are throttled because of the network setup "
                         "you can set the assumed speed here."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     default_value=16000000,
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second"),
                                      size=10))),
                ("assumed_speed_out",
                 OptionalDropdownChoice(
                     title=_("Assumed output speed"),
                     help=_(
                         "If the automatic detection of the link speed does not work "
                         "or the switch's capabilities are throttled because of the network setup "
                         "you can set the assumed speed here."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     default_value=1500000,
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second"),
                                      size=12))),
                ("unit",
                 DropdownChoice(
                     title=_("Measurement unit"),
                     help=_("Here you can specifiy the measurement unit of the network interface"),
                     default_value="byte",
                     choices=[
                         ("bit", _("Bits")),
                         ("byte", _("Bytes")),
                     ],
                 )),
                ("infotext_format",
                 DropdownChoice(
                     title=_("Change infotext in check output"),
                     help=
                     _("This setting allows you to modify the information text which is displayed between "
                       "the two brackets in the check output. Please note that this setting does not work for "
                       "grouped interfaces, since the additional information of grouped interfaces is different"
                      ),
                     choices=[
                         ("alias", _("Show alias")),
                         ("description", _("Show description")),
                         ("alias_and_description", _("Show alias and description")),
                         ("alias_or_description", _("Show alias if set, else description")),
                         ("desription_or_alias", _("Show description if set, else alias")),
                         ("hide", _("Hide infotext")),
                     ])),
                ("traffic",
                 ListOf(
                     CascadingDropdown(title=_("Direction"),
                                       orientation="horizontal",
                                       choices=[
                                           ('both', _("In / Out"), vs_interface_traffic()),
                                           ('in', _("In"), vs_interface_traffic()),
                                           ('out', _("Out"), vs_interface_traffic()),
                                       ]),
                     title=_("Used bandwidth (minimum or maximum traffic)"),
                     help=_("Setting levels on the used bandwidth is optional. If you do set "
                            "levels you might also consider using averaging."),
                 )),
                ("total_traffic",
                 ListOf(
                     CascadingDropdown(title=_("Direction"),
                                       orientation="horizontal",
                                       choices=[
                                           ('total', _("Total traffic"), vs_interface_traffic()),
                                       ]),
                     title=_("Used total bandwidth (in + out) (minimum or maximum traffic)"),
                     help=
                     _("By activating this item, the sum of incoming and outgoing traffic will "
                       "be monitored via a seperate metric. Setting levels on the used total bandwidth "
                       "is optional. If you do set levels you might also consider using averaging."
                      ),
                 )),
                ("average",
                 Integer(
                     title=_("Average values for used bandwidth"),
                     help=_("By activating the computation of averages, the levels on "
                            "traffic and speed are applied to the averaged value. That "
                            "way you can make the check react only on long-time changes, "
                            "not on one-minute events."),
                     unit=_("minutes"),
                     minvalue=1,
                     default_value=15,
                 )),
                (
                    "nucasts",
                    Tuple(
                        title=_("Non-unicast packet rates"),
                        help=_(
                            "Setting levels on non-unicast packet rates is optional. This may help "
                            "to detect broadcast storms and other unwanted traffic."),
                        elements=[
                            Integer(title=_("Warning at"), unit=_("pkts / sec")),
                            Integer(title=_("Critical at"), unit=_("pkts / sec")),
                        ]),
                ),
                ("multicast",
                 Alternative(title=_("Multicast packet rates"),
                             help=_(
                                 "These levels make the check go warning or critical whenever the "
                                 "<b>percentual packet rate</b> or the <b>absolute packet "
                                 "rate</b> of the monitored interface reaches the given "
                                 "bounds. The percentual packet rate is computed by "
                                 "dividing the number of multicast packets by the number "
                                 "of unicast packets."),
                             elements=[
                                 Tuple(title=_("Percentual levels for multicast packets"),
                                       elements=[
                                           Percentage(title=_("Warning at"),
                                                      unit=_("percent packets"),
                                                      default_value=10.0,
                                                      display_format='%.3f'),
                                           Percentage(title=_("Critical at"),
                                                      unit=_("percent packets"),
                                                      default_value=20.0,
                                                      display_format='%.3f')
                                       ]),
                                 Tuple(title=_("Absolute levels for multicast packets"),
                                       elements=[
                                           Integer(title=_("Warning at"), unit=_("pkts / sec")),
                                           Integer(title=_("Critical at"), unit=_("pkts / sec"))
                                       ])
                             ])),
                ("broadcast",
                 Alternative(title=_("Broadcast packet rates"),
                             help=_(
                                 "These levels make the check go warning or critical whenever the "
                                 "<b>percentual packet rate</b> or the <b>absolute packet "
                                 "rate</b> of the monitored interface reaches the given "
                                 "bounds. The percentual packet rate is computed by "
                                 "dividing the number of broadcast packets by the number "
                                 "of unicast packets."),
                             elements=[
                                 Tuple(title=_("Percentual levels for broadcast packets"),
                                       elements=[
                                           Percentage(title=_("Warning at"),
                                                      unit=_("percent packets"),
                                                      default_value=10.0,
                                                      display_format='%.3f'),
                                           Percentage(title=_("Critical at"),
                                                      unit=_("percent packets"),
                                                      default_value=20.0,
                                                      display_format='%.3f')
                                       ]),
                                 Tuple(title=_("Absolute levels for broadcast packets"),
                                       elements=[
                                           Integer(title=_("Warning at"), unit=_("pkts / sec")),
                                           Integer(title=_("Critical at"), unit=_("pkts / sec"))
                                       ])
                             ])),
                ("average_bm",
                 Integer(
                     title=_("Average values for broad- and multicast packet rates"),
                     help=_(
                         "By activating the computation of averages, the levels on "
                         "broad- and multicast packet rates are applied to "
                         "the averaged value. That way you can make the check react only on long-time "
                         "changes, not on one-minute events."),
                     unit=_("minutes"),
                     minvalue=1,
                     default_value=15,
                 )),
                ("discards",
                 Tuple(title=_("Absolute levels for discards rates"),
                       elements=[
                           Integer(title=_("Warning at"), unit=_("discards")),
                           Integer(title=_("Critical at"), unit=_("discards"))
                       ])),
                ("match_same_speed",
                 DropdownChoice(title=_("Speed of interface groups (Netapp only)"),
                                help=_("Choose the behaviour for different interface speeds in "
                                       "interface groups. The default is \"Check and WARN\". This "
                                       "feature is currently only supported by the check "
                                       "netapp_api_if."),
                                choices=[
                                    ("check_and_warn", _("Check and WARN")),
                                    ("check_and_crit", _("Check and CRIT")),
                                    ("check_and_display", _("Check and display only")),
                                    ("dont_show_and_check", _("Don't show and check")),
                                ])),
                ("home_port",
                 DropdownChoice(title=_("Is-Home state (Netapp only)"),
                                help=_("Choose the behaviour when the current port is not the "
                                       "home port of the respective interface. The default is "
                                       "\"Check and Display\". This feature is currently only "
                                       "supported by the check netapp_api_if."),
                                choices=[
                                    ("check_and_warn", _("Check and WARN")),
                                    ("check_and_crit", _("Check and CRIT")),
                                    ("check_and_display", _("Check and display only")),
                                    ("dont_show_and_check", _("Don't show home port info")),
                                ])),
            ],
        ),
        forth=transform_if,
    )
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ("bw",
          Alternative(
              title=_("Throughput levels"),
              help=
              _("Please note: in a few cases the automatic detection of the link speed "
                "does not work. In these cases you have to set the link speed manually "
                "below if you want to monitor percentage values"),
              elements=[
                  Tuple(title=_(
                      "Used bandwidth of port relative to the link speed"),
                        elements=[
                            Percentage(title=_("Warning at"),
                                       unit=_("percent")),
                            Percentage(title=_("Critical at"),
                                       unit=_("percent")),
                        ]),
                  Tuple(title=_("Used Bandwidth of port in megabyte/s"),
                        elements=[
                            Integer(title=_("Warning at"),
                                    unit=_("MByte/s")),
                            Integer(title=_("Critical at"),
                                    unit=_("MByte/s")),
                        ])
              ])),
         ("assumed_speed",
          Float(title=_("Assumed link speed"),
                help=_("If the automatic detection of the link speed does "
                       "not work you can set the link speed here."),
                unit=_("GByte/s"))),
         ("rxcrcs",
          Tuple(title=_("CRC errors rate"),
                elements=[
                    Percentage(title=_("Warning at"), unit=_("percent")),
                    Percentage(title=_("Critical at"), unit=_("percent")),
                ])),
         ("rxencoutframes",
          Tuple(title=_("Enc-Out frames rate"),
                elements=[
                    Percentage(title=_("Warning at"), unit=_("percent")),
                    Percentage(title=_("Critical at"), unit=_("percent")),
                ])),
         ("rxencinframes",
          Tuple(title=_("Enc-In frames rate"),
                elements=[
                    Percentage(title=_("Warning at"), unit=_("percent")),
                    Percentage(title=_("Critical at"), unit=_("percent")),
                ])),
         ("notxcredits",
          Tuple(title=_("No-TxCredits errors"),
                elements=[
                    Percentage(title=_("Warning at"), unit=_("percent")),
                    Percentage(title=_("Critical at"), unit=_("percent")),
                ])),
         ("c3discards",
          Tuple(title=_("C3 discards"),
                elements=[
                    Percentage(title=_("Warning at"), unit=_("percent")),
                    Percentage(title=_("Critical at"), unit=_("percent")),
                ])),
         ("average",
          Integer(
              title=_("Averaging"),
              help=
              _("If this parameter is set, all throughputs will be averaged "
                "over the specified time interval before levels are being applied. Per "
                "default, averaging is turned off. "),
              unit=_("minutes"),
              minvalue=1,
              default_value=60,
          )),
         ("phystate",
          Optional(
              ListChoice(title=_(
                  "Allowed states (otherwise check will be critical)"),
                         choices=[
                             (1, _("noCard")),
                             (2, _("noTransceiver")),
                             (3, _("laserFault")),
                             (4, _("noLight")),
                             (5, _("noSync")),
                             (6, _("inSync")),
                             (7, _("portFault")),
                             (8, _("diagFault")),
                             (9, _("lockRef")),
                         ]),
              title=_("Physical state of port"),
              negate=True,
              label=_("ignore physical state"),
          )),
         ("opstate",
          Optional(
              ListChoice(title=_(
                  "Allowed states (otherwise check will be critical)"),
                         choices=[
                             (0, _("unknown")),
                             (1, _("online")),
                             (2, _("offline")),
                             (3, _("testing")),
                             (4, _("faulty")),
                         ]),
              title=_("Operational state"),
              negate=True,
              label=_("ignore operational state"),
          )),
         ("admstate",
          Optional(
              ListChoice(title=_(
                  "Allowed states (otherwise check will be critical)"),
                         choices=[
                             (1, _("online")),
                             (2, _("offline")),
                             (3, _("testing")),
                             (4, _("faulty")),
                         ]),
              title=_("Administrative state"),
              negate=True,
              label=_("ignore administrative state"),
          )),
     ], )
Exemple #26
0
def _parameter_valuespec_cisco_qos():
    return Dictionary(elements=[
        ("unit",
         DropdownChoice(
             title=_("Measurement unit"),
             help=
             _("Here you can specifiy the measurement unit of the network interface"
               ),
             default_value="bit",
             choices=[
                 ("bit", _("Bits")),
                 ("byte", _("Bytes")),
             ],
         )),
        ("post",
         Alternative(
             title=_("Used bandwidth (traffic)"),
             help=_(
                 "Settings levels on the used bandwidth is optional. If you do set "
                 "levels you might also consider using averaging."),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(
                     title=_("Absolute levels in bits or bytes per second"),
                     help=
                     _("Depending on the measurement unit (defaults to bit) the absolute levels are set in bit or byte"
                       ),
                     elements=[
                         Integer(title=_("Warning at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                         Integer(title=_("Critical at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                     ],
                 )
             ],
         )),
        ("average",
         Integer(
             title=_("Average values"),
             help=_(
                 "By activating the computation of averages, the levels on "
                 "errors and traffic are applied to the averaged value. That "
                 "way you can make the check react only on long-time changes, "
                 "not on one-minute events."),
             unit=_("minutes"),
             minvalue=1,
         )),
        ("drop",
         Alternative(
             title=_("Number of dropped bits or bytes per second"),
             help=_(
                 "Depending on the measurement unit (defaults to bit) you can set the warn and crit "
                 "levels for the number of dropped bits or bytes"),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(elements=[
                     Integer(title=_("Warning at"),
                             size=8,
                             label=_("bits / bytes per second")),
                     Integer(title=_("Critical at"),
                             size=8,
                             label=_("bits / bytes per second")),
                 ], )
             ],
         )),
    ], )
Exemple #27
0
def get_free_used_dynamic_valuespec(
    what,
    name,
    default_value=(80.0, 90.0),
    *,
    maxvalue: Union[None, int, float] = 101.0,
):
    if what == "used":
        title = _("used space")
        course = _("above")

    else:
        title = _("free space")
        course = _("below")

    vs_subgroup: List[ValueSpec] = [
        Tuple(title=_("Percentage %s") % title,
              elements=[
                  Percentage(
                      title=_("Warning if %s") % course,
                      unit="%",
                      minvalue=0.0 if what == "used" else 0.0001,
                      maxvalue=maxvalue,
                  ),
                  Percentage(
                      title=_("Critical if %s") % course,
                      unit="%",
                      minvalue=0.0 if what == "used" else 0.0001,
                      maxvalue=maxvalue,
                  ),
              ]),
        Tuple(title=_("Absolute %s") % title,
              elements=[
                  Integer(
                      title=_("Warning if %s") % course,
                      unit=_("MB"),
                      minvalue=0 if what == "used" else 1,
                  ),
                  Integer(
                      title=_("Critical if %s") % course,
                      unit=_("MB"),
                      minvalue=0 if what == "used" else 1,
                  ),
              ])
    ]

    def validate_dynamic_levels(value, varprefix):
        if [v for v in value if v[0] < 0]:
            raise MKUserError(
                varprefix,
                _("You need to specify levels of at least 0 bytes."))

    return Alternative(
        title=_("Levels for %s %s") % (name, title),
        show_alternative_title=True,
        default_value=default_value,
        elements=vs_subgroup + [
            ListOf(
                Tuple(orientation="horizontal",
                      elements=[
                          Filesize(title=_("%s larger than") % name.title()),
                          Alternative(elements=vs_subgroup)
                      ]),
                title=_('Dynamic levels'),
                allow_empty=False,
                validate=validate_dynamic_levels,
            )
        ],
    )
Exemple #28
0
    for item in value:
        result.append((item[0], tuple_convert(item[1])))
    return result


fs_levels_elements = [
    ("levels",
     Alternative(
         title=_("Levels for filesystem"),
         show_alternative_title=True,
         default_value=(80.0, 90.0),
         match=match_dual_level_type,
         elements=[
             get_free_used_dynamic_valuespec("used", "filesystem"),
             Transform(
                 get_free_used_dynamic_valuespec("free",
                                                 "filesystem",
                                                 default_value=(20.0, 10.0)),
                 title=_("Levels for filesystem free space"),
                 forth=transform_filesystem_free,
                 back=transform_filesystem_free,
             )
         ],
     )),
    ("show_levels",
     DropdownChoice(
         title=_("Display warn/crit levels in check output..."),
         choices=[
             ("onproblem", _("Only if the status is non-OK")),
             ("onmagic",
              _("If the status is non-OK or a magic factor is set")),
Exemple #29
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,
    )
def _parameter_valuespec_netapp_volumes():
    return Dictionary(elements=[
        ("levels",
         Alternative(
             title=_("Levels for volume"),
             show_alternative_title=True,
             default_value=(80.0, 90.0),
             match=match_dual_level_type,
             elements=[
                 get_free_used_dynamic_valuespec("used", "volume"),
                 Transform(
                     get_free_used_dynamic_valuespec("free",
                                                     "volume",
                                                     default_value=(20.0,
                                                                    10.0)),
                     forth=transform_filesystem_free,
                     back=transform_filesystem_free,
                 )
             ],
         )),
        ("perfdata",
         ListChoice(
             title=_("Performance data for protocols"),
             help=
             _("Specify for which protocol performance data should get recorded."
               ),
             choices=[
                 ("", _("Summarized data of all protocols")),
                 ("nfs", _("NFS")),
                 ("cifs", _("CIFS")),
                 ("san", _("SAN")),
                 ("fcp", _("FCP")),
                 ("iscsi", _("iSCSI")),
             ],
         )),
        ("magic",
         Float(title=_(
             "Magic factor (automatic level adaptation for large volumes)"),
               default_value=0.8,
               minvalue=0.1,
               maxvalue=1.0)),
        ("magic_normsize",
         Integer(title=_("Reference size for magic factor"),
                 default_value=20,
                 minvalue=1,
                 unit=_("GB"))),
        ("levels_low",
         Tuple(
             title=_("Minimum levels if using magic factor"),
             help=_(
                 "The volume levels will never fall below these values, when using "
                 "the magic factor and the volume is very small."),
             elements=[
                 Percentage(title=_("Warning if above"),
                            unit=_("% usage"),
                            allow_int=True,
                            default_value=50),
                 Percentage(title=_("Critical if above"),
                            unit=_("% usage"),
                            allow_int=True,
                            default_value=60)
             ],
         )),
        ("inodes_levels",
         Alternative(
             title=_("Levels for Inodes"),
             help=_(
                 "The number of remaining inodes on the filesystem. "
                 "Please note that this setting has no effect on some filesystem checks."
             ),
             elements=[
                 Tuple(
                     title=_("Percentage free"),
                     elements=[
                         Percentage(title=_("Warning if less than")),
                         Percentage(title=_("Critical if less than")),
                     ],
                 ),
                 Tuple(
                     title=_("Absolute free"),
                     elements=[
                         Integer(title=_("Warning if less than"),
                                 size=10,
                                 unit=_("inodes"),
                                 minvalue=0,
                                 default_value=10000),
                         Integer(title=_("Critical if less than"),
                                 size=10,
                                 unit=_("inodes"),
                                 minvalue=0,
                                 default_value=5000),
                     ],
                 )
             ],
             default_value=(10.0, 5.0),
         )),
        ("show_inodes",
         DropdownChoice(
             title=_("Display inode usage in check output..."),
             choices=[
                 ("onproblem", _("Only in case of a problem")),
                 ("onlow",
                  _("Only in case of a problem or if inodes are below 50%")),
                 ("always", _("Always")),
             ],
             default_value="onlow",
         )),
        ("trend_range",
         Optional(Integer(
             title=_("Time Range for filesystem trend computation"),
             default_value=24,
             minvalue=1,
             unit=_("hours")),
                  title=_("Trend computation"),
                  label=_("Enable trend computation"))),
        ("trend_mb",
         Tuple(
             title=_("Levels on trends in MB per time range"),
             elements=[
                 Integer(title=_("Warning at"),
                         unit=_("MB / range"),
                         default_value=100),
                 Integer(title=_("Critical at"),
                         unit=_("MB / range"),
                         default_value=200)
             ],
         )),
        ("trend_perc",
         Tuple(
             title=_("Levels for the percentual growth per time range"),
             elements=[
                 Percentage(
                     title=_("Warning at"),
                     unit=_("% / range"),
                     default_value=5,
                 ),
                 Percentage(
                     title=_("Critical at"),
                     unit=_("% / range"),
                     default_value=10,
                 ),
             ],
         )),
        ("trend_timeleft",
         Tuple(
             title=_("Levels on the time left until the filesystem gets full"),
             elements=[
                 Integer(
                     title=_("Warning if below"),
                     unit=_("hours"),
                     default_value=12,
                 ),
                 Integer(
                     title=_("Critical if below"),
                     unit=_("hours"),
                     default_value=6,
                 ),
             ],
         )),
        ("trend_showtimeleft",
         Checkbox(
             title=_("Display time left in check output"),
             label=_("Enable"),
             help=
             _("Normally, the time left until the disk is full is only displayed when "
               "the configured levels have been breached. If you set this option "
               "the check always reports this information"))),
        ("trend_perfdata",
         Checkbox(
             title=_("Trend performance data"),
             label=_("Enable generation of performance data from trends"))),
    ], )