Esempio n. 1
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[
             ("sensor_states",
              ListOf(
                  Tuple(elements=[TextAscii(),
                                  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)."),
                  orientation="horizontal",
              )),
             ("ignored_sensors",
              ListOfStrings(
                  title=_("Ignore the following IPMI sensors"),
                  help=
                  _("Names of IPMI sensors that should be ignored during discovery "
                    "and 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"),
                  help=
                  _("IPMI sensors with these states that should be ignored during discovery "
                    "and when summarizing."
                    "The pattern specified here must match exactly the beginning of "
                    "the actual sensor name (case sensitive)."),
                  orientation="horizontal",
                  default_value=["nr", "ns"],
              )),
             ("numerical_sensor_levels",
              ListOf(Tuple(elements=[
                  TextAscii(
                      title=_("Sensor name (only summary)"),
                      help=
                      _("In summary mode you have to state the sensor name. "
                        "In single mode the sensor name comes from service description."
                        )),
                  Dictionary(elements=[
                      ("lower",
                       Tuple(
                           title=_("Lower levels"),
                           elements=[Float(), Float()],
                       )),
                      ("upper",
                       Tuple(
                           title=_("Upper levels"),
                           elements=[Float(), Float()],
                       )),
                  ], ),
              ], ),
                     title=_(
                         "Set lower and upper levels for numerical sensors")
                     )),
         ],
         ignored_keys=["ignored_sensors", "ignored_sensor_states"],
     )
Esempio n. 2
0
def _valuespec_inventory_ipmi_rules():
    return Transform(
        CascadingDropdown(
            title=_("Discovery of IPMI sensors"),
            orientation="vertical",
            choices=
            [("summarize", _("Summary")),
             ("single", _("Single"),
              Dictionary(elements=[
                  ("ignored_sensors",
                   ListOfStrings(
                       title=_("Ignore the following IPMI sensors"),
                       help=
                       _("Names of IPMI sensors that should be ignored during discovery."
                         "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"),
                       help=
                       _("IPMI sensors with these states that should be ignored during discovery."
                         "The pattern specified here must match exactly the beginning of "
                         "the actual sensor state (case sensitive)."),
                       orientation="horizontal",
                   )),
              ]))]),
        forth=transform_ipmi_inventory_rules,
    )
Esempio n. 3
0
def _valuespec_inv_parameters_lnx_sysctl():
    return Dictionary(
        title=_("Inventory of Linux kernel configuration (sysctl)"),
        help=
        _("This rule allows for defining regex-patterns for in- and excluding kernel "
          "configuration parameters in the inventory. By default, no parameters are included. "
          "Note that some kernel configuration parameters change frequently. Inventorizing "
          "one of these parameters will lead to frequent changes in the HW/SW inventory, "
          "which can quickly fill up the temporary file system."),
        elements=[
            (
                "include_patterns",
                ListOfStrings(
                    valuespec=RegExp(RegExp.prefix),
                    title=_("Inclusion patterns"),
                    help=_(
                        "Define patterns for including kernel configuration parameters in the "
                        "inventory."),
                ),
            ),
            (
                "exclude_patterns",
                ListOfStrings(
                    valuespec=RegExp(RegExp.prefix),
                    title=_("Exclusion patterns"),
                    help=_(
                        "Define patterns for excluding kernel configuration parameters from the "
                        "inventory."),
                ),
            ),
        ],
        optional_keys=False,
    )
Esempio n. 4
0
def _valuespec_inventory_ipmi_rules_single() -> Dictionary:
    return Dictionary(elements=[
        (
            "ignored_sensors",
            ListOfStrings(
                title=_("Ignore the following IPMI sensors"),
                help=
                _("Names of IPMI sensors that should be ignored during discovery. "
                  "The pattern specified here must match exactly the beginning of "
                  "the actual ensor name (case sensitive)."),
                orientation="horizontal",
            ),
        ),
        (
            "ignored_sensorstates",
            ListOfStrings(
                title=_("Ignore the following IPMI sensor states"),
                help=
                _("IPMI sensors with these states that should be gnored during discovery. "
                  "The pattern specified here must match exactly the beginning of the actual "
                  "sensor state (case sensitive)."),
                orientation="horizontal",
            ),
        ),
    ], )
