Exemplo n.º 1
0
def vs_bulk_discovery(render_form=False, include_subfolders=True):
    if render_form:
        render = "form"
    else:
        render = None

    if include_subfolders:
        selection_elements = [
            Checkbox(label=_("Include all subfolders"), default_value=True)
        ]
    else:
        selection_elements = []

    selection_elements += [
        Checkbox(
            label=_("Only include hosts that failed on previous discovery"),
            default_value=False),
        Checkbox(label=_("Only include hosts with a failed discovery check"),
                 default_value=False),
        Checkbox(label=_("Exclude hosts where the agent is unreachable"),
                 default_value=False),
    ]

    return Dictionary(
        title=_("Bulk discovery"),
        render=render,
        elements=[
            ("mode",
             RadioChoice(
                 title=_("Mode"),
                 orientation="vertical",
                 default_value="new",
                 choices=[
                     ("new", _("Add unmonitored services")),
                     ("remove", _("Remove vanished services")),
                     ("fixall",
                      _("Add unmonitored & remove vanished services")),
                     ("refresh", _("Refresh all services (tabula rasa)")),
                 ],
             )),
            ("selection",
             Tuple(title=_("Selection"), elements=selection_elements)),
            ("performance",
             Tuple(title=_("Performance options"),
                   elements=[
                       Checkbox(label=_("Use cached data if present"),
                                default_value=True),
                       Checkbox(label=_("Do full SNMP scan for SNMP devices"),
                                default_value=True),
                       Integer(label=_("Number of hosts to handle at once"),
                               default_value=10),
                   ])),
            ("error_handling",
             Checkbox(title=_("Error handling"),
                      label=_("Ignore errors in single check plugins"),
                      default_value=True)),
        ],
        optional_keys=[],
    )
