Beispiel #1
0
 def _vs_count_ok_count(cls, title: str, defval: int,
                        defvalperc: int) -> Alternative:
     return Alternative(
         title=title,
         match=lambda x: str(x).endswith("%") and 1 or 0,
         elements=[
             Integer(
                 title=_("Explicit number"),
                 label=_("Number of OK-nodes"),
                 minvalue=0,
                 default_value=defval,
             ),
             Transform(
                 valuespec=Percentage(
                     label=_("Percent of OK-nodes"),
                     display_format="%.0f",
                     default_value=defvalperc,
                 ),
                 title=_("Percentage"),
                 forth=lambda x: float(x[:-1]),
                 back=lambda x: "%d%%" % x,
             ),
         ],
     )
Beispiel #2
0
    def _parameter_elements(cls):
        elements = [
            # TODO: Cleanup: switch to generic Timerange() valuespec!
            ("timerange",
             DropdownChoice(
                 title=_('Timerange'),
                 default_value='1',
                 choices=[
                     ("0", _("4 Hours")),
                     ("1", _("25 Hours")),
                     ("2", _("One Week")),
                     ("3", _("One Month")),
                     ("4", _("One Year")),
                 ],
             )),
            ("source",
             Integer(
                 title=_("Source (n'th graph)"),
                 default_value=1,
                 minvalue=1,
             )),
        ]

        elements += [
            ("graph_render_options",
             vs_graph_render_options(
                 default_values=default_dashlet_graph_render_options,
                 exclude=[
                     "show_time_range_previews",
                     "title_format",
                     "show_title",
                 ],
             )),
        ]

        return elements
Beispiel #3
0
 def _vs_audit_log_options(self):
     return Dictionary(
         title=_("Options"),
         elements=[
             ("filter_regex", RegExp(
                 title=_("Filter pattern (RegExp)"),
                 mode="infix",
             )),
             ("start",
              CascadingDropdown(
                  title=_("Start log from"),
                  default_value="now",
                  orientation="horizontal",
                  choices=[
                      ("now", _("Current date")),
                      ("time", _("Specific date"), AbsoluteDate()),
                  ],
              )),
             ("display",
              CascadingDropdown(
                  title=_("Display mode of entries"),
                  default_value="daily",
                  orientation="horizontal",
                  choices=[
                      ("daily", _("Daily paged display")),
                      ("number_of_days", _("Number of days from now (single page)"),
                       Integer(
                           minvalue=1,
                           unit=_("days"),
                           default_value=1,
                       )),
                  ],
              )),
         ],
         optional_keys=[],
     )
Beispiel #4
0
def _ntp_params():
    return Tuple(
        title=_("Thresholds for quality of time"),
        elements=[
            Integer(
                title=_("Critical at stratum"),
                default_value=10,
                help=
                _("The stratum (\"distance\" to the reference clock) at which the check gets critical."
                 ),
            ),
            Float(
                title=_("Warning at"),
                unit=_("ms"),
                default_value=200.0,
                help=_("The offset in ms at which a warning state is triggered."),
            ),
            Float(
                title=_("Critical at"),
                unit=_("ms"),
                default_value=500.0,
                help=_("The offset in ms at which a critical state is triggered."),
            ),
        ])
Beispiel #5
0
def _parameter_valuespec_firewall_if():
    return Dictionary(elements=[
        (
            "ipv4_in_blocked",
            Levels(
                title=_("Levels for rate of incoming IPv4 packets blocked"),
                unit=_("pkts/s"),
                default_levels=(100.0, 10000.0),
                default_difference=(5, 8),
                default_value=None,
            ),
        ),
        ("average",
         Integer(
             title=_("Averaging"),
             help=_(
                 "When this option is activated then the block rate is being "
                 "averaged <b>before</b> the levels are being applied."),
             unit=_("minutes"),
             default_value=3,
             minvalue=1,
             label=_("Compute average over last "),
         )),
    ], )
Beispiel #6
0
 def _vs_ical(self):
     return Dictionary(
         title=_('Import iCalendar File'),
         render="form",
         optional_keys=False,
         elements=[
             ('file',
              FileUpload(
                  title=_('iCalendar File'),
                  help=_("Select an iCalendar file (<tt>*.ics</tt>) from your PC"),
                  allow_empty=False,
                  custom_validate=self._validate_ical_file,
              )),
             ('horizon',
              Integer(
                  title=_('Time horizon for repeated events'),
                  help=
                  _("When the iCalendar file contains definitions of repeating events, these repeating "
                    "events will be resolved to single events for the number of years you specify here."
                   ),
                  minvalue=0,
                  maxvalue=50,
                  default_value=10,
                  unit=_('years'),
              )),
             ('times',
              Optional(
                  ListOfTimeRanges(default_value=[None],),
                  title=_('Use specific times'),
                  label=_('Use specific times instead of whole day'),
                  help=
                  _("When you specify explicit time definitions here, these will be added to each "
                    "date which is added to the resulting time period. By default the whole day is "
                    "used."),
              )),
         ])