Esempio n. 5
0
 def _vs_ip_range(self):
     return CascadingDropdown(choices=[
         ("ip_range", _("IP-Range"),
          Tuple(
              elements=[
                  IPv4Address(title=_("From:"),),
                  IPv4Address(title=_("To:"),),
              ],
              orientation="horizontal",
          )),
         ("ip_network", _("IP Network"),
          Tuple(
              elements=[
                  IPv4Address(title=_("Network address:"),),
                  Integer(
                      title=_("Netmask"),
                      minvalue=8,
                      maxvalue=30,
                  ),
              ],
              orientation="horizontal",
          )),
         ("ip_list", _("Explicit List of IP Addresses"),
          ListOfStrings(
              valuespec=IPv4Address(),
              orientation="horizontal",
          )),
         ("ip_regex_list", _("List of patterns to exclude"),
          ListOfStrings(
              valuespec=RegExp(mode=RegExp.prefix,),
              orientation="horizontal",
              help=_("A list of regular expressions which are matched against the found "
                     "IP addresses to exclude them. The matched addresses are excluded."),
          )),
     ])
Esempio n. 6
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"),
                 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.'
        ),
    )
Esempio n. 7
0
def _parameter_valuespec_fs_mount_options():
    expected = ListOfStrings(
        title=_("Expected mount options"),
        help=_(
            "Specify all expected mount options here. If the list of "
            "actually found options differs from this list, the check will go "
            "warning or critical. Just the option <tt>commit</tt> is being "
            "ignored since it is modified by the power saving algorithms."),
        valuespec=TextUnicode(),
    )
    ignore = ListOfStrings(
        title=_("Mount options to ignore"),
        help=_(
            "Specify all mount options that should be ignored when inspecting "
            "the list of actually found options. The options <tt>commit</tt>, "
            "<tt>localalloc</tt>, <tt>subvol</tt>, <tt>subvolid</tt> are "
            "ignored by default."),
        valuespec=TextUnicode(),
        default_value=["commit=", "localalloc=", "subvol=", "subvolid="],
    )

    # The old parameterset was just a list of strings. We moved that list into a
    # dictionary with the key 'expected'.
    return Transform(
        Dictionary(
            title=_("Mount options"),
            elements=[
                ('expected', expected),
                ('ignore', ignore),
            ],
        ),
        forth=lambda params: params
        if isinstance(params, dict) else {'expected': params},
    )
Esempio n. 8
0
 def _vs_ip_range(self, with_regexp=False):
     # NOTE: The `ip_regex_list` choice is only used in the `exclude_ranges` key.
     options = [
         (
             "ip_range",
             _("IP-Range"),
             Tuple(
                 elements=[
                     IPv4Address(title=_("From:"), ),
                     IPv4Address(title=_("To:"), ),
                 ],
                 orientation="horizontal",
             ),
         ),
         (
             "ip_network",
             _("IP Network"),
             Tuple(
                 elements=[
                     IPv4Address(title=_("Network address:"), ),
                     Integer(
                         title=_("Netmask"),
                         minvalue=8,
                         maxvalue=30,
                         default_value=24,
                     ),
                 ],
                 orientation="horizontal",
                 help=
                 _("Please avoid very large subnet sizes/ranges. A netmask value of /21 is "
                   "probably ok, while larger subnets (i.e. smaller netmask values) will lead "
                   "to excessive runtimes."),
             ),
         ),
         (
             "ip_list",
             _("Explicit List of IP Addresses"),
             ListOfStrings(
                 valuespec=IPv4Address(),
                 orientation="horizontal",
             ),
         ),
     ]
     regexp_exclude = (
         "ip_regex_list",
         _("List of patterns to exclude"),
         ListOfStrings(
             valuespec=RegExp(mode=RegExp.prefix, ),
             orientation="horizontal",
             help=
             _("A list of regular expressions which are matched against the found "
               "IP addresses to exclude them. The matched addresses are excluded."
               ),
         ),
     )
     if with_regexp:
         options.append(regexp_exclude)
     return CascadingDropdown(choices=options)
