Beispiel #1
0
def _parameter_valuespec_f5_bigip_snat():
    return Dictionary(elements=[("if_in_octets",
                                 Levels(
                                     title=_("Incoming Traffic Maximum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_in_octets_lower",
                                 Levels(
                                     title=_("Incoming Traffic Minimum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_out_octets",
                                 Levels(
                                     title=_("Outgoing Traffic Maximum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_out_octets_lower",
                                 Levels(
                                     title=_("Outgoing Traffic Minimum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_total_octets",
                                 Levels(
                                     title=_("Total Traffic Maximum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_total_octets_lower",
                                 Levels(
                                     title=_("Total Traffic Minimum"),
                                     unit=_("bytes/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_in_pkts",
                                 Levels(
                                     title=_("Incoming Packets Maximum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_in_pkts_lower",
                                 Levels(
                                     title=_("Incoming Packets Minimum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_out_pkts",
                                 Levels(
                                     title=_("Outgoing Packets Maximum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_out_pkts_lower",
                                 Levels(
                                     title=_("Outgoing Packets Minimum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_total_pkts",
                                 Levels(
                                     title=_("Total Packets Maximum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 )),
                                ("if_total_pkts_lower",
                                 Levels(
                                     title=_("Total Packets Minimum"),
                                     unit=_("packets/s"),
                                     default_difference=(5, 8),
                                     default_value=None,
                                 ))], )
Beispiel #2
0
def _parameter_valuespec_memory():
    return Dictionary(elements=[
        ("levels_ram", DualMemoryLevels(_("RAM"))),
    ], )
Beispiel #3
0
def _valuespec_special_agents_jenkins():
    return Transform(
        valuespec=Dictionary(
            title=_("Jenkins jobs and builds"),
            help=_("Requests data from a jenkins instance."),
            optional_keys=["port"],
            elements=[
                (
                    "instance",
                    TextInput(
                        title=_("Jenkins instance to query."),
                        help=_(
                            "Use this option to set which instance should be "
                            "checked by the special agent. Please add the "
                            "hostname here, eg. my_jenkins.com."),
                        size=32,
                        allow_empty=False,
                    ),
                ),
                (
                    "user",
                    TextInput(
                        title=_("Username"),
                        help=
                        _("The username that should be used for accessing the "
                          "jenkins API. Has to have read permissions at least."
                          ),
                        size=32,
                        allow_empty=False,
                    ),
                ),
                (
                    "password",
                    PasswordFromStore(
                        help=_("The password or API key of the user."),
                        title=_("Password of the user"),
                        allow_empty=False,
                    ),
                ),
                (
                    "protocol",
                    DropdownChoice(
                        title=_("Protocol"),
                        choices=[
                            ("http", "HTTP"),
                            ("https", "HTTPS"),
                        ],
                        default_value="https",
                    ),
                ),
                (
                    "port",
                    Integer(
                        title=_("Port"),
                        help=
                        _("Use this option to query a port which is different from standard port 8080."
                          ),
                        default_value=443,
                    ),
                ),
                (
                    "sections",
                    ListChoice(
                        title=_("Informations to query"),
                        help=
                        _("Defines what information to query. You can choose "
                          "between the instance state, job states, node states "
                          "and the job queue."),
                        choices=[
                            ("instance", _("Instance state")),
                            ("jobs", _("Job state")),
                            ("nodes", _("Node state")),
                            ("queue", _("Queue info")),
                        ],
                        default_value=["instance", "jobs", "nodes", "queue"],
                        allow_empty=False,
                    ),
                ),
            ],
        ),
        forth=_transform_jenkins_infos,
    )
Beispiel #4
0
def _parameter_valuespec_ddn_s2a_port_errors() -> Dictionary:
    return Dictionary(elements=[
        ("link_failure_errs",
         Tuple(
             title=_("Link failure errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("lost_sync_errs",
         Tuple(
             title=_("Lost synchronization errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("loss_of_signal_errs",
         Tuple(
             title=_("Loss of signal errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("prim_seq_errs",
         Tuple(
             title=_("PrimSeq erros"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("crc_errs",
         Tuple(
             title=_("CRC errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("receive_errs",
         Tuple(
             title=_("Receive errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("ctio_timeouts",
         Tuple(
             title=_("CTIO timeouts"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("ctio_xmit_errs",
         Tuple(
             title=_("CTIO transmission errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("ctio_other_errs",
         Tuple(
             title=_("other CTIO errors"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
    ], )
Beispiel #5
0
def _parameter_valuespec_drbd():
    return Dictionary(
        ignored_keys=[
            'roles_inventory',
            'diskstates_inventory',
        ],
        elements=[
            ("roles",
             Alternative(
                 title=_("Roles"),
                 elements=[
                     FixedValue(None, totext="", title=_("Do not monitor")),
                     ListOf(Tuple(
                         orientation="horizontal",
                         elements=[
                             DropdownChoice(
                                 title=_("DRBD shows up as"),
                                 default_value="running",
                                 choices=[("primary_secondary",
                                           _("Primary / Secondary")),
                                          ("primary_primary",
                                           _("Primary / Primary")),
                                          ("secondary_primary",
                                           _("Secondary / Primary")),
                                          ("secondary_secondary",
                                           _("Secondary / Secondary"))],
                             ),
                             MonitoringState(title=_("Resulting state"), ),
                         ],
                         default_value=("ignore", 0)),
                            title=_("Set roles"),
                            add_label=_("Add role rule"))
                 ],
             )),
            (
                "diskstates",
                Alternative(
                    title=_("Diskstates"),
                    elements=[
                        FixedValue(None, totext="", title=_("Do not monitor")),
                        ListOf(Tuple(
                            elements=[
                                DropdownChoice(
                                    title=_("Diskstate"),
                                    choices=[
                                        ("primary_Diskless",
                                         _("Primary - Diskless")),
                                        ("primary_Attaching",
                                         _("Primary - Attaching")),
                                        ("primary_Failed",
                                         _("Primary - Failed")),
                                        ("primary_Negotiating",
                                         _("Primary - Negotiating")),
                                        ("primary_Inconsistent",
                                         _("Primary - Inconsistent")),
                                        ("primary_Outdated",
                                         _("Primary - Outdated")),
                                        ("primary_DUnknown",
                                         _("Primary - DUnknown")),
                                        ("primary_Consistent",
                                         _("Primary - Consistent")),
                                        ("primary_UpToDate",
                                         _("Primary - UpToDate")),
                                        ("secondary_Diskless",
                                         _("Secondary - Diskless")),
                                        ("secondary_Attaching",
                                         _("Secondary - Attaching")),
                                        ("secondary_Failed",
                                         _("Secondary - Failed")),
                                        ("secondary_Negotiating",
                                         _("Secondary - Negotiating")),
                                        ("secondary_Inconsistent",
                                         _("Secondary - Inconsistent")),
                                        ("secondary_Outdated",
                                         _("Secondary - Outdated")),
                                        ("secondary_DUnknown",
                                         _("Secondary - DUnknown")),
                                        ("secondary_Consistent",
                                         _("Secondary - Consistent")),
                                        ("secondary_UpToDate",
                                         _("Secondary - UpToDate")),
                                    ],
                                ),
                                MonitoringState(title=_("Resulting state"))
                            ],
                            orientation="horizontal",
                        ),
                               title=_("Set diskstates"),
                               add_label=_("Add diskstate rule"))
                    ],
                ),
            )
        ],
    )
Beispiel #6
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[_vs_cpu_credits_balance(),
                   _vs_burst_balance()])
Beispiel #7
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[
             ("if_in_octets",
              Levels(
                  title=_("Incoming Traffic Maximum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_in_octets_lower",
              Levels(
                  title=_("Incoming Traffic Minimum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_out_octets",
              Levels(
                  title=_("Outgoing Traffic Maximum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_out_octets_lower",
              Levels(
                  title=_("Outgoing Traffic Minimum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_total_octets",
              Levels(
                  title=_("Total Traffic Maximum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_total_octets_lower",
              Levels(
                  title=_("Total Traffic Minimum"),
                  unit=_("bytes/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_in_pkts",
              Levels(
                  title=_("Incoming Packets Maximum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_in_pkts_lower",
              Levels(
                  title=_("Incoming Packets Minimum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_out_pkts",
              Levels(
                  title=_("Outgoing Packets Maximum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_out_pkts_lower",
              Levels(
                  title=_("Outgoing Packets Minimum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_total_pkts",
              Levels(
                  title=_("Total Packets Maximum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             ("if_total_pkts_lower",
              Levels(
                  title=_("Total Packets Minimum"),
                  unit=_("packets/s"),
                  default_difference=(5, 8),
                  default_value=None,
              )),
             (
                 "state",
                 Dictionary(
                     title=_("Map states"),
                     elements=[
                         ("is_disabled", MonitoringState(
                             title=_("Is disabled"), default_value=1)),
                         ("is_up_and_available",
                          MonitoringState(title=_("Is up and available"), default_value=0)),
                         ("is_currently_not_available",
                          MonitoringState(
                              title=_("Is currently not available"), default_value=2)),
                         ("is_not_available",
                          MonitoringState(title=_("Is not available"), default_value=2)),
                         ("availability_is_unknown",
                          MonitoringState(title=_("Availability is unknown"), default_value=1)),
                         ("is_unlicensed",
                          MonitoringState(title=_("Is unlicensed"), default_value=3)),
                         (
                             "children_pool_members_down_if_not_available",
                             # Special handling, see check plugin
                             MonitoringState(
                                 title=
                                 _("The children pool member(s) are down if VServer is not available"
                                  ),
                                 default_value=0)),
                     ],
                     optional_keys=False,
                 )),
         ],)
Beispiel #8
0
    def page_edit(cls):
        back_url = html.get_url_input("back", cls.list_url())

        cls.load()
        cls.need_overriding_permission("edit")

        # Three possible modes:
        # "create" -> create completely new page
        # "clone"  -> like new, but prefill form with values from existing page
        # "edit"   -> edit existing page
        mode = html.request.var('mode', 'edit')
        if mode == "create":
            title = cls.phrase("create")
            page_dict = {
                "name": cls.default_name(),
                "topic": cls.default_topic(),
            }
        else:
            # Load existing page. visual from disk - and create a copy if 'load_user' is set
            page_name = html.request.var("load_name")
            if mode == "edit":
                title = cls.phrase("edit")

                owner_user_id = UserId(
                    html.request.get_unicode_input_mandatory("owner", config.user.id))
                if owner_user_id == config.user.id:
                    page = cls.find_my_page(page_name)
                else:
                    page = cls.find_foreign_page(owner_user_id, page_name)

                if page is None:
                    raise MKUserError(None,
                                      _("The requested %s does not exist") % cls.phrase("title"))

                # TODO FIXME: Looks like a hack
                cls.remove_instance((owner_user_id, page_name))  # will be added later again
            else:  # clone
                title = cls.phrase("clone")
                load_user = html.request.get_unicode_input(
                    "load_user")  # FIXME: Change varname to "owner"

                try:
                    page = cls.instance((load_user, page_name))
                except KeyError:
                    raise MKUserError(None,
                                      _("The requested %s does not exist") % cls.phrase("title"))
            page_dict = page.internal_representation()

        html.header(title)
        html.begin_context_buttons()
        html.context_button(_("Back"), back_url, "back")
        html.end_context_buttons()

        parameters, keys_by_topic = cls._collect_parameters(mode)
        vs = Dictionary(
            title=_("General Properties"),
            render='form',
            optional_keys=False,
            elements=parameters,
            headers=keys_by_topic,
        )

        def validate(page_dict):
            owner_user_id = UserId(html.request.get_unicode_input_mandatory(
                "owner", config.user.id))
            page_name = page_dict["name"]
            if owner_user_id == config.user.id:
                page = cls.find_my_page(page_name)
            else:
                page = cls.find_foreign_page(owner_user_id, page_name)
            if page:
                raise MKUserError(
                    "_p_name",
                    _("You already have an element with the ID <b>%s</b>") % page_dict["name"])

        new_page_dict = forms.edit_valuespec(vs,
                                             page_dict,
                                             validate=validate,
                                             focus="_p_title",
                                             method="POST")
        if new_page_dict is not None:
            # Take over keys from previous value that are specific to the page type
            # and not edited here.
            if mode in ("edit", "clone"):
                for key, value in page_dict.items():
                    new_page_dict.setdefault(key, value)

            owner = UserId(html.request.get_unicode_input_mandatory("owner", config.user.id))
            new_page_dict["owner"] = owner
            new_page = cls(new_page_dict)

            cls.add_page(new_page)
            cls.save_user_instances(owner)
            if mode == "create":
                redirect_url = new_page.after_create_url() or back_url
            else:
                redirect_url = back_url

            html.immediate_browser_redirect(0.5, redirect_url)
            html.show_message(_('Your changes haven been saved.'))
            # Reload sidebar.TODO: This code logically belongs to PageRenderer. How
            # can we simply move it there?
            # TODO: This is not true for all cases. e.g. the BookmarkList is not
            # of type PageRenderer but has a dedicated sidebar snapin. Maybe
            # the best option would be to make a dedicated method to decide whether
            # or not to reload the sidebar.
            if new_page_dict.get("hidden") in [ None, False ] \
               or new_page_dict.get("hidden") != page_dict.get("hidden"):
                html.reload_sidebar()

        else:
            html.show_localization_hint()

        html.footer()
Beispiel #9
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[
             ("minage_oldest",
              Tuple(
                  title=_("Minimal age of oldest file"),
                  elements=[
                      Age(title=_("Warning if younger than")),
                      Age(title=_("Critical if younger than")),
                  ],
              )),
             ("maxage_oldest",
              Tuple(
                  title=_("Maximal age of oldest file"),
                  elements=[
                      Age(title=_("Warning if older than")),
                      Age(title=_("Critical if older than")),
                  ],
              )),
             ("minage_newest",
              Tuple(
                  title=_("Minimal age of newest file"),
                  elements=[
                      Age(title=_("Warning if younger than")),
                      Age(title=_("Critical if younger than")),
                  ],
              )),
             ("maxage_newest",
              Tuple(
                  title=_("Maximal age of newest file"),
                  elements=[
                      Age(title=_("Warning if older than")),
                      Age(title=_("Critical if older than")),
                  ],
              )),
             ("minsize_smallest",
              Tuple(
                  title=_("Minimal size of smallest file"),
                  elements=[
                      Filesize(title=_("Warning if below")),
                      Filesize(title=_("Critical if below")),
                  ],
              )),
             ("maxsize_smallest",
              Tuple(
                  title=_("Maximal size of smallest file"),
                  elements=[
                      Filesize(title=_("Warning if above")),
                      Filesize(title=_("Critical if above")),
                  ],
              )),
             ("minsize_largest",
              Tuple(
                  title=_("Minimal size of largest file"),
                  elements=[
                      Filesize(title=_("Warning if below")),
                      Filesize(title=_("Critical if below")),
                  ],
              )),
             ("maxsize_largest",
              Tuple(
                  title=_("Maximal size of largest file"),
                  elements=[
                      Filesize(title=_("Warning if above")),
                      Filesize(title=_("Critical if above")),
                  ],
              )),
             ("minsize",
              Tuple(
                  title=_("Minimal size"),
                  elements=[
                      Filesize(title=_("Warning if below")),
                      Filesize(title=_("Critical if below")),
                  ],
              )),
             ("maxsize",
              Tuple(
                  title=_("Maximal size"),
                  elements=[
                      Filesize(title=_("Warning if above")),
                      Filesize(title=_("Critical if above")),
                  ],
              )),
             ("mincount",
              Tuple(
                  title=_("Minimal file count"),
                  elements=[
                      Integer(title=_("Warning if below")),
                      Integer(title=_("Critical if below")),
                  ],
              )),
             ("maxcount",
              Tuple(
                  title=_("Maximal file count"),
                  elements=[
                      Integer(title=_("Warning if above")),
                      Integer(title=_("Critical if above")),
                  ],
              )),
             ("timeofday",
              ListOfTimeRanges(
                  title=_("Only check during the following times of the day"),
                  help=_("Outside these ranges the check will always be OK"),
              )),
             ("conjunctions",
              ListOf(
                  Tuple(elements=[
                      MonitoringState(title=_("Monitoring state"), default_value=2),
                      ListOf(
                          CascadingDropdown(
                              orientation="hroizontal",
                              choices=[
                                  ("count", _("File count at"), Integer()),
                                  ("count_lower", _("File count below"), Integer()),
                                  ("size", _("File size at"), Filesize()),
                                  ("size_lower", _("File size below"), Filesize()),
                                  ("largest_size", _("Largest file size at"), Filesize()),
                                  ("largest_size_lower", _("Largest file size below"),
                                   Filesize()),
                                  ("smallest_size", _("Smallest file size at"), Filesize()),
                                  ("smallest_size_lower", _("Smallest file size below"),
                                   Filesize()),
                                  ("oldest_age", _("Oldest file age at"), Age()),
                                  ("oldest_age_lower", _("Oldest file age below"), Age()),
                                  ("newest_age", _("Newest file age at"), Age()),
                                  ("newest_age_lower", _("Newest file age below"), Age()),
                              ],
                          ),
                          magic="@#@#",
                      )
                  ],),
                  title=_("Level conjunctions"),
                  help=
                  _("In order to check dependent file group statistics you can configure "
                    "conjunctions of single levels now. A conjunction consists of a monitoring state "
                    "and any number of upper or lower levels. If all of the configured levels within "
                    "a conjunction are reached then the related state is reported."),
              )),
         ],
         ignored_keys=["precompiled_patterns"],
     )
Beispiel #10
0
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ("rtt_type",
          DropdownChoice(
              title=_("RTT type"),
              choices=[
                  ('echo', _("echo")),
                  ('path echo', _("path echo")),
                  ('file IO', _("file IO")),
                  ('UDP echo', _("UDP echo")),
                  ('TCP connect', _("TCP connect")),
                  ('HTTP', _("HTTP")),
                  ('DNS', _("DNS")),
                  ('jitter', _("jitter")),
                  ('DLSw', _("DLSw")),
                  ('DHCP', _("DHCP")),
                  ('FTP', _("FTP")),
                  ('VoIP', _("VoIP")),
                  ('RTP', _("RTP")),
                  ('LSP group', _("LSP group")),
                  ('ICMP jitter', _("ICMP jitter")),
                  ('LSP ping', _("LSP ping")),
                  ('LSP trace', _("LSP trace")),
                  ('ethernet ping', _("ethernet ping")),
                  ('ethernet jitter', _("ethernet jitter")),
                  ('LSP ping pseudowire', _("LSP ping pseudowire")),
              ],
              default_value="echo",
          )),
         ("threshold",
          Integer(
              title=_("Treshold"),
              help=_("Depending on the precision the unit can be "
                     "either milliseconds or micoseconds."),
              unit=_("ms/us"),
              minvalue=1,
              default_value=5000,
          )),
         ("state",
          DropdownChoice(
              title=_("State"),
              choices=[
                  ('active', _("active")),
                  ('inactive', _("inactive")),
                  ('reset', _("reset")),
                  ('orderly stop', _("orderly stop")),
                  ('immediate stop', _("immediate stop")),
                  ('pending', _("pending")),
                  ('restart', _("restart")),
              ],
              default_value="active",
          )),
         ("connection_lost_occured",
          DropdownChoice(
              title=_("Connection lost occured"),
              choices=[
                  ("yes", _("yes")),
                  ("no", _("no")),
              ],
              default_value="no",
          )),
         ("timeout_occured",
          DropdownChoice(
              title=_("Timeout occured"),
              choices=[
                  ("yes", _("yes")),
                  ("no", _("no")),
              ],
              default_value="no",
          )),
         ("completion_time_over_treshold_occured",
          DropdownChoice(
              title=_("Completion time over treshold occured"),
              choices=[
                  ("yes", _("yes")),
                  ("no", _("no")),
              ],
              default_value="no",
          )),
         ("latest_rtt_completion_time",
          Tuple(
              title=_("Latest RTT completion time"),
              help=_("Depending on the precision the unit can be "
                     "either milliseconds or micoseconds."),
              elements=[
                  Integer(
                      title=_("Warning at"),
                      unit=_("ms/us"),
                      minvalue=1,
                      default_value=100,
                  ),
                  Integer(
                      title=_("Critical at"),
                      unit=_("ms/us"),
                      minvalue=1,
                      default_value=200,
                  ),
              ],
          )),
         ("latest_rtt_state",
          DropdownChoice(
              title=_("Latest RTT state"),
              choices=[
                  ('ok', _("OK")),
                  ('disconnected', _("disconnected")),
                  ('over treshold', _("over treshold")),
                  ('timeout', _("timeout")),
                  ('other', _("other")),
              ],
              default_value="ok",
          )),
     ], )
Beispiel #11
0
    def _vs_directory_options(self, ty: str) -> Dictionary:
        connect_to_choices: List[CascadingDropdownChoice] = [
            (
                "fixed_list",
                _("Manually specify list of LDAP servers"),
                Dictionary(
                    elements=[
                        (
                            "server",
                            TextInput(
                                title=_("LDAP Server"),
                                help=_(
                                    "Set the host address of the LDAP server. Might be an IP address or "
                                    "resolvable hostname."
                                ),
                                allow_empty=False,
                            ),
                        ),
                        (
                            "failover_servers",
                            ListOfStrings(
                                title=_("Failover Servers"),
                                help=_(
                                    "When the connection to the first server fails with connect specific errors "
                                    "like timeouts or some other network related problems, the connect mechanism "
                                    "will try to use this server instead of the server configured above. If you "
                                    "use persistent connections (default), the connection is being used until the "
                                    "LDAP is not reachable or the local webserver is restarted."
                                ),
                                allow_empty=False,
                            ),
                        ),
                    ],
                    optional_keys=["failover_servers"],
                ),
            ),
        ]

        if ty == "ad":
            connect_to_choices.append(
                (
                    "discover",
                    _("Automatically discover LDAP server"),
                    Dictionary(
                        elements=[
                            (
                                "domain",
                                TextInput(
                                    title=_("DNS domain name to discover LDAP servers of"),
                                    help=_(
                                        "Configure the DNS domain name of your Active directory domain here, Check_MK "
                                        "will then query this domain for it's closest domain controller to communicate "
                                        "with."
                                    ),
                                    allow_empty=False,
                                ),
                            ),
                        ],
                        optional_keys=[],
                    ),
                ),
            )

        return Dictionary(
            elements=[
                (
                    "connect_to",
                    CascadingDropdown(
                        title=_("Connect to"),
                        choices=connect_to_choices,
                    ),
                ),
            ],
            optional_keys=[],
        )
Beispiel #12
0
def _parameter_valuespec_heartbeat_crm():
    return Transform(
        Dictionary(
            elements=[
                (
                    "max_age",
                    Integer(
                        title=_("Maximum age"),
                        help=_("Maximum accepted age of the reported data in seconds"),
                        unit=_("seconds"),
                        default_value=60,
                    ),
                ),
                (
                    "dc",
                    TextInput(
                        allow_empty=False,
                        title=_("Expected DC"),
                        help=_(
                            "The hostname of the expected distinguished controller of the cluster"
                        ),
                    ),
                ),
                (
                    "num_nodes",
                    Integer(
                        minvalue=0,
                        default_value=2,
                        title=_("Number of Nodes"),
                        help=_("The expected number of nodes in the cluster"),
                    ),
                ),
                (
                    "num_resources",
                    Integer(
                        minvalue=0,
                        title=_("Number of Resources"),
                        help=_("The expected number of resources in the cluster"),
                    ),
                ),
                (
                    "show_failed_actions",
                    DropdownChoice(
                        title=_('Show "Failed Actions"'),
                        choices=[
                            (
                                False,
                                _('Don\'t show or warn if "Failed Actions" are present (default)'),
                            ),
                            (True, _('Show "Failed Actions" and warn if any is present')),
                        ],
                        default_value=False,
                        help=_(
                            'If activated, any "Failed Action" entry will be shown in the main check '
                            "and the check will go to the WARN state."
                        ),
                    ),
                ),
            ],
            optional_keys=["dc", "num_nodes", "num_resources", "show_failed_actions"],
        ),
        forth=_heartbeat_crm_transform_heartbeat_crm,
    )
Beispiel #13
0
def _parameter_valuespec_ibm_svc_mdisk():
    return Dictionary(
        optional_keys=False,
        elements=[
            (
                "online_state",
                MonitoringState(
                    title=_("Resulting state if disk is online"),
                    default_value=0,
                ),
            ),
            (
                "degraded_state",
                MonitoringState(
                    title=_("Resulting state if disk is degraded"),
                    default_value=1,
                ),
            ),
            (
                "offline_state",
                MonitoringState(
                    title=_("Resulting state if disk is offline"),
                    default_value=2,
                ),
            ),
            (
                "excluded_state",
                MonitoringState(
                    title=_("Resulting state if disk is excluded"),
                    default_value=2,
                ),
            ),
            (
                "managed_mode",
                MonitoringState(
                    title=_("Resulting state if disk is in managed mode"),
                    default_value=0,
                ),
            ),
            (
                "array_mode",
                MonitoringState(
                    title=_("Resulting state if disk is in array mode"),
                    default_value=0,
                ),
            ),
            (
                "image_mode",
                MonitoringState(
                    title=_("Resulting state if disk is in image mode"),
                    default_value=0,
                ),
            ),
            (
                "unmanaged_mode",
                MonitoringState(
                    title=_("Resulting state if disk is in unmanaged mode"),
                    default_value=1,
                ),
            ),
        ],
    )
Beispiel #14
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[
             (_vs_cisco_dom("upper")),
             (_vs_cisco_dom("lower")),
         ],)
Beispiel #15
0
 def parameter_valuespec(self):
     return Dictionary(elements=[_vs_latency()])
def _valuespec_agent_config_access_logs():
    return Alternative(
        title = _("HTTP Access Logs (Linux)"),
        help = _("This will deploy the agent plugin <tt>access_logs</tt> "
                 "for checking various HTTP access logs of webservers "
                 "like Apache, Nginx, Tomcat. It counts the latest number of requests "
                 "per status code for a configurable period of time."
                ),
        style = "dropdown",
        elements = [
            Dictionary(
                title = _("Deploy the HTTP Access Logs plugin"),
                elements = [
                   ( "log_files",
                     ListOfStrings(
                        title = _("Logfile Patterns"),
                        help = _('A list of additional access log file patterns that should be considered for discovery. The path can contain globbing wildcards (<tt>*</tt> & <tt>?</tt>) to mask variable parts. Only the newest file which matches a pattern will be used for analysis.'),
                        valuespec = TextAscii(
                            size = 80,
                            regex = "^/(/?[^\0/])+|/$",
                            regex_error = _("Logfile pattern must begin with <tt>/</tt>."),
                        ),
                        allow_empty = False,
                     )
                   ),
                   ( "read_back",
                     Age(
                        title = _("Readback Age"),
                        help = _('The time period which should be considered when reading the access logfile (based on the current time'),
                        display = ["minutes", "seconds"],
                        label = "reading the last",
                        default_value = 300
                     )
                   ),
                   ( "line_regexp",
                     ListOfStrings(
                        title = _("Line Regexp Patterns"),
                        help = _("A list of custom regular expression which will be applied against each line of the access log file to extract the date and response status."
                                 "The pattern must be capture the date as named group 'date' (via <tt>(?P<date>.+)</tt> and the status as named group 'status' (via <tt>(?P<status>\d+)</tt><br><br>"
                                 ),
                        allow_empty = False,
                        valuespec = RegExp(
                                        size = 80,
                                        regex = "^(?=.*\(\?P\<status\>)(?=.*\(\?P\<date\>).*$",
                                        regex_error = _("The regular expression does not contain both group captures to extract the date <tt>(?P<date>.+)</tt> and status code <tt>(?P<status>\d+)</tt><br><br>Please add both named groups!"),
                                        mingroups = 2,
                                        maxgroups = 2,
                                        mode = "prefix"
                                    ),
                        default_value = [ r'^(?:\S+\s+)+\[(?P<date>[^\]]+) \+\d\d\d\d\]\s+"[^"]*"\s+(?P<status>\d+)' ]
                     )
                   ),
                   ( "date_formats",
                     ListOfStrings(
                        title = _("Date Format Strings"),
                        help = _("A list of custom date format string which will be used to parse a date/time entry which is extracted by a line regexp to determine the exact timestamp of a request. The python function datetime.strptime() will be used for this, see Python documentation (<tt>https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes</tt>) to get the full list of placeholders."),
                        allow_empty = False,
                        valuespec = TextAscii(
                            size = 80,
                            regex = r"^.*%.*$",
                            regex_error = _("The given pattern does not contain any placeholder to extract date/time informations.")
                        )
                     )
                   )
                ],
                optional_keys = True,
            ),
            FixedValue(None, title = _("Do not deploy the HTTP Access Logs plugin"), totext = _("(disabled)") ),
        ],
    )
Beispiel #17
0
 def parameter_valuespec(self):
     return Dictionary(elements=_vs_elements_http_errors())
Beispiel #18
0
def _parameter_valuespec_jenkins_nodes():
    return Dictionary(elements=[
        ("jenkins_offline", MonitoringState(title=_("Node state: Offline"), default_value=2)),
        ("jenkins_mode",
         DropdownChoice(
             title=_("Expected mode state."),
             help=_("Choose between Normal (Utilize this node as much "
                    "as possible) and Exclusive (Only build jobs with label "
                    "restrictions matching this node). The state will "
                    "change to warning state, if the mode differs."),
             choices=[
                 ("NORMAL", _("Normal")),
                 ("EXCLUSIVE", _("Exclusive")),
             ],
             default_value="NORMAL",
         )),
        ('jenkins_numexecutors',
         Tuple(
             title=_("Lower level for number of executors of this node"),
             elements=[
                 Integer(title=_("Warning below")),
                 Integer(title=_("Critical below")),
             ],
         )),
        ('jenkins_busyexecutors',
         Tuple(
             title=_("Upper level for number of busy executors of this node"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ('jenkins_idleexecutors',
         Tuple(
             title=_("Upper level for number of idle executors of this node"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ('avg_response_time',
         Tuple(
             title=_("Average round-trip response time to this node"),
             elements=[
                 Age(title=_("Warning at")),
                 Age(title=_("Critical at")),
             ],
         )),
        ('jenkins_clock',
         Tuple(
             title=_("Clock difference"),
             elements=[
                 Age(title=_("Warning at")),
                 Age(title=_("Critical at")),
             ],
         )),
        ("jenkins_temp",
         Tuple(
             title=_("Absolute levels for free temp space"),
             elements=[
                 Integer(
                     title=_("Warning if below"),
                     unit=_("MB"),
                     minvalue=0,
                 ),
                 Integer(
                     title=_("Critical if below"),
                     unit=_("MB"),
                     minvalue=0,
                 ),
             ],
         )),
    ],)
Beispiel #19
0
def _parameter_valuespec_livestatus_status():
    return Dictionary(
        help=
        _("When monitoring the performance of a monitoring site (i.e. its core) "
          "then also settings are being checked, e.g. for manually disabled notifications. "
          "The status of the various situations can be configured here."),
        elements=[
            ("site_stopped",
             MonitoringState(title="State when the site is stopped",
                             default_value=2)),
            ("execute_host_checks",
             MonitoringState(title="State when host checks are disabled",
                             default_value=2)),
            ("execute_service_checks",
             MonitoringState(title="State when service checks are disabled",
                             default_value=2)),
            ("accept_passive_host_checks",
             MonitoringState(
                 title="State when not accepting passive host checks",
                 default_value=2)),
            ("accept_passive_service_checks",
             MonitoringState(
                 title="State when not accepting passive service checks",
                 default_value=2)),
            ("check_host_freshness",
             MonitoringState(title="State when not checking host freshness",
                             default_value=2)),
            ("check_service_freshness",
             MonitoringState(title="State when not checking service freshness",
                             default_value=2)),
            ("enable_event_handlers",
             MonitoringState(title="State when event handlers are disabled",
                             default_value=0)),
            ("enable_flap_detection",
             MonitoringState(title="State when flap detection is disabled",
                             default_value=1)),
            ("enable_notifications",
             MonitoringState(title="State when notifications are disabled",
                             default_value=2)),
            ("process_performance_data",
             MonitoringState(title="State when performance data is disabled",
                             default_value=1)),
            ("check_external_commands",
             MonitoringState(title="State when not checking external commands",
                             default_value=2)),
            ("site_cert_days",
             Tuple(
                 title=_("Site certificate validity"),
                 help=_(
                     "Minimum number of days a certificate has to be valid."),
                 elements=[
                     Integer(
                         title=_("Warning at or below"),
                         minvalue=0,
                         unit=_("days"),
                         default_value=30,
                     ),
                     Integer(
                         title=_("Critical at or below"),
                         minvalue=0,
                         unit=_("days"),
                         default_value=7,
                     ),
                 ],
             )),
            ("average_latency_generic",
             Tuple(title=_("Levels Latency Check"),
                   help=_("Set Levels for the Check Latency Time"),
                   elements=[
                       Age(
                           title=_("Warning at or above"),
                           default_value=30,
                       ),
                       Age(
                           title=_("Critical at or above"),
                           default_value=60,
                       ),
                   ])),
            ("average_latency_cmk",
             Tuple(title=_("Levels Latency Checkmk"),
                   help=_("Set Levels for the Checkmk Latency Time"),
                   elements=[
                       Age(
                           title=_("Warning at or above"),
                           default_value=30,
                       ),
                       Age(
                           title=_("Critical at or above"),
                           default_value=60,
                       ),
                   ])),
            ("helper_usage_generic",
             Tuple(title=_("Levels Helper usage Check"),
                   help=_("Set Levels for the Check helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="60",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("helper_usage_cmk",
             Tuple(title=_("Levels Helper usage Checkmk"),
                   help=_("Set Levels for the Checkmk helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="60",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("livestatus_usage",
             Tuple(title=_("Levels Livestatus Usage"),
                   help=_("Set Levels for the Checkmk Livestatus Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="80",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("livestatus_overflows_rate",
             Tuple(title=_("Levels Livestatus Overflows"),
                   help=_("Set Levels for the Checkmk Livestatus Overflows"),
                   elements=[
                       Float(
                           title=_("Warning at or above"),
                           unit=_("/s"),
                           default_value="0.01",
                       ),
                       Float(
                           title=_("Critical at or above"),
                           unit=_("/s"),
                           default_value="0.02",
                       ),
                   ])),
            ("levels_hosts",
             Tuple(title=_("Levels Hosts"),
                   help=_("Set Levels for the number of Hosts"),
                   elements=[
                       Integer(
                           title=_("Warning at or above"),
                           unit=_("Hosts"),
                       ),
                       Integer(
                           title=_("Critical at or above"),
                           unit=_("Hosts"),
                       ),
                   ])),
            ("levels_services",
             Tuple(title=_("Levels Services"),
                   help=_("Set Levels for the number of Services"),
                   elements=[
                       Integer(
                           title=_("Warning at or above"),
                           unit=_("Services"),
                       ),
                       Integer(
                           title=_("Critical at or above"),
                           unit=_("Services"),
                       ),
                   ])),
        ],
    )
Beispiel #20
0
def _parameter_valuespec_ipmi():
    return Dictionary(
        elements=[
            (
                "sensor_states",
                ListOf(
                    Tuple(elements=[TextInput(),
                                    MonitoringState()], ),
                    title=_("Set states of IPMI sensor status texts"),
                    help=_(
                        "The pattern specified here must match exactly the beginning of "
                        "the sensor state (case sensitive)."),
                ),
            ),
            (
                "ignored_sensors",
                ListOfStrings(
                    title=_(
                        "Ignore the following IPMI sensors (only summary)"),
                    help=
                    _("Names of IPMI sensors that should be ignored when summarizing."
                      "The pattern specified here must match exactly the beginning of "
                      "the actual sensor name (case sensitive)."),
                    orientation="horizontal",
                ),
            ),
            (
                "ignored_sensorstates",
                ListOfStrings(
                    title=_(
                        "Ignore the following IPMI sensor states (only summary)"
                    ),
                    help=
                    _("IPMI sensors with these states that should be ignored when summarizing."
                      "The pattern specified here must match exactly the beginning of "
                      "the actual sensor state (case sensitive)."),
                    orientation="horizontal",
                    default_value=["nr", "ns"],
                ),
            ),
            (
                "numerical_sensor_levels",
                ListOf(
                    Tuple(elements=[
                        TextInput(
                            title=_("Sensor name"),
                            help=
                            _("Enter the name of the sensor. In single mode, this can be read off "
                              "from the service descriptions of the services 'IPMI Sensor ...'."
                              ),
                        ),
                        Dictionary(elements=[
                            (
                                "lower",
                                Tuple(
                                    title=_("Lower levels"),
                                    elements=[
                                        Float(label=_("Warning at")),
                                        Float(label=_("Critical at")),
                                    ],
                                ),
                            ),
                            (
                                "upper",
                                Tuple(
                                    title=_("Upper levels"),
                                    elements=[
                                        Float(label=_("Warning at")),
                                        Float(label=_("Critical at")),
                                    ],
                                ),
                            ),
                        ], ),
                    ], ),
                    title=_(
                        "Set lower and upper levels for numerical sensors"),
                ),
            ),
        ],
        ignored_keys=["ignored_sensors", "ignored_sensor_states"],
    )
Beispiel #21
0
def _parameter_valuespec_postgres_stat_database():
    return Dictionary(
        help=
        _("This check monitors how often database objects in a PostgreSQL Database are accessed"
          ),
        elements=[
            (
                "blocks_read",
                Tuple(
                    title=_("Blocks read"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("blocks/s")),
                        Float(title=_("Critical at"), unit=_("blocks/s")),
                    ],
                ),
            ),
            (
                "xact_commit",
                Tuple(
                    title=_("Commits"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_fetched",
                Tuple(
                    title=_("Fetches"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_deleted",
                Tuple(
                    title=_("Deletes"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_updated",
                Tuple(
                    title=_("Updates"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_inserted",
                Tuple(
                    title=_("Inserts"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
        ],
    )
Beispiel #22
0
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ('cloudwatch_alarms', _vs_limits("Cloudwatch Alarms", 5000)),
     ])
Beispiel #23
0
)
from cmk.gui.plugins.wato.check_parameters.mailqueue_length import mailqueue_elements
from cmk.gui.valuespec import Dictionary, Integer, TextInput, Transform, Tuple

mailqueue_params = Dictionary(
    elements=[
        *mailqueue_elements,
        (
            "failed",
            Tuple(
                title=_("Mails in failed mail queue"),
                help=_(
                    "This rule is applied to the number of E-Mails currently "
                    "in the failed mail queue"),
                elements=[
                    Integer(title=_("Warning at"),
                            unit=_("mails"),
                            default_value=1),
                    Integer(title=_("Critical at"),
                            unit=_("mails"),
                            default_value=1),
                ],
            ),
        ),
    ],
    optional_keys=["active", "deferred", "failed"],
)


def _parameter_valuespec_mail_queue_length():
    return Transform(
Beispiel #24
0
 def parameter_valuespec(self):
     return Dictionary(elements=[_vs_s3_buckets()])
Beispiel #25
0
def _parameter_valuespec_mssql_instance():
    return Dictionary(elements=[("map_connection_state",
                                 MonitoringState(title=_("Connection status"),
                                                 default_value=2))], )
Beispiel #26
0
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ('get_requests_perc',
          Alternative(title=_("Upper percentual levels for GET requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('put_requests_perc',
          Alternative(title=_("Upper percentual levels for PUT requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('delete_requests_perc',
          Alternative(title=_(
              "Upper percentual levels for DELETE requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('head_requests_perc',
          Alternative(title=_("Upper percentual levels for HEAD requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('post_requests_perc',
          Alternative(title=_("Upper percentual levels for POST requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('select_requests_perc',
          Alternative(title=_(
              "Upper percentual levels for SELECT requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
         ('list_requests_perc',
          Alternative(title=_("Upper percentual levels for LIST requests"),
                      style="dropdown",
                      elements=[
                          Tuple(title=_("Set levels"),
                                elements=[
                                    Percentage(title=_("Warning at")),
                                    Percentage(title=_("Critical at")),
                                ]),
                          Tuple(title=_("No levels"),
                                elements=[
                                    FixedValue(None, totext=""),
                                    FixedValue(None, totext=""),
                                ]),
                      ])),
     ])
Beispiel #27
0
def _parameter_valuespec_redis_info_clients():
    return Dictionary(elements=[
        ("connected_lower",
         Tuple(
             title=_("Total number of client connections lower level"),
             elements=[
                 Integer(
                     title=_("Warning below"),
                     unit="connections",
                 ),
                 Integer(
                     title=_("Critical below"),
                     unit="connections",
                 ),
             ],
         )),
        ("connected_upper",
         Tuple(
             title=_("Total number of client connections upper level"),
             elements=[
                 Integer(
                     title=_("Warning at"),
                     unit="connections",
                 ),
                 Integer(
                     title=_("Critical at"),
                     unit="connections",
                 ),
             ],
         )),
        ("output_lower",
         Tuple(
             title=_("Longest output list lower level"),
             elements=[
                 Integer(title=_("Warning below")),
                 Integer(title=_("Critical below")),
             ],
         )),
        ("output_upper",
         Tuple(
             title=_("Longest output list upper level"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("input_lower",
         Tuple(
             title=_("Biggest input buffer lower level"),
             elements=[
                 Integer(title=_("Warning below"), unit="issues"),
                 Integer(title=_("Critical below"), unit="íssues"),
             ],
         )),
        ("input_upper",
         Tuple(
             title=_("Biggest input buffer upper level"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("blocked_lower",
         Tuple(
             title=
             _("Total number of clients pending on a blocking call lower level"
               ),
             elements=[
                 Integer(
                     title=_("Warning below"),
                     unit="clients",
                 ),
                 Integer(
                     title=_("Critical below"),
                     unit="clients",
                 ),
             ],
         )),
        ("blocked_upper",
         Tuple(
             title=
             _("Total number of clients pending on a blocking call upper level"
               ),
             elements=[
                 Integer(
                     title=_("Warning at"),
                     unit="clients",
                 ),
                 Integer(
                     title=_("Critical at"),
                     unit="clients",
                 ),
             ],
         )),
    ], )
Beispiel #28
0
 def parameter_valuespec(self):
     return Dictionary(elements=[('buckets', _vs_limits("Buckets", 100))])
Beispiel #29
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,
    )
Beispiel #30
0
def _parameter_valuespec_sshd_config():
    return Dictionary(elements=[
        (
            "PermitRootLogin",
            Transform(
                DropdownChoice(
                    title=_("Permit root login"),
                    choices=[
                        ("yes", _("yes")),
                        ("key-based",
                         _("without-password/prohibit-password (Key based)")),
                        ("forced-commands-only", _("forced-commands-only")),
                        ("no", _("no")),
                    ],
                    default_value="key-based",
                ),
                forth=transform_ssh_config,
            ),
        ),
        (
            "Protocol",
            DropdownChoice(
                title=_("Allowed protocols"),
                choices=[
                    ("1", _("Version 1")),
                    ("2", _("Version 2")),
                    ("1,2", _("Version 1 and 2")),
                ],
                default_value="2",
            ),
        ),
        ("Port",
         ListOfNetworkPorts(title=_("Allowed Ports"), default_value=[22])),
        (
            "PasswordAuthentication",
            DropdownChoice(
                title=_("Allow password authentication"),
                help=_("Specifies whether password authentication is allowed"),
                choices=[
                    ("yes", _("Yes")),
                    ("no", _("No")),
                ],
                default_value="no",
            ),
        ),
        (
            "PermitEmptyPasswords",
            DropdownChoice(
                title=_("Permit empty passwords"),
                help=_("If password authentication is used this option "
                       "specifies wheter the server allows login to accounts "
                       "with empty passwords"),
                choices=[
                    ("yes", _("Yes")),
                    ("no", _("No")),
                ],
                default_value="no",
            ),
        ),
        (
            "ChallengeResponseAuthentication",
            DropdownChoice(
                title=_("Allow challenge-response authentication"),
                choices=[
                    ("yes", _("Yes")),
                    ("no", _("No")),
                ],
                default_value="no",
            ),
        ),
        (
            "X11Forwarding",
            DropdownChoice(
                title=_("Permit X11 forwarding"),
                choices=[
                    ("yes", _("Yes")),
                    ("no", _("No")),
                ],
                default_value="no",
            ),
        ),
        (
            "UsePAM",
            DropdownChoice(
                title=_("Use pluggable authentication module"),
                choices=[
                    ("yes", _("Yes")),
                    ("no", _("No")),
                ],
                default_value="no",
            ),
        ),
        (
            "Ciphers",
            ListOfStrings(
                title=_("Allowed Ciphers"),
                orientation="horizontal",
            ),
        ),
    ], )