Beispiel #7
0
def _vsphere_esx_hostsystem_cluster_elements():
    return [
        (
            'cluster',
            ListOf(
                Tuple(
                    orientation='horizontal',
                    elements=[
                        Integer(
                            title=_("Nodes"),
                            help=
                            _("Apply these levels to clusters that have at least the following number of nodes:"
                              ),
                            minvalue=1,
                        ),
                        Dictionary(elements=cpu_util_elements()),
                    ]),
                title=_('Clusters: node specific CPU utilization'),
                help=_(
                    'Configure thresholds that apply to clusters based on how many nodes '
                    'they have.'),
            ),
        ),
    ]
Beispiel #8
0
def _valuespec_winperf_msx_queues_inventory():
    return Transform(
        valuespec=Dictionary(
            title=_("Queue names"),
            elements=[(
                "queue_names",
                ListOf(
                    valuespec=Tuple(
                        orientation="horizontal",
                        elements=[
                            TextInput(
                                title=_("Name of Queue"),
                                size=50,
                                allow_empty=False,
                            ),
                            Integer(
                                title=_("Offset"),
                                help=
                                _("The offset of the information relative to counter base."
                                  " You can get a detailed list of available counters in a windows shell with the command 'lodctr /s:counters.txt'."
                                  ),
                            ),
                        ],
                    ),
                    title=_("MS Exchange message queues discovery"),
                    help=
                    _("Per default the offsets of all Windows performance counters are preconfigured in the check. "
                      "If the format of your counters object is not compatible then you can adapt the counter "
                      "offsets manually."),
                    movable=False,
                    add_label=_("Add Counter"),
                ),
            )],
        ),
        forth=transform_msx_queues_inventory,
    )
Beispiel #9
0
    def valuespec(cls):
        def convert_to_vs(value):
            return value["count"], value["restrict_state"]

        def convert_from_vs(value):
            return {
                "type": cls.type(),
                "count": value[0],
                "restrict_state": value[1],
            }

        return Transform(
            Tuple(elements=[
                Integer(
                    help=
                    _("Normally this value is <tt>1</tt>, which means that the best state "
                      "of all child nodes is being used as the total state. If you set it for example "
                      "to <tt>2</tt>, then the node with the best state is not being regarded. "
                      "If the states of the child nodes would be CRIT, WARN and OK, then to total "
                      "state would be WARN."),
                    title=_("Take n'th best state for n = "),
                    default_value=1,
                    minvalue=1,
                ),
                MonitoringState(
                    title=_("Restrict severity to at worst"),
                    help=
                    _("Here a maximum severity of the node state can be set. This severity is not "
                      "exceeded, even if some of the childs have more severe states."
                      ),
                    default_value=2,
                ),
            ]),
            forth=convert_to_vs,
            back=convert_from_vs,
        )
Beispiel #10
0
def _parameter_valuespec_fireeye_mailq():
    return Dictionary(elements=[
        (
            "deferred",
            Tuple(
                title=_("Levels for Deferred Queue length"),
                elements=[
                    Integer(title="Warning at", default_value=10,
                            unit="Mails"),
                    Integer(title="Critical at",
                            default_value=15,
                            unit="Mails"),
                ],
            ),
        ),
        (
            "hold",
            Tuple(
                title=_("Levels for Hold Queue length"),
                elements=[
                    Integer(title="Warning at",
                            default_value=500,
                            unit="Mails"),
                    Integer(title="Critical at",
                            default_value=700,
                            unit="Mails"),
                ],
            ),
        ),
        (
            "drop",
            Tuple(
                title=_("Levels for Drop Queue length"),
                elements=[
                    Integer(title="Warning at", default_value=10,
                            unit="Mails"),
                    Integer(title="Critical at",
                            default_value=15,
                            unit="Mails"),
                ],
            ),
        ),
    ], )
Beispiel #11
0
 def parameter_valuespec(self):
     return Dictionary(
         help=_("This check monitors the current number of active sessions to the MySQL "
                "database server as well as the connection rate."),
         elements=[
             (
                 "total",
                 Tuple(
                     title=_("Number of current sessions"),
                     elements=[
                         Integer(title=_("Warning at"), unit=_("sessions"), default_value=100),
                         Integer(title=_("Critical at"), unit=_("sessions"), default_value=200),
                     ],
                 ),
             ),
             (
                 "running",
                 Tuple(
                     title=_("Number of currently running sessions"),
                     help=_("Levels for the number of sessions that are currently active"),
                     elements=[
                         Integer(title=_("Warning at"), unit=_("sessions"), default_value=10),
                         Integer(title=_("Critical at"), unit=_("sessions"), default_value=20),
                     ],
                 ),
             ),
             (
                 "connections",
                 Tuple(
                     title=_("Number of new connections per second"),
                     elements=[
                         Integer(title=_("Warning at"),
                                 unit=_("connection/sec"),
                                 default_value=20),
                         Integer(title=_("Critical at"),
                                 unit=_("connection/sec"),
                                 default_value=40),
                     ],
                 ),
             ),
         ],
     )