Esempio n. 9
0
def _valuespec_filesystem_groups():
    return Transform(
        ListOf(
            Dictionary(
                optional_keys=False,
                elements=[
                    ('group_name', TextInput(title=_("Group name"), )),
                    (
                        'patterns_include',
                        ListOfStrings(
                            title=_("Inclusion patterns"),
                            orientation='horizontal',
                            help=
                            _("You can specify one or several globbing patterns containing "
                              "<tt>*</tt>, <tt>?</tt> and <tt>[...]</tt>, for example "
                              "<tt>/spool/tmpspace*</tt>. The filesystems matching the "
                              "patterns will be grouped together and monitored as one big "
                              "filesystem in a single service. Note that specifically for "
                              "the check <tt>df</tt>, the pattern matches either the mount "
                              "point or the combination of volume and mount point, "
                              "depending on the configuration in "
                              "<a href='wato.py?mode=edit_ruleset&varname=inventory_df_rules'>"
                              "Filesystem discovery</a>.")),
                    ),
                    (
                        'patterns_exclude',
                        ListOfStrings(
                            title=_("Exclusion patterns"),
                            orientation='horizontal',
                            help=
                            _("You can specify one or several globbing patterns containing "
                              "<tt>*</tt>, <tt>?</tt> and <tt>[...]</tt>, for example "
                              "<tt>/spool/tmpspace*</tt>. The filesystems matching the "
                              "patterns will excluded from grouping and monitored "
                              "individually. Note that specifically for the check "
                              "<tt>df</tt>, the pattern matches either the mount point or "
                              "the combination of volume and mount point, depending on the "
                              "configuration in "
                              "<a href='wato.py?mode=edit_ruleset&varname=inventory_df_rules'>"
                              "Filesystem discovery</a>.")),
                    ),
                ],
            ),
            add_label=_("Add group"),
            title=_('Filesystem grouping patterns'),
            help=
            _('By default, the filesystem checks (<tt>df</tt>, <tt>hr_fs</tt> and others) will '
              'create a single service for each filesystem. By defining grouping patterns, you '
              'can handle groups of filesystems like one filesystem. For each group, you can '
              'define one or several include and exclude patterns. The filesystems matching one '
              'of the include patterns will be monitored like one big filesystem in a single '
              'service. The filesystems matching one of the exclude patterns will be excluded '
              'from the group and monitored individually.'),
        ),
        forth=_transform_filesystem_groups,
    )
Esempio n. 10
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(), Float()],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[Float(), Float()],
                      )),
                 ], ),
             ], ),
                    title=_(
                        "Set lower and upper levels for numerical sensors"))),
        ],
        ignored_keys=["ignored_sensors", "ignored_sensor_states"],
    )
Esempio n. 11
0
def _parameter_valuespec_services_summary():
    return Dictionary(
        title=_("Autostart Services"),
        elements=[
            (
                "ignored",
                ListOfStrings(
                    title=_("Ignored autostart services"),
                    help=
                    _("Regular expressions matching the begining of the internal name "
                      "or the description of the service. "
                      "If no name is given then this rule will match all services. The "
                      "match is done on the <i>beginning</i> of the service name. It "
                      "is done <i>case sensitive</i>. You can do a case insensitive match "
                      "by prefixing the regular expression with <tt>(?i)</tt>. Example: "
                      "<tt>(?i).*mssql</tt> matches all services which contain <tt>MSSQL</tt> "
                      "or <tt>MsSQL</tt> or <tt>mssql</tt> or..."),
                    orientation="horizontal",
                ),
            ),
            (
                "state_if_stopped",
                MonitoringState(
                    title=_(
                        "Default state if stopped autostart services are found"
                    ),
                    default_value=0,
                ),
            ),
        ],
    )
Esempio n. 12
0
def _vs_element_aws_service_selection():
    return (
        "selection",
        CascadingDropdown(
            title=_("Selection of service instances"),
            help=
            _("<i>Gather all service instances and restrict by overall tags</i> means that "
              "if overall tags are stated above then all service instances are filtered "
              "by these tags. Otherwise all instances are gathered.<br>"
              "With <i>Use explicit service tags and overwrite overall tags</i> you can "
              "specify explicit tags for these services. The overall tags are ignored for "
              "these services.<br>"
              "<i>Use explicit service names and ignore overall tags</i>: With this selection "
              "you can state explicit names. The overall tags are ignored for these service."
              ),
            choices=[
                ("all",
                 _("Gather all service instances and restrict by overall AWS tags"
                   )),
                (
                    "tags",
                    _("Use explicit AWS service tags and overrule overall AWS tags"
                      ),
                    _vs_aws_tags(_("AWS Tags")),
                ),
                (
                    "names",
                    _("Use explicit service names and ignore overall AWS tags"
                      ),
                    ListOfStrings(),
                ),
            ],
        ),
    )
