コード例 #1
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."
               ),
         ))
    ], )
コード例 #2
0
def process_level_elements():
    cpu_rescale_max_choices: DropdownChoices = [
        (True, _("100% is all cores at full load")),
        (False, _("N * 100% as each core contributes with 100% at full load")),
    ]
    return [
        ("cpu_rescale_max",
         DropdownChoice(
             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,
             choices=cpu_rescale_max_choices,
             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),
             ],
         )),
        ("min_age",
         Tuple(
             title=_("Minimum allowed age"),
             help=_("Set lower levels on the age of the process (not the consumed CPU time, "
                    "but the real time)."),
             elements=[
                 Age(title=_("Warning at"), default_value=3600),
                 Age(title=_("Critical at"), default_value=1800),
             ],
         )),
        ("max_age",
         Tuple(
             title=_("Maximum allowed age"),
             help=_("Set upper levels on the age of the process (not the consumed CPU time, "
                    "but the real time)."),
             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=None,
         )),
        ('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."),
         )),
    ]