Beispiel #12
0
def _parameter_valuespec_azure_agent_info():
    return Dictionary(elements=[
        ("resource_pinning",
         DropdownChoice(
             title=_("Resource pinning: Ensure monitored resources are unchanged"),
             help=_("If this option is selected, the resources being monitored are stored during"
                    " discovery. The service will go to a warning state, if they change."),
             choices=[
                 (True, _("Warn if resources appear or vanish")),
                 (False, _("Silently ignore new or missing resources")),
             ],
         )),
        ("warning_levels",
         Tuple(
             title=_("Upper levels for encountered warnings"),
             elements=[
                 Integer(title=_("Warning at"), default_value=1),
                 Integer(title=_("Critical at"), default_value=10),
             ],
         )),
        ("exception_levels",
         Tuple(
             title=_("Upper levels for encountered exceptions"),
             elements=[
                 Integer(title=_("Warning at"), default_value=1),
                 Integer(title=_("Critical at"), default_value=1),
             ],
         )),
        ("remaining_reads_levels_lower",
         Tuple(
             title=_("Lower levels for remaining API reads"),
             elements=[
                 Integer(title=_("Warning below"), default_value=6000),
                 Integer(title=_("Critical below"), default_value=3000),
             ],
         )),
        ("remaining_reads_unknown_state",
         MonitoringState(
             title=_("State if remaining API reads are unknown"),
             default_value=1,
         )),
    ],)