Esempio n. 13
0
def _parameter_valuespec_solaris_services():
    return Dictionary(
        elements=[
            (
                "additional_servicenames",
                ListOfStrings(
                    title=_("Alternative names for the service"),
                    help=_(
                        "Here you can specify alternative names that the service might have. "
                        "This helps when the exact spelling of the services can changed from "
                        "one version to another."
                    ),
                ),
            ),
            (
                "states",
                ListOf(
                    Tuple(
                        orientation="horizontal",
                        elements=[
                            DropdownChoice(
                                title=_("Expected state"),
                                choices=[
                                    (None, _("Ignore the state")),
                                    ("online", _("Online")),
                                    ("disabled", _("Disabled")),
                                    ("maintenance", _("Maintenance")),
                                    ("legacy_run", _("Legacy run")),
                                ],
                            ),
                            DropdownChoice(
                                title=_("STIME"),
                                choices=[
                                    (None, _("Ignore")),
                                    (True, _("Has changed")),
                                    (False, _("Did not changed")),
                                ],
                            ),
                            MonitoringState(
                                title=_("Resulting state"),
                            ),
                        ],
                    ),
                    title=_("Services states"),
                    help=_(
                        "You can specify a separate monitoring state for each possible "
                        "combination of service state. If you do not use this parameter, "
                        "then only online/legacy_run will be assumed to be OK."
                    ),
                ),
            ),
            (
                "else",
                MonitoringState(
                    title=_("State if no entry matches"),
                    default_value=2,
                ),
            ),
        ],
    )
Esempio n. 14
0
def _parameter_valuespec_services():
    return Dictionary(elements=[
        ("additional_servicenames",
         ListOfStrings(
             title=_("Alternative names for the service"),
             help=
             _("Here you can specify alternative names that the service might have. "
               "This helps when the exact spelling of the services can changed from "
               "one version to another."),
         )),
        ("states",
         ListOf(
             Tuple(orientation="horizontal",
                   elements=[
                       DropdownChoice(
                           title=_("Expected state"),
                           default_value="running",
                           choices=[(None, _("ignore the state")),
                                    ("running", _("running")),
                                    ("stopped", _("stopped"))],
                       ),
                       DropdownChoice(
                           title=_("Start type"),
                           default_value="auto",
                           choices=[
                               (None, _("ignore the start type")),
                               ("demand",
                                _("demand")),
                               ("disabled",
                                _("disabled")),
                               ("auto", _("auto")),
                               ("unknown", _("unknown (old agent)")),
                           ],
                       ),
                       MonitoringState(title=_("Resulting state"), ),
                   ],
                   default_value=("running", "auto",
                                  0)),
             title=_("Services states"),
             help=
             _("You can specify a separate monitoring state for each possible "
               "combination of service state and start type. If you do not use "
               "this parameter, then only running/auto will be assumed to be OK."
               ),
         )),
        (
            "else",
            MonitoringState(
                title=_("State if no entry matches"),
                default_value=2,
            ),
        ),
        ('icon',
         UserIconOrAction(
             title=_("Add custom icon or action"),
             help=
             _("You can assign icons or actions to the found services in the status GUI."
               ),
         ))
    ], )
Esempio n. 15
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=[],
        )
Esempio n. 16
0
def _special_agents_azure_azure_explicit_config():
    return ListOf(
        valuespec=Dictionary(
            elements=[
                (
                    "group_name",
                    TextInput(
                        title=_("Name of the resource group"),
                        allow_empty=False,
                    ),
                ),
                (
                    "resources",
                    ListOfStrings(
                        title=_("Explicitly specify resources"),
                        allow_empty=False,
                    ),
                ),
            ],
            optional_keys=["resources"],
        ),
        title=_("explicitly specified groups"),
        allow_empty=False,
        add_label=_("Add resource group"),
    )