Exemplo n.º 2
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",
             TextAscii(
                 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",
             RadioChoice(
                 title=_('Show "Failed Actions"'),
                 orientation='vertical',
                 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)
Exemplo n.º 3
0
Arquivo: if.py Projeto: m4c3/checkMK
 def parameter_valuespec(self):
     # Transform old traffic related levels which used "traffic" and "traffic_minimum"
     # keys where each was configured with an Alternative valuespec
     return Transform(
         Dictionary(
             ignored_keys=[
                 "aggregate"
             ],  # Created by discovery when using interface grouping
             elements=[
                 ("errors",
                  Alternative(
                      title=_("Levels for error rates"),
                      help=
                      _("These levels make the check go warning or critical whenever the "
                        "<b>percentual error rate</b> or the <b>absolute error rate</b> of the monitored interface reaches "
                        "the given bounds. The percentual error rate is computed by dividing number of "
                        "errors by the total number of packets (successful plus errors)."
                        ),
                      elements=[
                          Tuple(
                              title=_("Percentual levels for error rates"),
                              elements=[
                                  Percentage(title=_("Warning at"),
                                             unit=_("percent errors"),
                                             default_value=0.01,
                                             display_format='%.3f'),
                                  Percentage(title=_("Critical at"),
                                             unit=_("percent errors"),
                                             default_value=0.1,
                                             display_format='%.3f')
                              ]),
                          Tuple(title=_("Absolute levels for error rates"),
                                elements=[
                                    Integer(title=_("Warning at"),
                                            unit=_("errors")),
                                    Integer(title=_("Critical at"),
                                            unit=_("errors"))
                                ])
                      ])),
                 ("speed",
                  OptionalDropdownChoice(
                      title=_("Operating speed"),
                      help=
                      _("If you use this parameter then the check goes warning if the "
                        "interface is not operating at the expected speed (e.g. it "
                        "is working with 100Mbit/s instead of 1Gbit/s.<b>Note:</b> "
                        "some interfaces do not provide speed information. In such cases "
                        "this setting is used as the assumed speed when it comes to "
                        "traffic monitoring (see below)."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second")))),
                 ("state",
                  Optional(
                      ListChoice(title=_("Allowed states:"),
                                 choices=defines.interface_oper_states()),
                      title=_("Operational state"),
                      help=
                      _("If you activate the monitoring of the operational state (<tt>ifOperStatus</tt>) "
                        "the check will get warning or critical if the current state "
                        "of the interface does not match one of the expected states. Note: the status 9 (<i>admin down</i>) "
                        "is only visible if you activate this status during switch port inventory or if you manually "
                        "use the check plugin <tt>if64adm</tt> instead of <tt>if64</tt>."
                        ),
                      label=_("Ignore the operational state"),
                      none_label=_("ignore"),
                      negate=True)),
                 ("map_operstates",
                  ListOf(
                      Tuple(
                          orientation="horizontal",
                          elements=[
                              DropdownChoice(
                                  choices=defines.interface_oper_states()),
                              MonitoringState()
                          ]),
                      title=_('Map operational states'),
                  )),
                 ("assumed_speed_in",
                  OptionalDropdownChoice(
                      title=_("Assumed input speed"),
                      help=
                      _("If the automatic detection of the link speed does not work "
                        "or the switch's capabilities are throttled because of the network setup "
                        "you can set the assumed speed here."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      default_value=16000000,
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second"),
                          size=10))),
                 ("assumed_speed_out",
                  OptionalDropdownChoice(
                      title=_("Assumed output speed"),
                      help=
                      _("If the automatic detection of the link speed does not work "
                        "or the switch's capabilities are throttled because of the network setup "
                        "you can set the assumed speed here."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      default_value=1500000,
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second"),
                          size=12))),
                 ("unit",
                  RadioChoice(
                      title=_("Measurement unit"),
                      help=
                      _("Here you can specifiy the measurement unit of the network interface"
                        ),
                      default_value="byte",
                      choices=[
                          ("bit", _("Bits")),
                          ("byte", _("Bytes")),
                      ],
                  )),
                 ("infotext_format",
                  DropdownChoice(
                      title=_("Change infotext in check output"),
                      help=
                      _("This setting allows you to modify the information text which is displayed between "
                        "the two brackets in the check output. Please note that this setting does not work for "
                        "grouped interfaces, since the additional information of grouped interfaces is different"
                        ),
                      choices=[
                          ("alias", _("Show alias")),
                          ("description", _("Show description")),
                          ("alias_and_description",
                           _("Show alias and description")),
                          ("alias_or_description",
                           _("Show alias if set, else description")),
                          ("desription_or_alias",
                           _("Show description if set, else alias")),
                          ("hide", _("Hide infotext")),
                      ])),
                 ("traffic",
                  ListOf(
                      CascadingDropdown(title=_("Direction"),
                                        orientation="horizontal",
                                        choices=[
                                            ('both', _("In / Out"),
                                             vs_interface_traffic()),
                                            ('in', _("In"),
                                             vs_interface_traffic()),
                                            ('out', _("Out"),
                                             vs_interface_traffic()),
                                        ]),
                      title=_(
                          "Used bandwidth (minimum or maximum traffic)"),
                      help=
                      _("Setting levels on the used bandwidth is optional. If you do set "
                        "levels you might also consider using averaging."),
                  )),
                 (
                     "nucasts",
                     Tuple(
                         title=_("Non-unicast packet rates"),
                         help=
                         _("Setting levels on non-unicast packet rates is optional. This may help "
                           "to detect broadcast storms and other unwanted traffic."
                           ),
                         elements=[
                             Integer(title=_("Warning at"),
                                     unit=_("pkts / sec")),
                             Integer(title=_("Critical at"),
                                     unit=_("pkts / sec")),
                         ]),
                 ),
                 ("discards",
                  Tuple(title=_("Absolute levels for discards rates"),
                        elements=[
                            Integer(title=_("Warning at"),
                                    unit=_("discards")),
                            Integer(title=_("Critical at"),
                                    unit=_("discards"))
                        ])),
                 ("average",
                  Integer(
                      title=_("Average values"),
                      help=
                      _("By activating the computation of averages, the levels on "
                        "errors and traffic are applied to the averaged value. That "
                        "way you can make the check react only on long-time changes, "
                        "not on one-minute events."),
                      unit=_("minutes"),
                      minvalue=1,
                      default_value=15,
                  )),
             ],
         ),
         forth=transform_if,
     )
Exemplo n.º 4
0
def process_level_elements():
    return [
        ("cpu_rescale_max",
         RadioChoice(
             title=_("CPU rescale maximum load"),
             help=_(
                 "CPU utilization is delivered by the Operating "
                 "System as a per CPU core basis. Thus each core contributes "
                 "with a 100% at full utilization, producing a maximum load "
                 "of N*100% (N=number of cores). For simplicity this maximum "
                 "can be rescaled down, making 100% the maximum and thinking "
                 "in terms of total CPU utilization."),
             default_value=True,
             orientation="vertical",
             choices=[
                 (True, _("100% is all cores at full load")),
                 (False,
                  HTML(
                      _("<b>N</b> * 100% as each core contributes with 100% at full load"
                        ))),
             ],
             invalid_choice_title=_("Unspecified.") + " " +
             _("Starting from version 1.6.0 this value must be configured. "
               "Read Werk #6646 for further information."),
             invalid_choice_error=_("CPU rescale maximum load is Unspecified.")
             + " " +
             _("Starting from version 1.6.0 this value must be configured. "
               "Read Werk #6646 for further information."),
         )),
        ('levels',
         Tuple(
             title=_('Levels for process count'),
             help=_(
                 "Please note that if you specify and also if you modify levels "
                 "here, the change is activated only during an inventory."
                 "Saving this rule is not enough. This is due to the nature of"
                 "inventory rules."),
             elements=[
                 Integer(
                     title=_("Critical below"),
                     unit=_("processes"),
                     default_value=1,
                 ),
                 Integer(
                     title=_("Warning below"),
                     unit=_("processes"),
                     default_value=1,
                 ),
                 Integer(
                     title=_("Warning above"),
                     unit=_("processes"),
                     default_value=99999,
                 ),
                 Integer(
                     title=_("Critical above"),
                     unit=_("processes"),
                     default_value=99999,
                 ),
             ],
         )),
        ("cpulevels",
         Tuple(
             title=_("Levels on total CPU utilization"),
             help=_(
                 "By activating this options you can set levels on the total "
                 "CPU utilization of all included processes."),
             elements=[
                 Percentage(title=_("Warning at"),
                            default_value=90,
                            maxvalue=10000),
                 Percentage(title=_("Critical at"),
                            default_value=98,
                            maxvalue=10000),
             ],
         )),
        ("cpu_average",
         Integer(
             title=_("CPU Averaging"),
             help=
             _("By activating averaging, Check_MK will compute the average of "
               "the total CPU utilization over a given interval. If you have defined "
               "alerting levels then these will automatically be applied on the "
               "averaged value. This helps to mask out short peaks. "),
             unit=_("minutes"),
             minvalue=1,
             default_value=15,
         )),
        ("single_cpulevels",
         Tuple(
             title=_("Levels on CPU utilization of a single process"),
             help=_(
                 "Here you can define levels on the CPU utilization of single "
                 "processes. For performance reasons CPU Averaging will not be "
                 "applied to to the levels of single processes."),
             elements=[
                 Percentage(title=_("Warning at"),
                            default_value=90,
                            maxvalue=10000),
                 Percentage(title=_("Critical at"),
                            default_value=98,
                            maxvalue=10000),
             ],
         )),
        ("max_age",
         Tuple(
             title=_("Maximum allowed age"),
             help=_(
                 "Alarms you if the age of the process (not the consumed CPU "
                 "time, but the real time) exceed the configured levels."),
             elements=[
                 Age(title=_("Warning at"), default_value=3600),
                 Age(title=_("Critical at"), default_value=7200),
             ])),
        ("virtual_levels",
         Tuple(
             title=_("Virtual memory usage"),
             elements=[
                 Filesize(title=_("Warning at"),
                          default_value=1000 * 1024 * 1024 * 1024),
                 Filesize(title=_("Critical at"),
                          default_value=2000 * 1024 * 1024 * 1024),
             ],
         )),
        ("resident_levels",
         Tuple(
             title=_("Physical memory usage"),
             elements=[
                 Filesize(title=_("Warning at"),
                          default_value=100 * 1024 * 1024),
                 Filesize(title=_("Critical at"),
                          default_value=200 * 1024 * 1024),
             ],
         )),
        ("resident_levels_perc",
         Tuple(title=_("Physical memory usage, in percentage of total RAM"),
               elements=[
                   Percentage(title=_("Warning at"), default_value=25.0),
                   Percentage(title=_("Critical at"), default_value=50.0),
               ])),
        ("handle_count",
         Tuple(
             title=_('Handle Count (Windows only)'),
             help=
             _("The number of object handles in the processes object table. This includes "
               "open handles to threads, files and other resources like registry keys."
               ),
             elements=[
                 Integer(
                     title=_("Warning above"),
                     unit=_("handles"),
                 ),
                 Integer(
                     title=_("Critical above"),
                     unit=_("handles"),
                 ),
             ],
         )),
        ('process_info',
         DropdownChoice(
             title=_("Enable per-process details in long-output"),
             label=_("Enable per-process details"),
             help=
             _("If active, the long output of this service will contain a list of all the "
               "matching processes and their details (i.e. PID, CPU usage, memory usage). "
               "Please note that HTML output will only work if \"Escape HTML codes in "
               "plugin output\" is disabled in global settings. This might expose you to "
               "Cross-Site-Scripting (everyone with write-access to checks could get "
               "scripts executed on the monitoring site in the context of the user of the "
               "monitoring site) so please do this if you understand the consequences."
               ),
             choices=[
                 (None, _("Disable")),
                 ("text", _("Text output")),
                 ("html", _("HTML output")),
             ],
             default_value="disable",
         )),
        ('process_info_arguments',
         Integer(
             title=_("Include process arguments in long-output"),
             label=_("Include per-process arguments (security risk!)"),
             help=
             _("If non-zero, the the list of all the matching processes and their details"
               " in the long-output will include up to the first N arguments of each"
               " processes. Please note this may include sensitive data like credentials,"
               " and is strongly discouraged."),
             default_value=0,
         )),
        ('icon',
         UserIconOrAction(
             title=_("Add custom icon or action"),
             help=
             _("You can assign icons or actions to the found services in the status GUI."
               ),
         )),
    ]
Exemplo n.º 5
0
def _parameter_valuespec_cisco_qos():
    return Dictionary(elements=[
        ("unit",
         RadioChoice(
             title=_("Measurement unit"),
             help=
             _("Here you can specifiy the measurement unit of the network interface"
               ),
             default_value="bit",
             choices=[
                 ("bit", _("Bits")),
                 ("byte", _("Bytes")),
             ],
         )),
        ("post",
         Alternative(
             title=_("Used bandwidth (traffic)"),
             help=_(
                 "Settings levels on the used bandwidth is optional. If you do set "
                 "levels you might also consider using averaging."),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(
                     title=_("Absolute levels in bits or bytes per second"),
                     help=
                     _("Depending on the measurement unit (defaults to bit) the absolute levels are set in bit or byte"
                       ),
                     elements=[
                         Integer(title=_("Warning at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                         Integer(title=_("Critical at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                     ],
                 )
             ],
         )),
        ("average",
         Integer(
             title=_("Average values"),
             help=_(
                 "By activating the computation of averages, the levels on "
                 "errors and traffic are applied to the averaged value. That "
                 "way you can make the check react only on long-time changes, "
                 "not on one-minute events."),
             unit=_("minutes"),
             minvalue=1,
         )),
        ("drop",
         Alternative(
             title=_("Number of dropped bits or bytes per second"),
             help=_(
                 "Depending on the measurement unit (defaults to bit) you can set the warn and crit "
                 "levels for the number of dropped bits or bytes"),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(elements=[
                     Integer(title=_("Warning at"),
                             size=8,
                             label=_("bits / bytes per second")),
                     Integer(title=_("Critical at"),
                             size=8,
                             label=_("bits / bytes per second")),
                 ], )
             ],
         )),
    ], )