Beispiel #13
0
def _parameter_valuespec_splunk_jobs():
    return Dictionary(
        optional_keys=True,
        elements=[
            (
                "job_count",
                Tuple(
                    title=_("Number of jobs"),
                    elements=[
                        Integer(title=_("Warning at")),
                        Integer(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "failed_count",
                Tuple(
                    title=_("Number of failed jobs"),
                    elements=[
                        Integer(title=_("Warning at")),
                        Integer(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "zombie_count",
                Tuple(
                    title=_("Number of zombie jobs"),
                    help=_(
                        "Splunk calls a search a zombie when the search is "
                        "no longer running, but did not declare explicitly that "
                        "it has finished its work."
                    ),
                    elements=[
                        Integer(title=_("Warning at")),
                        Integer(title=_("Critical at")),
                    ],
                ),
            ),
        ],
    )
Beispiel #14
0
def _parameter_valuespec_eaton_enviroment():
    return Dictionary(elements=[
        (
            "temp",
            Tuple(
                title=_("Temperature"),
                elements=[
                    Integer(title=_("warning at"), unit="°C",
                            default_value=26),
                    Integer(title=_("critical at"),
                            unit="°C",
                            default_value=30),
                ],
            ),
        ),
        (
            "remote_temp",
            Tuple(
                title=_("Remote Temperature"),
                elements=[
                    Integer(title=_("warning at"), unit="°C",
                            default_value=26),
                    Integer(title=_("critical at"),
                            unit="°C",
                            default_value=30),
                ],
            ),
        ),
        (
            "humidity",
            Tuple(
                title=_("Humidity"),
                elements=[
                    Integer(title=_("warning at"), unit="%", default_value=60),
                    Integer(title=_("critical at"), unit="%",
                            default_value=75),
                ],
            ),
        ),
    ], )
Beispiel #15
0
def _parameter_valuespec_skype_edge():
    return Dictionary(elements=[
        ('authentication_failures',
         Dictionary(
             title=_("Authentication Failures"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Integer(title=_("Warning at"), unit=_("per second"), default_value=20),
                      Integer(title=_("Critical at"), unit=_("per second"), default_value=40),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('allocate_requests_exceeding',
         Dictionary(
             title=_("Allocate Requests Exceeding Port Limit"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Integer(title=_("Warning at"), unit=_("per second"), default_value=20),
                      Integer(title=_("Critical at"), unit=_("per second"), default_value=40),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('packets_dropped',
         Dictionary(
             title=_("Packets Dropped"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Integer(title=_("Warning at"), unit=_("per second"), default_value=200),
                      Integer(title=_("Critical at"), unit=_("per second"), default_value=400),
                  ],)),
             ],
             optional_keys=[],
         )),
    ],)
Beispiel #16
0
def _parameter_valuespec_k8s_roles():
    return Dictionary(elements=[
        (
            "total",
            Tuple(
                title=_("Total"),
                default_value=(80.0, 90.0),
                elements=[
                    Integer(title=_("Warning above")),
                    Integer(title=_("Critical above")),
                ],
            ),
        ),
        (
            "cluster_roles",
            Tuple(
                title=_("Cluster roles"),
                default_value=(80.0, 90.0),
                elements=[
                    Integer(title=_("Warning above")),
                    Integer(title=_("Critical above")),
                ],
            ),
        ),
        (
            "roles",
            Tuple(
                title=_("Roles"),
                default_value=(80.0, 90.0),
                elements=[
                    Integer(title=_("Warning above")),
                    Integer(title=_("Critical above")),
                ],
            ),
        ),
    ], )
Beispiel #17
0
def _parameter_valuespec_mtr():
    return Transform(
        Dictionary(
            help=_(
                "This ruleset can be used to change MTR's (Matt's traceroute) warning and crit levels for packet loss, average "
                "roundtrip and standard deviation."),
            elements=[
                ("rta",
                 Tuple(
                     title=_("Average roundtrip time in ms"),
                     elements=[
                         Integer(title=_("Warning at"),
                                 default_value=150,
                                 unit=_("ms"),
                                 minvalue=0),
                         Integer(title=_("Critical at"),
                                 default_value=250,
                                 unit=_("ms"),
                                 minvalue=0),
                     ],
                     help=
                     _("The maximum average roundtrip time in ms before this service goes into warning/critical. "
                       "This alarm only applies to the target host, not the hops in between."
                       ),
                 )),
                ("rtstddev",
                 Tuple(
                     title=_("Standard deviation of roundtrip times in ms"),
                     elements=[
                         Integer(title=_("Warning at"),
                                 default_value=150,
                                 unit=_("ms"),
                                 minvalue=0),
                         Integer(title=_("Critical at"),
                                 default_value=250,
                                 unit=_("ms"),
                                 minvalue=0),
                     ],
                     help=
                     _("The maximum standard deviation on the roundtrip time in ms before this service goes into"
                       "warning/critical. This alarm only applies to the target host, not the hops in between."
                       ),
                 )),
                ("pl",
                 Tuple(
                     title=_("Packet loss in percentage"),
                     elements=[
                         Integer(title=_("Warning at"),
                                 default_value=10,
                                 unit=_("%"),
                                 minvalue=0),
                         Integer(title=_("Critical at"),
                                 default_value=25,
                                 unit=_("%"),
                                 minvalue=0),
                     ],
                     help=_(
                         "The maximum allowed percentage of packet loss to the destination before this service "
                         "goes into warning/critical."),
                 )),
            ],
            optional_keys=False,
        ),
        forth=_transform_mtr_params,
    )
Beispiel #18
0
 help=_(
     "The number of remaining inodes on the filesystem. "
     "Please note that this setting has no effect on some filesystem checks."
 ),
 elements=[
     Tuple(title=_("Percentage free"),
           elements=[
               Percentage(title=_("Warning if less than")),
               Percentage(title=_("Critical if less than")),
           ]),
     Tuple(
         title=_("Absolute free"),
         elements=[
             Integer(title=_("Warning if less than"),
                     size=10,
                     unit=_("inodes"),
                     minvalue=0,
                     default_value=10000),
             Integer(title=_("Critical if less than"),
                     size=10,
                     unit=_("inodes"),
                     minvalue=0,
                     default_value=5000),
         ],
     ),
     FixedValue(
         None,
         totext="",
         title=_("Ignore levels"),
     ),
 ],
Beispiel #19
0
def _parameter_valuespec_memory():
    return Dictionary(elements=[
        (
            "levels",
            Alternative(
                title=_("Levels for Cisco CPU memory"),
                help=
                _("The performance graph will always display the occupied memory. "
                  "This is independent of the actual check levels which can be set "
                  "for both free and occupied memory levels."),
                default_value=(150.0, 200.0),
                match=match_dual_level_type,
                elements=[
                    Alternative(
                        title=_("Levels for occupied memory"),
                        help=_(
                            "Specify the threshold levels for the occupied memory. The occupied memory "
                            "consists of used and kernel reserved memory."),
                        elements=[
                            Tuple(
                                title=_(
                                    "Specify levels in percentage of total RAM"
                                ),
                                elements=[
                                    Percentage(
                                        title=_("Warning at a usage of"),
                                        maxvalue=None),
                                    Percentage(
                                        title=_("Critical at a usage of"),
                                        maxvalue=None),
                                ],
                            ),
                            Tuple(
                                title=_("Specify levels in absolute values"),
                                elements=[
                                    Integer(title=_("Warning at"),
                                            unit=_("MB")),
                                    Integer(title=_("Critical at"),
                                            unit=_("MB")),
                                ],
                            ),
                        ],
                    ),
                    Transform(
                        Alternative(elements=[
                            Tuple(
                                title=_(
                                    "Specify levels in percentage of total RAM"
                                ),
                                elements=[
                                    Percentage(
                                        title=_("Warning if less than"),
                                        maxvalue=None,
                                    ),
                                    Percentage(
                                        title=_("Critical if less than"),
                                        maxvalue=None,
                                    ),
                                ],
                            ),
                            Tuple(
                                title=_("Specify levels in absolute values"),
                                elements=[
                                    Integer(title=_("Warning if below"),
                                            unit=_("MB")),
                                    Integer(title=_("Critical if below"),
                                            unit=_("MB")),
                                ],
                            ),
                        ], ),
                        title=_("Levels for free memory"),
                        help=_(
                            "Specify the threshold levels for the free memory space. The free memory "
                            "excludes the reserved kernel memory."),
                        forth=lambda val: tuple(-x for x in val),
                        back=lambda val: tuple(-x for x in val),
                    ),
                ],
            ),
        ),
    ], )
Beispiel #20
0
    def _audit_log_options(self):
        object_types: Choices = [
            ("", _("All object types")),
            (None, _("No object type")),
        ] + [(t.name, t.name) for t in ObjectRefType]

        return [
            (
                "object_type",
                DropdownChoice(
                    title=_("Object type"),
                    choices=object_types,
                ),
            ),
            (
                "object_ident",
                TextInput(title=_("Object"), ),
            ),
            (
                "user_id",
                UserSelection(
                    title=_("User"),
                    only_contacts=False,
                    none=_("All users"),
                ),
            ),
            (
                "filter_regex",
                RegExp(
                    title=_("Filter pattern (RegExp)"),
                    mode="infix",
                ),
            ),
            (
                "start",
                CascadingDropdown(
                    title=_("Start log from"),
                    default_value="now",
                    orientation="horizontal",
                    choices=[
                        ("now", _("Current date")),
                        ("time", _("Specific date"), AbsoluteDate()),
                    ],
                ),
            ),
            (
                "display",
                CascadingDropdown(
                    title=_("Display mode of entries"),
                    default_value="daily",
                    orientation="horizontal",
                    choices=[
                        ("daily", _("Daily paged display")),
                        (
                            "number_of_days",
                            _("Number of days from now (single page)"),
                            Integer(
                                minvalue=1,
                                unit=_("days"),
                                default_value=1,
                            ),
                        ),
                    ],
                ),
            ),
        ]
Beispiel #21
0
    def _vs_rules(self):
        if config.user.may('wato.add_or_modify_executables'):
            ds_option = [(
                'datasource_program',
                TextAscii(
                    title=_("Datasource Program (<a href=\"%s\">Rules</a>)") %
                    watolib.folder_preserving_link(
                        [('mode', 'edit_ruleset'),
                         ('varname', 'datasource_programs')]),
                    help=
                    _("For agent based checks Check_MK allows you to specify an alternative "
                      "program that should be called by Check_MK instead of connecting the agent "
                      "via TCP. That program must output the agent's data on standard output in "
                      "the same format the agent would do. This is for example useful for monitoring "
                      "via SSH.") + monitoring_macro_help() + " " +
                    _("This option can only be used with the permission \"Can add or modify executables\"."
                      ),
                ))]  # type: List[DictionaryEntry]
        else:
            ds_option = []

        return Dictionary(
            optional_keys = False,
            elements = [
                ('agent_port', Integer(
                    minvalue = 1,
                    maxvalue = 65535,
                    default_value = 6556,
                    title = _("Check_MK Agent Port (<a href=\"%s\">Rules</a>)") %
                        watolib.folder_preserving_link([('mode', 'edit_ruleset'), ('varname', 'agent_ports')]),
                    help = _("This variable allows to specify the TCP port to "
                             "be used to connect to the agent on a per-host-basis.")
                )),
                ('tcp_connect_timeout', Float(
                    minvalue = 1.0,
                    default_value = 5.0,
                    unit = _("sec"),
                    display_format = "%.0f",  # show values consistent to
                    size = 2,                 # SNMP-Timeout
                    title = _("TCP Connection Timeout (<a href=\"%s\">Rules</a>)") % \
                        watolib.folder_preserving_link([('mode', 'edit_ruleset'), ('varname', 'tcp_connect_timeouts')]),
                    help = _("This variable allows to specify a timeout for the "
                            "TCP connection to the Check_MK agent on a per-host-basis."
                            "If the agent does not respond within this time, it is considered to be unreachable.")
                )),
                ('snmp_timeout', Integer(
                    title = _("SNMP-Timeout (<a href=\"%s\">Rules</a>)") % \
                        watolib.folder_preserving_link([('mode', 'edit_ruleset'), ('varname', 'snmp_timing')]),
                    help = _("After a request is sent to the remote SNMP agent we will wait up to this "
                             "number of seconds until assuming the answer get lost and retrying."),
                    default_value = 1,
                    minvalue = 1,
                    maxvalue = 60,
                    unit = _("sec"),
                )),
                ('snmp_retries', Integer(
                    title = _("SNMP-Retries (<a href=\"%s\">Rules</a>)") % \
                        watolib.folder_preserving_link([('mode', 'edit_ruleset'), ('varname', 'snmp_timing')]),
                    default_value = 5,
                    minvalue = 0,
                    maxvalue = 50,
                )),
            ] + ds_option,
        )
Beispiel #22
0
    CheckParameterRulespecWithoutItem,
    rulespec_registry,
    RulespecGroupCheckParametersApplications,
)

mailqueue_params = Dictionary(
    elements=[
        (
            "deferred",
            Tuple(
                title=_("Mails in outgoing mail queue/deferred mails"),
                help=_("This rule is applied to the number of E-Mails currently "
                       "in the deferred mail queue, or in the general outgoing mail "
                       "queue, if such a distinction is not available."),
                elements=[
                    Integer(title=_("Warning at"), unit=_("mails"), default_value=10),
                    Integer(title=_("Critical at"), unit=_("mails"), default_value=20),
                ],
            ),
        ),
        (
            "active",
            Tuple(
                title=_("Mails in active mail queue"),
                help=_("This rule is applied to the number of E-Mails currently "
                       "in the active mail queue"),
                elements=[
                    Integer(title=_("Warning at"), unit=_("mails"), default_value=800),
                    Integer(title=_("Critical at"), unit=_("mails"), default_value=1000),
                ],
            ),
Beispiel #23
0
def cpu_util_elements():
    return [
        (
            "core_util_time_total",
            Tuple(
                title=
                _("Levels over an extended time period on total CPU utilization"
                  ),
                elements=[
                    Percentage(title=_("High utilization at "),
                               default_value=100.0),
                    Age(title=_("Warning after "), default_value=5 * 60),
                    Age(title=_("Critical after "), default_value=15 * 60),
                ],
                help=
                _("With this configuration, Checkmk will alert if the actual (not averaged) total CPU is "
                  "exceeding a utilization threshold over an extended period of time. "
                  "ATTENTION: This configuration cannot be used for check <i>lparstat_aix.cpu_util</i>!"
                  ),
            ),
        ),
        (
            "core_util_time",
            Tuple(
                title=
                _("Levels over an extended time period on a single core CPU utilization"
                  ),
                elements=[
                    Percentage(title=_("High utilization at "),
                               default_value=100.0),
                    Age(title=_("Warning after "), default_value=5 * 60),
                    Age(title=_("Critical after "), default_value=15 * 60),
                ],
                help=
                _("A single thread fully utilizing a single core (potentially due to a bug) "
                  "may go unnoticed when only monitoring the total utilization of the CPU. "
                  "With this configuration, Checkmk will alert if a single core is "
                  "exceeding a utilization threshold over an extended period of time."
                  "This is currently only supported on linux and windows agents "
                  "as well as devices monitored through the host-resource mib"
                  ),
            ),
        ),
        (
            "average",
            Integer(
                title=_("Averaging for total CPU utilization"),
                help=
                _("When this option is activated then the CPU utilization is being "
                  "averaged <b>before</b> the levels on total CPU utilization are being applied."
                  ),
                unit=_("minutes"),
                minvalue=1,
                default_value=15,
                label=_("Compute average over last "),
            ),
        ),
        (
            "average_single",
            Dictionary(
                title=_("Averaging for single cores"),
                help=
                _("Compute averaged single-core CPU utilizations. Note that this option only has "
                  "an effect if at least one of the sub-options 'Apply single-core levels' or "
                  "'Graphs for averaged single-core utilizations' is enabled."
                  ),
                elements=[
                    (
                        "time_average",
                        Integer(
                            title=_("Time frame"),
                            unit=_("minutes"),
                            minvalue=1,
                            default_value=15,
                            label=_("Compute average over last "),
                        ),
                    ),
                    (
                        "apply_levels",
                        DropdownChoice(
                            title=
                            _("Apply single-core levels defined in 'Levels on single cores'"
                              ),
                            help=_(
                                "Apply the levels for single cores to the averaged instead of the "
                                "instantaneous utilizations."),
                            choices=[
                                (True, _("Enable")),
                                (False, _("Disable")),
                            ],
                            default_value=False,
                        ),
                    ),
                    (
                        "show_graph",
                        DropdownChoice(
                            title=_(
                                "Graphs for averaged single-core utilizations"
                            ),
                            help=_(
                                "Create a separate graph showing the averaged single-core CPU "
                                "utilizations."),
                            choices=[
                                (True, _("Enable")),
                                (False, _("Disable")),
                            ],
                            default_value=False,
                        ),
                    ),
                ],
                optional_keys=False,
            ),
        ),
        (
            "util",
            Levels(
                title=_("Levels on total CPU utilization"),
                unit="%",
                default_levels=(90, 95),
                default_difference=(5, 8),
                default_value=None,
                help=
                _("The CPU utilization sums up the percentages of CPU time that is used "
                  "for user processes, kernel routines (system), disk wait (sometimes also "
                  "called IO wait) or nothing (idle). The levels are always applied "
                  "on the average utilization since the last check - which is usually one minute."
                  ),
            ),
        ),
        (
            "levels_single",
            Tuple(
                title=_("Levels on single cores"),
                elements=[
                    Percentage(title=_("Warning at"), default_value=90.0),
                    Percentage(title=_("Critical at"), default_value=95.0),
                ],
                help=
                _("Here you can set levels on the CPU utilization on single cores"
                  ),
            ),
        ),
        (
            "core_util_graph",
            DropdownChoice(
                title=_("Graphs for individual cores"),
                help=
                _("This adds another graph to the performance CPU utilization "
                  "details page, showing utilization of individual cores. "
                  "Please note that this graph may be impractical on "
                  "device with very many cores. "
                  "This is currently only supported on linux and windows agents "
                  "as well as devices monitored through the host-resource mib"
                  ),
                choices=[
                    (True, _("Enable")),
                    (False, _("Disable")),
                ],
                default_value=True,
            ),
        ),
    ]
Beispiel #24
0
    def _network_scan_elements(self):
        elements = [
            ("ip_ranges",
             ListOf(
                 self._vs_ip_range(),
                 title=_("IP ranges to scan"),
                 add_label=_("Add new IP range"),
                 text_if_empty=_("No IP range configured"),
             )),
            ("exclude_ranges",
             ListOf(
                 self._vs_ip_range(),
                 title=_("IP ranges to exclude"),
                 add_label=_("Add new IP range"),
                 text_if_empty=_("No exclude range configured"),
             )),
            (
                "scan_interval",
                Age(
                    title=_("Scan interval"),
                    display=["days", "hours"],
                    default_value=60 * 60 * 24,
                    minvalue=3600,  # 1 hour
                )),
            ("time_allowed",
             Transform(
                 ListOf(
                     TimeofdayRange(allow_empty=False, ),
                     title=_("Time allowed"),
                     help=_(
                         "Limit the execution of the scan to this time range."
                     ),
                     allow_empty=False,
                     style=ListOf.Style.FLOATING,
                     movable=False,
                     default_value=[((0, 0), (24, 0))],
                 ),
                 forth=lambda x: [x] if isinstance(x, tuple) else x,
                 back=sorted,
             )),
            ("set_ipaddress",
             Checkbox(
                 title=_("Set IPv4 address"),
                 help=_(
                     "Whether or not to configure the found IP address as the IPv4 "
                     "address of the found hosts."),
                 default_value=True,
             )),
        ]

        elements += self._optional_tag_criticality_element()
        elements += [
            ("max_parallel_pings",
             Integer(
                 title=_("Parallel pings to send"),
                 help=_(
                     "Set the maximum number of concurrent pings sent to target IP "
                     "addresses."),
                 minvalue=1,
                 maxvalue=200,
                 default_value=100,
             )),
            ("run_as",
             DropdownChoice(
                 title=_("Run as"),
                 help=
                 _("Execute the network scan in the Check_MK user context of the "
                   "choosen user. This user needs the permission to add new hosts "
                   "to this folder."),
                 choices=self._get_all_user_ids,
                 default_value=lambda: config.user.id,
             )),
            ("translate_names",
             HostnameTranslation(title=_("Translate Hostnames"), )),
        ]

        return elements
Beispiel #25
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 #26
0
def _parameter_valuespec_ups_out_load():
    return Tuple(elements=[
        Integer(title=_("warning at"), unit=u"%", default_value=85),
        Integer(title=_("critical at"), unit=u"%", default_value=90),
    ], )
Beispiel #27
0
def _parameter_valuespec_ibm_mq_queues():
    return Dictionary(
        help=_(
            "See 'Queue status attributes' in IBM manual"
            "(https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.2.0/com.ibm.mq.explorer.doc/e_status_queue.html)"
            " for detailed explanations of these parameters."),
        elements=[
            ("curdepth",
             OptionalDropdownChoice(
                 title=_("Current queue depth"),
                 help=_("CURDEPTH: The number of messages currently on the queue."),
                 choices=[((None, None), _("Ignore these levels"))],
                 otherlabel=_("Set absolute levels"),
                 explicit=Tuple(
                     title=_('Maximum number of messages'),
                     elements=[
                         Integer(title=_("Warning at")),
                         Integer(title=_("Critical at")),
                     ],
                 ),
             )),
            ("curdepth_perc",
             OptionalDropdownChoice(
                 help=_("CURDEPTH_PERC: Percentage (CURDEPTH/MAXDEPTH) of the number of"
                        " messages currently on the queue."),
                 title=_('Current queue depth in %'),
                 choices=[((None, None), _("Ignore these levels"))],
                 otherlabel=_("Set relative levels"),
                 default_value=(80.0, 90.0),
                 explicit=Tuple(
                     title=_('Percentage of queue depth'),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at")),
                     ],
                 ),
             )),
            ("msgage",
             Tuple(
                 help=_("MSGAGE: The age, in seconds, of the oldest message on the queue."),
                 title=_("Oldest message age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("lgetage",
             Tuple(
                 help=_("The age, in seconds, when the last message was retrieved from the queue."
                        " Calculated by subtracting LGETDATE/LGETTIME from current timestamp."),
                 title=_("Last get age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("lputage",
             Tuple(
                 help=_("The age, in seconds, when the last message was put to the queue. "
                        " Calculated by subtracting LPUTDATE/LPUTTIME from current timestamp."),
                 title=_("Last put age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("ipprocs",
             Dictionary(
                 help=_("IPPROCS: The number of applications that are currently connected to"
                        " the queue to get messages from the queue."),
                 title=_("Open input count"),
                 elements=[
                     ("lower",
                      Tuple(
                          title=_("Lower levels"),
                          elements=[
                              Integer(title=_("Warning if below")),
                              Integer(title=_("Critical if below")),
                          ],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[
                              Integer(title=_("Warning at")),
                              Integer(title=_("Critical at")),
                          ],
                      )),
                 ],
             )),
            ("opprocs",
             Dictionary(
                 help=_("OPPROCS: The number of applications that are currently connected"
                        " to the queue to put messages on the queue."),
                 title=_("Open output count"),
                 elements=[
                     ("lower",
                      Tuple(
                          title=_("Lower levels"),
                          elements=[
                              Integer(title=_("Warning if below")),
                              Integer(title=_("Critical if below")),
                          ],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[
                              Integer(title=_("Warning at")),
                              Integer(title=_("Critical at")),
                          ],
                      )),
                 ],
             )),
        ],
    )
Beispiel #28
0
def _parameter_valuespec_blank_tapes():
    return Tuple(elements=[
        Integer(title=_("Warning below"), default_value=5),
        Integer(title=_("Critical below"), default_value=1),
    ], )
Beispiel #29
0
 def _vs_rules(self):
     return Dictionary(
         optional_keys=False,
         elements=[
             (
                 "agent_port",
                 Integer(
                     minvalue=1,
                     maxvalue=65535,
                     default_value=6556,
                     title=_('Checkmk Agent Port (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"), ("varname", "agent_ports")]
                     ),
                     help=_(
                         "This variable allows to specify the TCP port to "
                         "be used to connect to the agent on a per-host-basis."
                     ),
                 ),
             ),
             (
                 "tcp_connect_timeout",
                 Float(
                     minvalue=1.0,
                     default_value=5.0,
                     unit=_("sec"),
                     display_format="%.0f",  # show values consistent to
                     size=2,  # SNMP-Timeout
                     title=_('TCP Connection Timeout (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"), ("varname", "tcp_connect_timeouts")]
                     ),
                     help=_(
                         "This variable allows to specify a timeout for the "
                         "TCP connection to the Check_MK agent on a per-host-basis."
                         "If the agent does not respond within this time, it is considered to be unreachable."
                     ),
                 ),
             ),
             (
                 "snmp_timeout",
                 Integer(
                     title=_('SNMP-Timeout (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"), ("varname", "snmp_timing")]
                     ),
                     help=_(
                         "After a request is sent to the remote SNMP agent we will wait up to this "
                         "number of seconds until assuming the answer get lost and retrying."
                     ),
                     default_value=1,
                     minvalue=1,
                     maxvalue=60,
                     unit=_("sec"),
                 ),
             ),
             (
                 "snmp_retries",
                 Integer(
                     title=_('SNMP-Retries (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"), ("varname", "snmp_timing")]
                     ),
                     default_value=5,
                     minvalue=0,
                     maxvalue=50,
                 ),
             ),
         ],
     )
def _parameter_valuespec_rabbitmq_cluster_stats():
    return Dictionary(elements=[
        (
            "channels_upper",
            Tuple(
                title=_("Upper level for total number of channels"),
                elements=[
                    Integer(title=_("Warning at"), unit="channels"),
                    Integer(title=_("Critical at"), unit="channels"),
                ],
            ),
        ),
        (
            "channels_lower",
            Tuple(
                title=_("Lower level for total number of channels"),
                elements=[
                    Integer(title=_("Warning below"), unit="channels"),
                    Integer(title=_("Critical below"), unit="channels"),
                ],
            ),
        ),
        (
            "connections_upper",
            Tuple(
                title=_("Upper level for total number of connections"),
                elements=[
                    Integer(title=_("Warning at"), unit="connections"),
                    Integer(title=_("Critical at"), unit="connections"),
                ],
            ),
        ),
        (
            "connections_lower",
            Tuple(
                title=_("Lower level for total number of connections"),
                elements=[
                    Integer(title=_("Warning below"), unit="connections"),
                    Integer(title=_("Critical below"), unit="connections"),
                ],
            ),
        ),
        (
            "consumers_upper",
            Tuple(
                title=_("Upper level for total number of consumers"),
                elements=[
                    Integer(title=_("Warning at"), unit="consumers"),
                    Integer(title=_("Critical at"), unit="consumers"),
                ],
            ),
        ),
        (
            "consumers_lower",
            Tuple(
                title=_("Lower level for total number of consumers"),
                elements=[
                    Integer(title=_("Warning below"), unit="consumers"),
                    Integer(title=_("Critical below"), unit="consumers"),
                ],
            ),
        ),
        (
            "exchanges_upper",
            Tuple(
                title=_("Upper level for total number of exchanges"),
                elements=[
                    Integer(title=_("Warning at"), unit="exchanges"),
                    Integer(title=_("Critical at"), unit="exchanges"),
                ],
            ),
        ),
        (
            "exchanges_lower",
            Tuple(
                title=_("Lower level for total number of exchanges"),
                elements=[
                    Integer(title=_("Warning below"), unit="exchanges"),
                    Integer(title=_("Critical below"), unit="exchanges"),
                ],
            ),
        ),
        (
            "queues_upper",
            Tuple(
                title=_("Upper level for total number of queues"),
                elements=[
                    Integer(title=_("Warning at"), unit="queues"),
                    Integer(title=_("Critical at"), unit="queues"),
                ],
            ),
        ),
        (
            "queues_lower",
            Tuple(
                title=_("Lower level for total number of queues"),
                elements=[
                    Integer(title=_("Warning below"), unit="queues"),
                    Integer(title=_("Critical below"), unit="queues"),
                ],
            ),
        ),
    ], )