Esempio n. 17
0
 def _vs_inventory_paths(self):
     return CascadingDropdown(
         choices=[
             ("allow_all", _("Allowed to see the whole tree")),
             ("forbid_all", _("Forbid to see the whole tree")),
             ("paths", _("Allowed to see the following entries"),
              ListOf(
                  Dictionary(
                      elements=[("path",
                                 TextAscii(
                                     title=_("Path"),
                                     size=60,
                                     allow_empty=False,
                                 )),
                                ("attributes",
                                 ListOfStrings(
                                     orientation="horizontal",
                                     title=_("Attributes"),
                                     size=15,
                                     allow_empty=True,
                                 ))],
                      optional_keys=["attributes"],
                  ),
                  allow_empty=False,
              )),
         ],
         default_value="allow_all",
     )
Esempio n. 18
0
 def __init__(self, **kwargs):
     kwargs["elements"] = [
         ("port",
          Integer(
              title=_("TCP port"),
              minvalue=1,
              maxvalue=65535,
              default_value=kwargs.pop("tcp_port", 6557),
          )),
         ("only_from",
          ListOfStrings(
              title=_("Restrict access to IP addresses"),
              help=_("The access to Livestatus via TCP will only be allowed from the "
                     "configured source IP addresses. You can either configure specific "
                     "IP addresses or networks in the syntax <tt>10.3.3.0/24</tt>."),
              valuespec=IPNetwork(),
              orientation="horizontal",
              allow_empty=False,
              default_value=["0.0.0.0", "::/0"],
          )),
         ("tls",
          FixedValue(
              True,
              title=_("Encrypt communication"),
              totext=_("Encrypt TCP Livestatus connections"),
              help=_("Since Check_MK 1.6 it is possible to encrypt the TCP Livestatus "
                     "connections using SSL. This is enabled by default for sites that "
                     "enable Livestatus via TCP with 1.6 or newer. Sites that already "
                     "have this option enabled keep the communication unencrypted for "
                     "compatibility reasons. However, it is highly recommended to "
                     "migrate to an encrypted communication."),
          )),
     ]
     kwargs["optional_keys"] = ["only_from", "tls"]
     super(LivestatusViaTCP, self).__init__(**kwargs)
Esempio n. 19
0
def _parameter_valuespec_datadog_monitors() -> Dictionary:
    return Dictionary([
        (
            "state_mapping",
            Dictionary(
                [(
                    datadog_state,
                    MonitoringState(
                        title=datadog_state,
                        default_value=checkmk_state,
                    ),
                ) for datadog_state, checkmk_state in
                 _DEFAULT_DATADOG_AND_CHECKMK_STATES],
                title=_("Map monitor states to Checkmk monitoring states"),
                optional_keys=False,
            ),
        ),
        (
            "tags_to_show",
            ListOfStrings(
                valuespec=RegExp(
                    RegExp.prefix,
                    size=30,
                    allow_empty=False,
                ),
                title=_("Datadog tags shown in service output"),
                help=
                _("This option allows you to configure which Datadog tags will be shown in "
                  "the service output. This is done by entering regular expressions matching "
                  "one or more Datadog tags. Any matching tag will be displayed in the "
                  "service output."),
            ),
        ),
    ], )
Esempio n. 20
0
 def parameter_valuespec(self):
     return Dictionary(
         title=_('Autostart Services'),
         elements=[
             ('ignored',
              ListOfStrings(
                  title=_("Ignored autostart services"),
                  help=
                  _('Regular expressions matching the begining of the internal name '
                    'or the description of the service. '
                    'If no name is given then this rule will match all services. The '
                    'match is done on the <i>beginning</i> of the service name. It '
                    'is done <i>case sensitive</i>. You can do a case insensitive match '
                    'by prefixing the regular expression with <tt>(?i)</tt>. Example: '
                    '<tt>(?i).*mssql</tt> matches all services which contain <tt>MSSQL</tt> '
                    'or <tt>MsSQL</tt> or <tt>mssql</tt> or...'),
                  orientation="horizontal",
              )),
             ('state_if_stopped',
              MonitoringState(
                  title=_(
                      "Default state if stopped autostart services are found"
                  ),
                  default_value=0,
              )),
         ],
     )
def _parameter_valuespec_esx_vsphere_objects_count():
    return Dictionary(
        optional_keys=False,
        elements=[
            (
                "distribution",
                ListOf(
                    valuespec=Dictionary(
                        optional_keys=False,
                        elements=[
                            ("vm_names", ListOfStrings(title=_("VMs"))),
                            ("hosts_count",
                             Integer(title=_("Number of hosts"),
                                     default_value=2)),
                            (
                                "state",
                                MonitoringState(title=_("State if violated"),
                                                default_value=1),
                            ),
                        ],
                    ),
                    title=_("VM distribution"),
                    help=
                    _("You can specify lists of VM names and a number of hosts,"
                      " to make sure the specfied VMs are distributed across at least so many hosts."
                      " E.g. provide two VM names and set 'Number of hosts' to two,"
                      " to make sure those VMs are not running on the same host."
                      ),
                ),
            ),
        ],
    )
def _valuespec_inventory_win_scheduled_task_rules():
    return Dictionary(
        title=_('Windows Scheduled Task Discovery'),
        elements=[
            (
                'groupname',
                TextAscii(
                    title=_('Name of group'),
                    help=_('Group the matching scheduled tasks.'),
                    size=10,
                ),
            ),
            ('tasks',
             ListOfStrings(
                 title=_('Scheduled Tasks (Regular Expressions)'),
                 help=
                 _('Regular expressions matching the begining of the path and name of the scheduled task. '
                   'The match is done on the <i>beginning</i> of the service name.'
                   'It is done <i>case sensitive</i>. You can do a case insensitive match '
                   'by prefixing the regular expression with <tt>(?i)</tt>.'),
                 orientation='horizontal',
             )),
        ],
        help=
        _('This rule can be used to configure the discovery of the windows scheduled task check. '
          'You can configure specific scheduled task to be monitored by the windows check by '
          'selecting them by name, current state during the inventory, or start mode.'
          ),
    )
Esempio n. 23
0
def _valuespec_special_agents_smb_share():
    return Dictionary(
        elements=[
            (
                "hostname",
                TextInput(
                    title="Hostname",
                    allow_empty=False,
                    help=
                    _("<p>Usually Checkmk will use the hostname of the host it is attached to. "
                      "With this option you can override this parameter.</p>"),
                ),
            ),
            (
                "ip_address",
                HostAddress(
                    title=_("IP address"),
                    allow_empty=False,
                    allow_ipv6_address=False,
                    help=
                    _("<p>Usually Checkmk will use the primary IP address of the host it is "
                      "attached to. With this option you can override this parameter.</p>"
                      ),
                ),
            ),
            (
                "authentication",
                Tuple(
                    title=_("Authentication"),
                    elements=[
                        TextInput(title=_("Username"), allow_empty=False),
                        IndividualOrStoredPassword(title=_("Password"),
                                                   allow_empty=False),
                    ],
                ),
            ),
            (
                "patterns",
                ListOfStrings(
                    title=_("File patterns"),
                    size=80,
                    help=
                    _("<p>Here you can specify a list of filename patterns to be sent by the "
                      "agent in the section <tt>fileinfo</tt>. UNC paths with globbing patterns "
                      "are used here, e.g. <tt>\\\\hostname\\share name\\*\\foo\\*.log</tt>. "
                      "Wildcards are not allowed in host or share names. "
                      "Per default each found file will be monitored for size and age. "
                      "By building groups you can alternatively monitor a collection "
                      "of files as an entity and monitor the count, total size, the largest, "
                      "smallest oldest or newest file. Note: if you specify more than one matching rule, then "
                      "<b>all</b> matching rules will be used for defining pattern - not just the "
                      " first one.</p>"),
                    valuespec=TextInput(size=80),
                ),
            ),
        ],
        optional_keys=["hostname", "ip_address", "authentication"],
        title=_("SMB Share fileinfo"),
    )
Esempio n. 24
0
 def _vs_cluster_nodes(self):
     return ListOfStrings(
         title=_("Nodes"),
         valuespec=ConfigHostname(),
         orientation="horizontal",
         help=_(
             'Enter the host names of the cluster nodes. These hosts must be present in WATO.'),
     )
Esempio n. 25
0
def _valuespec_special_agents_mobileiron():
    return Dictionary(
        elements=[
            ("username", TextInput(title=_("Username"), allow_empty=False)),
            ("password",
             IndividualOrStoredPassword(title=_("Password"),
                                        allow_empty=False)),
            (
                "port",
                NetworkPort(
                    title=_("Port"),
                    default_value=443,
                    help=_("The port that is used for the API call."),
                ),
            ),
            (
                "no-cert-check",
                FixedValue(
                    True,
                    title=_("Disable SSL certificate validation"),
                    totext=_("SSL certificate validation is disabled"),
                ),
            ),
            (
                "partition",
                ListOfStrings(
                    allow_empty=False,
                    title=_(
                        "Retrieve information about the following partitions"),
                ),
            ),
            (
                "proxy_details",
                Dictionary(
                    title=_("Use proxy for MobileIron API connection"),
                    elements=[
                        ("proxy_host",
                         TextInput(title=_("Proxy host"), allow_empty=True)),
                        ("proxy_port", Integer(title=_("Port"))),
                        (
                            "proxy_user",
                            TextInput(
                                title=_("Username"),
                                size=32,
                            ),
                        ),
                        ("proxy_password",
                         IndividualOrStoredPassword(title=_("Password"))),
                    ],
                    optional_keys=[
                        "proxy_port", "proxy_user", "proxy_password"
                    ],
                ),
            ),
        ],
        optional_keys=["no-cert-check"],
        title=_("MobileIron API"),
    )
def _parameter_valuespec_cohesity_node_status():
    return Dictionary(elements=[
        ('services',
         ListOfStrings(
             title=_("Services to ignore"),
             help=_("Specify all services to ignore"),
             valuespec=TextUnicode(),
         )),
    ], )
Esempio n. 27
0
def _valuespec_special_agents_3par():
    return Transform(
        valuespec=Dictionary(
            title=_("3PAR Configuration"),
            elements=[
                (
                    "user",
                    TextInput(
                        title=_("Username"),
                        allow_empty=False,
                    ),
                ),
                (
                    "password",
                    IndividualOrStoredPassword(
                        title=_("Password"),
                        allow_empty=False,
                    ),
                ),
                (
                    "port",
                    Integer(
                        title=_("TCP port number"),
                        help=_("Port number that 3par is listening on. The default is 8080."),
                        default_value=8080,
                        minvalue=1,
                        maxvalue=65535,
                    ),
                ),
                (
                    "verify_cert",
                    DropdownChoice(
                        title=_("SSL certificate verification"),
                        choices=[
                            (True, _("Activate")),
                            (False, _("Deactivate")),
                        ],
                    ),
                ),
                (
                    "values",
                    ListOfStrings(
                        title=_("Values to fetch"),
                        orientation="horizontal",
                        help=_(
                            "Possible values are the following: cpgs, volumes, hosts, capacity, "
                            "system, ports, remotecopy, hostsets, volumesets, vluns, flashcache, "
                            "users, roles, qos.\n"
                            "If you do not specify any value the first seven are used as default."
                        ),
                    ),
                ),
            ],
            optional_keys=["values"],
        ),
        forth=_special_agents_3par_transform,
    )
Esempio n. 28
0
def _parameter_valuespec_fs_mount_options():
    return ListOfStrings(
        title=_("Expected mount options"),
        help=_(
            "Specify all expected mount options here. If the list of "
            "actually found options differs from this list, the check will go "
            "warning or critical. Just the option <tt>commit</tt> is being "
            "ignored since it is modified by the power saving algorithms."),
        valuespec=TextUnicode(),
    )
Esempio n. 29
0
def _vs_regex_matching(match_obj):
    return ListOfStrings(
        title=_("Match interface %s (regex)" % match_obj),
        help=_("Apply this rule only to interfaces whose %s matches one of the configured regular "
               "expressions. The match is done on the beginning of the %s." %
               (match_obj, match_obj)),
        orientation="horizontal",
        valuespec=RegExp(
            size=32,
            mode=RegExp.prefix,
        ),
    )
def _valuespec_discovery_windows_tasks_rules():
    return Dictionary(
        title=_("Windows tasks states to ignore for discovery"),
        elements=[
            ("state",
             ListOfStrings(
                 title=_("ignored State"),
                 help=_("State name to ignore at discovery time."),
                 default_value=['Disabled', 'Deaktiviert'],
             )),
        ],
    )