Exemplo n.º 1
0
 def parameter_valuespec(self):
     return Dictionary(
         elements=[
             (
                 "memory",
                 Alternative(
                     title=_("Memory Levels"),
                     style="dropdown",
                     elements=[
                         Tuple(
                             title=_("Memory usage in percent"),
                             elements=[
                                 Percentage(title=_("Warning at")),
                                 Percentage(title=_("Critical at")),
                             ],
                         ),
                         Transform(
                             Tuple(
                                 title=_("Absolute free memory"),
                                 elements=[
                                     Filesize(
                                         title=_("Warning if less than")),
                                     Filesize(
                                         title=_("Critical if less than")),
                                 ],
                             ),
                             # Note: Filesize values lesser 1MB will not work
                             # -> need hide option in filesize valuespec
                             back=lambda x:
                             (x[0] / 1024 / 1024, x[1] / 1024 / 1024),
                             forth=lambda x:
                             (x[0] * 1024 * 1024, x[1] * 1024 * 1024)),
                         PredictiveLevels(unit=_("GB"),
                                          default_difference=(0.5, 1.0))
                     ],
                     default_value=(80.0, 90.0))),
             (
                 "pagefile",
                 Alternative(
                     title=_("Commit charge Levels"),
                     style="dropdown",
                     elements=[
                         Tuple(
                             title=
                             _("Commit charge in percent (relative to commit limit)"
                               ),
                             elements=[
                                 Percentage(title=_("Warning at")),
                                 Percentage(title=_("Critical at")),
                             ],
                         ),
                         Transform(
                             Tuple(
                                 title=_("Absolute commitable memory"),
                                 elements=[
                                     Filesize(
                                         title=_("Warning if less than")),
                                     Filesize(
                                         title=_("Critical if less than")),
                                 ],
                             ),
                             # Note: Filesize values lesser 1MB will not work
                             # -> need hide option in filesize valuespec
                             back=lambda x:
                             (x[0] / 1024 / 1024, x[1] / 1024 / 1024),
                             forth=lambda x:
                             (x[0] * 1024 * 1024, x[1] * 1024 * 1024)),
                         PredictiveLevels(unit=_("GB"),
                                          default_difference=(0.5, 1.0))
                     ],
                     default_value=(80.0, 90.0))),
             ("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,
              )),
         ], )
Exemplo n.º 2
0
def _parameter_valuespec_cisco_dom():
    return Dictionary(elements=[
        (_vs_cisco_dom("upper")),
        (_vs_cisco_dom("lower")),
    ], )
Exemplo n.º 3
0
def _parameter_valuespec_mongodb_cluster():
    return Dictionary(elements=[
        ("levels_number_jumbo",
         _mongodb_cluster_count_tuple(
             "Number of jumbo chunks per shard per collection", "above")),
    ])
Exemplo n.º 4
0
def get_vs_flexible_notifications():
    # Make sure, that list is not trivially false
    def validate_only_services(value, varprefix):
        for s in value:
            if s and s[0] != "!":
                return
        raise MKUserError(varprefix + "_0",
                          _("The list of services will never match"))

    return CascadingDropdown(
        title=_("Notification Method"),
        choices=[
            ("email", _("Plain Text Email (using configured templates)")),
            (
                "flexible",
                _("Flexible Custom Notifications"),
                ListOf(
                    Foldable(
                        Dictionary(
                            optional_keys=[
                                "service_blacklist",
                                "only_hosts",
                                "only_services",
                                "escalation",
                                "match_sl",
                            ],
                            columns=1,
                            elements=[
                                (
                                    "plugin",
                                    DropdownChoice(
                                        title=_("Notification Plugin"),
                                        choices=notification_script_choices,
                                        default_value="mail",
                                    ),
                                ),
                                (
                                    "parameters",
                                    ListOfStrings(
                                        title=_("Plugin Arguments"),
                                        help=
                                        _("You can specify arguments to the notification plugin here. "
                                          "Please refer to the documentation about the plugin for what "
                                          "parameters are allowed or required here."
                                          ),
                                    ),
                                ),
                                (
                                    "disabled",
                                    Checkbox(
                                        title=_("Disabled"),
                                        label=
                                        _("Currently disable this notification"
                                          ),
                                        default_value=False,
                                    ),
                                ),
                                (
                                    "timeperiod",
                                    cmk.gui.watolib.timeperiods.
                                    TimeperiodSelection(
                                        title=_("Timeperiod"),
                                        help=
                                        _("Do only notifiy alerts within this time period"
                                          ),
                                    ),
                                ),
                                (
                                    "escalation",
                                    Tuple(
                                        title=
                                        _("Restrict to n<sup>th</sup> to m<sup>th</sup> notification (escalation)"
                                          ),
                                        orientation="float",
                                        elements=[
                                            Integer(
                                                label=_("from"),
                                                help=
                                                _("Let through notifications counting from this number"
                                                  ),
                                                default_value=1,
                                                minvalue=1,
                                                maxvalue=999999,
                                            ),
                                            Integer(
                                                label=_("to"),
                                                help=
                                                _("Let through notifications counting upto this number"
                                                  ),
                                                default_value=999999,
                                                minvalue=1,
                                                maxvalue=999999,
                                            ),
                                        ],
                                    ),
                                ),
                                (
                                    "match_sl",
                                    Tuple(
                                        title=_("Match service level"),
                                        help=
                                        _("Host or Service must be in the following service level to get notification"
                                          ),
                                        orientation="horizontal",
                                        show_titles=False,
                                        elements=[
                                            DropdownChoice(
                                                label=_("from:"),
                                                choices=cmk.gui.mkeventd.
                                                service_levels,
                                                prefix_values=True,
                                            ),
                                            DropdownChoice(
                                                label=_(" to:"),
                                                choices=cmk.gui.mkeventd.
                                                service_levels,
                                                prefix_values=True,
                                            ),
                                        ],
                                    ),
                                ),
                                (
                                    "host_events",
                                    ListChoice(
                                        title=_("Host Events"),
                                        choices=[
                                            ("d", _("Host goes down")),
                                            ("u", _("Host gets unreachble")),
                                            ("r", _("Host goes up again")),
                                            ("f",
                                             _("Start or end of flapping state"
                                               )),
                                            ("s",
                                             _("Start or end of a scheduled downtime "
                                               )),
                                            ("x",
                                             _("Acknowledgement of host problem"
                                               )),
                                        ],
                                        default_value=[
                                            "d", "u", "r", "f", "s", "x"
                                        ],
                                    ),
                                ),
                                (
                                    "service_events",
                                    ListChoice(
                                        title=_("Service Events"),
                                        choices=[
                                            ("w",
                                             _("Service goes into warning state"
                                               )),
                                            ("u",
                                             _("Service goes into unknown state"
                                               )),
                                            ("c",
                                             _("Service goes into critical state"
                                               )),
                                            ("r", _("Service recovers to OK")),
                                            ("f",
                                             _("Start or end of flapping state"
                                               )),
                                            ("s",
                                             _("Start or end of a scheduled downtime"
                                               )),
                                            ("x",
                                             _("Acknowledgement of service problem"
                                               )),
                                        ],
                                        default_value=[
                                            "w", "c", "u", "r", "f", "s", "x"
                                        ],
                                    ),
                                ),
                                (
                                    "only_hosts",
                                    ListOfStrings(
                                        title=_(
                                            "Limit to the following hosts"),
                                        help=
                                        _("Configure the hosts for this notification. Without prefix, only exact, case sensitive matches, "
                                          "<tt>!</tt> for negation and <tt>~</tt> for regex matches."
                                          ),
                                        orientation="horizontal",
                                        # TODO: Clean this up to use an alternative between TextInput() and RegExp(). Also handle the negation in a different way
                                        valuespec=TextInput(size=20, ),
                                    ),
                                ),
                                (
                                    "only_services",
                                    ListOfStrings(
                                        title=_(
                                            "Limit to the following services"),
                                        help=
                                        _("Configure regular expressions that match the beginning of the service names here. Prefix an "
                                          "entry with <tt>!</tt> in order to <i>exclude</i> that service."
                                          ),
                                        orientation="horizontal",
                                        # TODO: Clean this up to use an alternative between TextInput() and RegExp(). Also handle the negation in a different way
                                        valuespec=TextInput(size=20, ),
                                        validate=validate_only_services,
                                    ),
                                ),
                                (
                                    "service_blacklist",
                                    ListOfStrings(
                                        title=_(
                                            "Blacklist the following services"
                                        ),
                                        help=
                                        _("Configure regular expressions that match the beginning of the service names here."
                                          ),
                                        orientation="horizontal",
                                        valuespec=RegExp(
                                            size=20,
                                            mode=RegExp.prefix,
                                        ),
                                        validate=validate_only_services,
                                    ),
                                ),
                            ],
                        ),
                        title_function=lambda v: _("Notify by: ") +
                        notification_script_title(v["plugin"]),
                    ),
                    title=_("Flexible Custom Notifications"),
                    add_label=_("Add notification"),
                ),
            ),
        ],
    )
Exemplo n.º 5
0
def _parameter_valuespec_rabbitmq_nodes_filedesc():
    return Dictionary(elements=[
        (
            "levels",
            CascadingDropdown(
                title=_("Levels for file descriptor usage"),
                choices=[
                    (
                        "fd_perc",
                        _("Percentual levels for used file descriptors"),
                        Tuple(elements=[
                            Percentage(
                                title=_("Warning at usage of"),
                                default_value=80.0,
                                maxvalue=None,
                            ),
                            Percentage(
                                title=_("Critical at usage of"),
                                default_value=90.0,
                                maxvalue=None,
                            ),
                        ], ),
                    ),
                    (
                        "fd_abs",
                        _("Absolut level for total number of used file descriptors"
                          ),
                        Tuple(elements=[
                            Integer(title=_("Warning at"), unit="descriptors"),
                            Integer(title=_("Critical at"),
                                    unit="descriptors"),
                        ], ),
                    ),
                ],
            ),
        ),
        (
            "fd_open_upper",
            Tuple(
                title=_("Upper level for file descriptor open attempts"),
                elements=[
                    Integer(title=_("Warning at"), unit="open attempts"),
                    Integer(title=_("Critical at"), unit="open attempts"),
                ],
            ),
        ),
        (
            "fd_open_rate_upper",
            Tuple(
                title=_("Upper level for file descriptor open attempts rate"),
                elements=[
                    Float(title=_("Warning at"), unit="1/s"),
                    Float(title=_("Critical at"), unit="1/s"),
                ],
            ),
        ),
        (
            "fd_open_rate_lower",
            Tuple(
                title=_("Lower level for file descriptor open attempts rate"),
                elements=[
                    Float(title=_("Warning below"), unit="1/s"),
                    Float(title=_("Critical below"), unit="1/s"),
                ],
            ),
        ),
    ], )
Exemplo n.º 6
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,
        )
Exemplo n.º 7
0
def _parameter_valuespec_oracle_tablespaces():
    return Dictionary(
        help=_(
            "A tablespace is a container for segments (tables, indexes, etc). A "
            "database consists of one or more tablespaces, each made up of one or "
            "more data files. Tables and indexes are created within a particular "
            "tablespace. "
            "This rule allows you to define checks on the size of tablespaces."
        ),
        elements=db_levels_common()
        + [
            (
                "autoextend",
                DropdownChoice(
                    title=_("Expected autoextend setting"),
                    choices=[
                        (True, _("Autoextend is expected to be ON")),
                        (False, _("Autoextend is expected to be OFF")),
                        (None, _("Autoextend will be ignored")),
                    ],
                ),
            ),
            (
                "autoextend_severity",
                MonitoringState(
                    title=_("Severity of invalid autoextend setting"),
                    default_value=2,
                ),
            ),
            (
                "defaultincrement",
                DropdownChoice(
                    title=_("Default Increment"),
                    choices=[
                        (True, _("State is WARNING in case the next extent has the default size.")),
                        (False, _("Ignore default increment")),
                    ],
                ),
            ),
            (
                "map_file_online_states",
                ListOf(
                    Tuple(
                        orientation="horizontal",
                        elements=[
                            DropdownChoice(
                                choices=[
                                    ("RECOVER", _("Recover")),
                                    ("OFFLINE", _("Offline")),
                                ],
                            ),
                            MonitoringState(),
                        ],
                    ),
                    title=_("Map file online states"),
                ),
            ),
            (
                "temptablespace",
                DropdownChoice(
                    title=_("Monitor temporary Tablespace"),
                    choices=[
                        (False, _("Ignore temporary Tablespaces (Default)")),
                        (True, _("Apply rule to temporary Tablespaces")),
                    ],
                ),
            ),
        ],
    )
Exemplo n.º 8
0
from cmk.gui.i18n import _
from cmk.gui.plugins.wato.utils import (
    CheckParameterRulespecWithItem,
    ManualCheckParameterRulespec,
    rulespec_registry,
    RulespecGroupCheckParametersApplications,
    RulespecGroupEnforcedServicesApplications,
)
from cmk.gui.valuespec import Dictionary, DropdownChoice, TextInput, Transform

rulespec_registry.register(
    ManualCheckParameterRulespec(
        check_group_name="local",
        group=RulespecGroupEnforcedServicesApplications,
        item_spec=lambda: TextInput(title=_("Name of local item")),
        parameter_valuespec=lambda: Transform(Dictionary(elements=[]),
                                              forth=lambda p: {}),
        title=lambda: _("Local checks"),
    ))

# We only need the above, there are no "true" parameters to this check plugin.


def _deprecation_message() -> str:
    return _(
        'This ruleset is deprecated. Please use the ruleset <i>"%s"</i> instead.'
    ) % _("Aggregation options for clustered services")


def _parameter_valuespec_local():
    return Dictionary(elements=[
Exemplo n.º 9
0
def _parameter_valuespec_cisco_ip_sla():
    return Dictionary(elements=[
        ("rtt_type",
         DropdownChoice(
             title=_("RTT type"),
             choices=[
                 ('echo', _("echo")),
                 ('path echo', _("path echo")),
                 ('file IO', _("file IO")),
                 ('UDP echo', _("UDP echo")),
                 ('TCP connect', _("TCP connect")),
                 ('HTTP', _("HTTP")),
                 ('DNS', _("DNS")),
                 ('jitter', _("jitter")),
                 ('DLSw', _("DLSw")),
                 ('DHCP', _("DHCP")),
                 ('FTP', _("FTP")),
                 ('VoIP', _("VoIP")),
                 ('RTP', _("RTP")),
                 ('LSP group', _("LSP group")),
                 ('ICMP jitter', _("ICMP jitter")),
                 ('LSP ping', _("LSP ping")),
                 ('LSP trace', _("LSP trace")),
                 ('ethernet ping', _("ethernet ping")),
                 ('ethernet jitter', _("ethernet jitter")),
                 ('LSP ping pseudowire', _("LSP ping pseudowire")),
             ],
             default_value="echo",
         )),
        ("threshold",
         Integer(
             title=_("Treshold"),
             help=_("Depending on the precision the unit can be "
                    "either milliseconds or micoseconds."),
             unit=_("ms/us"),
             minvalue=1,
             default_value=5000,
         )),
        ("state",
         DropdownChoice(
             title=_("State"),
             choices=[
                 ('active', _("active")),
                 ('inactive', _("inactive")),
                 ('reset', _("reset")),
                 ('orderly stop', _("orderly stop")),
                 ('immediate stop', _("immediate stop")),
                 ('pending', _("pending")),
                 ('restart', _("restart")),
             ],
             default_value="active",
         )),
        ("connection_lost_occured",
         DropdownChoice(
             title=_("Connection lost occured"),
             choices=[
                 ("yes", _("yes")),
                 ("no", _("no")),
             ],
             default_value="no",
         )),
        ("timeout_occured",
         DropdownChoice(
             title=_("Timeout occured"),
             choices=[
                 ("yes", _("yes")),
                 ("no", _("no")),
             ],
             default_value="no",
         )),
        ("completion_time_over_treshold_occured",
         DropdownChoice(
             title=_("Completion time over treshold occured"),
             choices=[
                 ("yes", _("yes")),
                 ("no", _("no")),
             ],
             default_value="no",
         )),
        ("latest_rtt_completion_time",
         Tuple(
             title=_("Latest RTT completion time"),
             help=_("Depending on the precision the unit can be "
                    "either milliseconds or micoseconds."),
             elements=[
                 Integer(
                     title=_("Warning at"),
                     unit=_("ms/us"),
                     minvalue=1,
                     default_value=100,
                 ),
                 Integer(
                     title=_("Critical at"),
                     unit=_("ms/us"),
                     minvalue=1,
                     default_value=200,
                 ),
             ],
         )),
        ("latest_rtt_state",
         DropdownChoice(
             title=_("Latest RTT state"),
             choices=[
                 ('ok', _("OK")),
                 ('disconnected', _("disconnected")),
                 ('over treshold', _("over treshold")),
                 ('timeout', _("timeout")),
                 ('other', _("other")),
             ],
             default_value="ok",
         )),
    ], )
Exemplo n.º 10
0
def _parameter_valuespec_azure_storageaccounts():
    return Dictionary(elements=[
        ('ingress_levels',
         Tuple(
             title=_("Levels on ingress data in bytes"),
             elements=[
                 Float(title=_("Warning at"), unit="B"),
                 Float(title=_("Critical at"), unit="B"),
             ],
         )),
        ('egress_levels',
         Tuple(
             title=_("Levels on egress data in bytes"),
             elements=[
                 Float(title=_("Warning at"), unit="B"),
                 Float(title=_("Critical at"), unit="B"),
             ],
         )),
        ('used_capacity_levels',
         Tuple(
             title=_("Levels on used capacity in bytes"),
             elements=[
                 Float(title=_("Warning at"), unit="B"),
                 Float(title=_("Critical at"), unit="B"),
             ],
         )),
        ('server_latency_levels',
         Tuple(
             title=_("Levels on server latency in seconds"),
             help=
             _("Average latency used by Azure Storage to process a successful request"
               ),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ('e2e_latency_levels',
         Tuple(
             title=_("Levels on end-to-end latency in seconds"),
             help=
             _("Average end-to-end latency of successful requests made to a storage service"
               ),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ('transactions_levels',
         Tuple(
             title=_("Levels on transaction count"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ('availability_levels',
         Tuple(
             title=_("Levels on availability in percent"),
             elements=[
                 Float(title=_("Warning at"), unit="%"),
                 Float(title=_("Critical at"), unit="%"),
             ],
         )),
    ], )
Exemplo n.º 11
0
def _valuespec_active_checks_sql() -> Dictionary:
    return Dictionary(
        title=_("Check SQL Database"),
        help=
        _("This check connects to the specified database, sends a custom SQL-statement "
          "or starts a procedure, and checks that the result has a defined format "
          "containing three columns, a number, a text, and performance data. Upper or "
          "lower levels may be defined here.  If they are not defined the number is taken "
          "as the state of the check.  If a procedure is used, input parameters of the "
          "procedures may by given as comma separated list. "
          "This check uses the active check <tt>check_sql</tt>."),
        optional_keys=[
            "levels", "levels_low", "perfdata", "port", "procedure", "text",
            "host"
        ],
        elements=[
            (
                "description",
                TextInput(
                    title=_("Service Description"),
                    help=_("The name of this active service to be displayed."),
                    allow_empty=False,
                ),
            ),
            (
                "dbms",
                DropdownChoice(
                    title=_("Type of Database"),
                    choices=[
                        ("mysql", _("MySQL")),
                        ("postgres", _("PostgreSQL")),
                        ("mssql", _("MSSQL")),
                        ("oracle", _("Oracle")),
                        ("db2", _("DB2")),
                    ],
                    default_value="postgres",
                ),
            ),
            (
                "port",
                Integer(
                    title=_("Database Port"),
                    help=_("The port the DBMS listens to"),
                ),
            ),
            (
                "name",
                TextInput(
                    title=_("Database Name"),
                    help=_("The name of the database on the DBMS"),
                    allow_empty=False,
                ),
            ),
            (
                "user",
                TextInput(
                    title=_("Database User"),
                    help=_("The username used to connect to the database"),
                    allow_empty=False,
                ),
            ),
            (
                "password",
                IndividualOrStoredPassword(
                    title=_("Database Password"),
                    help=_("The password used to connect to the database"),
                    allow_empty=False,
                ),
            ),
            (
                "sql",
                Transform(
                    valuespec=TextAreaUnicode(
                        title=_("Query or SQL statement"),
                        help=
                        _("The SQL-statement or procedure name which is executed on the DBMS. It must return "
                          "a result table with one row and at least two columns. The first column must be "
                          "an integer and is interpreted as the state (0 is OK, 1 is WARN, 2 is CRIT). "
                          "Alternatively the first column can be interpreted as number value and you can "
                          "define levels for this number. The "
                          "second column is used as check output. The third column is optional and can "
                          "contain performance data."),
                        allow_empty=False,
                        monospaced=True,
                    ),
                    # Former Alternative(Text, Alternative(FileUpload, Text)) based implementation
                    # would save a string or a tuple with a string or a binary array as third element
                    # which would then be turned into a string.
                    # Just make all this a string
                    forth=lambda old_val: [
                        elem.decode() if isinstance(elem, bytes) else str(elem)
                        for elem in
                        ((old_val[-1]
                          if isinstance(old_val, tuple) else old_val), )
                    ][0],
                ),
            ),
            (
                "procedure",
                Dictionary(
                    optional_keys=["input"],
                    title=_("Use procedure call instead of SQL statement"),
                    help=_(
                        "If you activate this option, a name of a stored "
                        "procedure is used instead of an SQL statement. "
                        "The procedure should return one output variable, "
                        "which is evaluated in the check. If input parameters "
                        "are required, they may be specified below."),
                    elements=[
                        (
                            "useprocs",
                            FixedValue(
                                value=True,
                                totext=_("procedure call is used"),
                            ),
                        ),
                        (
                            "input",
                            TextInput(
                                title=_("Input Parameters"),
                                allow_empty=True,
                                help=
                                _("Input parameters, if required by the database procedure. "
                                  "If several parameters are required, use commas to separate them."
                                  ),
                            ),
                        ),
                    ],
                ),
            ),
            (
                "levels",
                Tuple(
                    title=_("Upper levels for first output item"),
                    elements=[
                        Float(title=_("Warning at")),
                        Float(title=_("Critical at"))
                    ],
                ),
            ),
            (
                "levels_low",
                Tuple(
                    title=_("Lower levels for first output item"),
                    elements=[
                        Float(title=_("Warning below")),
                        Float(title=_("Critical below"))
                    ],
                ),
            ),
            (
                "perfdata",
                Transform(
                    TextInput(
                        title=_("Performance Data"),
                        help=
                        _("Store output value into RRD database in a metric with this name."
                          ),
                        default_value="performance_data",
                        allow_empty=False,
                    ),
                    forth=transform_check_sql_perfdata,
                ),
            ),
            (
                "text",
                TextInput(
                    title=_("Prefix text"),
                    help=_("Additional text prefixed to the output"),
                    allow_empty=False,
                ),
            ),
            (
                "host",
                TextInput(
                    title=_("DNS hostname or IP address"),
                    help=
                    _("This defaults to the host for which the active check is configured."
                      ),
                ),
            ),
        ],
    )
Exemplo n.º 12
0
def _parameter_valuespec_ddn_s2a_port_errors():
    return Dictionary(elements=[
        ("link_failure_errs",
         Tuple(
             title=_(u"Link failure errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("lost_sync_errs",
         Tuple(
             title=_(u"Lost synchronization errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("loss_of_signal_errs",
         Tuple(
             title=_(u"Loss of signal errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("prim_seq_errs",
         Tuple(
             title=_(u"PrimSeq erros"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("crc_errs",
         Tuple(
             title=_(u"CRC errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("receive_errs",
         Tuple(
             title=_(u"Receive errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("ctio_timeouts",
         Tuple(
             title=_(u"CTIO timeouts"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("ctio_xmit_errs",
         Tuple(
             title=_(u"CTIO transmission errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
        ("ctio_other_errs",
         Tuple(
             title=_(u"other CTIO errors"),
             elements=[
                 Integer(title=_(u"Warning at")),
                 Integer(title=_(u"Critical at")),
             ],
         )),
    ], )
Exemplo n.º 13
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),
                    ),
                ],
            ),
        ),
    ],)
Exemplo n.º 14
0
def _valuespec_inv_domino_tasks_rules():
    return Transform(
        valuespec=Dictionary(
            title=_("Lotus Domino task discovery"),
            help=_(
                "This rule controls the discovery of tasks on Lotus Domino systems. "
                "Any changes later on require a host re-discovery"),
            elements=[
                (
                    "descr",
                    TextInput(
                        title=_("Service Description"),
                        allow_empty=False,
                        help=
                        _("<p>The service description may contain one or more occurances of <tt>%s</tt>. In this "
                          "case, the pattern must be a regular expression prefixed with ~. For each "
                          '<tt>%s</tt> in the description, the expression has to contain one "group". A group '
                          "is a subexpression enclosed in brackets, for example <tt>(.*)</tt> or "
                          "<tt>([a-zA-Z]+)</tt> or <tt>(...)</tt>. When the inventory finds a task "
                          "matching the pattern, it will substitute all such groups with the actual values when "
                          "creating the check. In this way one rule can create several checks on a host.</p>"
                          "<p>If the pattern contains more groups than occurrences of <tt>%s</tt> in the service "
                          "description, only the first matching subexpressions are used for the service "
                          "descriptions. The matched substrings corresponding to the remaining groups "
                          "are nevertheless copied into the regular expression.</p>"
                          "<p>As an alternative to <tt>%s</tt> you may also use <tt>%1</tt>, <tt>%2</tt>, etc. "
                          "These expressions will be replaced by the first, second, ... matching group, allowing "
                          "you to reorder things.</p>"),
                    ),
                ),
                (
                    "match",
                    Alternative(
                        title=_("Task Matching"),
                        elements=[
                            TextInput(
                                title=_("Exact name of the task"),
                                size=50,
                            ),
                            Transform(
                                valuespec=RegExp(
                                    size=50,
                                    mode=RegExp.prefix,
                                ),
                                title=_(
                                    "Regular expression matching command line"
                                ),
                                help=
                                _("This regex must match the <i>beginning</i> of the task"
                                  ),
                                forth=lambda x: x[1:],  # remove ~
                                back=lambda x: "~" + x,  # prefix ~
                            ),
                            FixedValue(
                                value=None,
                                totext="",
                                title=_("Match all tasks"),
                            ),
                        ],
                        match=lambda x:
                        (not x and 2) or (x[0] == "~" and 1 or 0),
                        default_value="foo",
                    ),
                ),
                (
                    "default_params",
                    Dictionary(
                        title=_("Check parameters"),
                        elements=[
                            (
                                "levels",
                                _vs_levels(
                                    _("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.")),
                            ),
                        ],
                        optional_keys=False,
                    ),
                ),
            ],
            optional_keys=False,
        ),
        forth=_transform_inv_domino_tasks_rules,
    )
Exemplo n.º 15
0
def _parameter_valuespec_ibm_svc_host():
    return Transform(
        Dictionary(elements=[
            (
                "active_hosts",
                Tuple(
                    title=_("Count of active hosts"),
                    elements=[
                        Integer(title=_("Warning at or below"),
                                minvalue=0,
                                unit=_("active hosts")),
                        Integer(title=_("Critical at or below"),
                                minvalue=0,
                                unit=_("active hosts")),
                    ],
                ),
            ),
            (
                "inactive_hosts",
                Tuple(
                    title=_("Count of inactive hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("inactive hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("inactive hosts")),
                    ],
                ),
            ),
            (
                "degraded_hosts",
                Tuple(
                    title=_("Count of degraded hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("degraded hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("degraded hosts")),
                    ],
                ),
            ),
            (
                "offline_hosts",
                Tuple(
                    title=_("Count of offline hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("offline hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("offline hosts")),
                    ],
                ),
            ),
            (
                "other_hosts",
                Tuple(
                    title=_("Count of other hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("other hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("other hosts")),
                    ],
                ),
            ),
        ], ),
        forth=transform_ibm_svc_host,
    )
Exemplo n.º 16
0
def _parameter_valuespec_jenkins_nodes():
    return Dictionary(
        elements=[
            ("jenkins_offline", MonitoringState(title=_("Node state: Offline"), default_value=2)),
            (
                "jenkins_mode",
                DropdownChoice(
                    title=_("Expected mode state."),
                    help=_(
                        "Choose between Normal (Utilize this node as much "
                        "as possible) and Exclusive (Only build jobs with label "
                        "restrictions matching this node). The state will "
                        "change to warning state, if the mode differs."
                    ),
                    choices=[
                        ("NORMAL", _("Normal")),
                        ("EXCLUSIVE", _("Exclusive")),
                    ],
                    default_value="NORMAL",
                ),
            ),
            (
                "jenkins_numexecutors",
                Tuple(
                    title=_("Lower level for number of executors of this node"),
                    elements=[
                        Integer(title=_("Warning below")),
                        Integer(title=_("Critical below")),
                    ],
                ),
            ),
            (
                "jenkins_busyexecutors",
                Tuple(
                    title=_("Upper level for number of busy executors of this node"),
                    elements=[
                        Integer(title=_("Warning at")),
                        Integer(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "jenkins_idleexecutors",
                Tuple(
                    title=_("Upper level for number of idle executors of this node"),
                    elements=[
                        Integer(title=_("Warning at")),
                        Integer(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "avg_response_time",
                Tuple(
                    title=_("Average round-trip response time to this node"),
                    elements=[
                        Age(title=_("Warning at")),
                        Age(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "jenkins_clock",
                Tuple(
                    title=_("Clock difference"),
                    elements=[
                        Age(title=_("Warning at")),
                        Age(title=_("Critical at")),
                    ],
                ),
            ),
            (
                "jenkins_temp",
                Tuple(
                    title=_("Absolute levels for free temp space"),
                    elements=[
                        Integer(
                            title=_("Warning if below"),
                            unit=_("MB"),
                            minvalue=0,
                        ),
                        Integer(
                            title=_("Critical if below"),
                            unit=_("MB"),
                            minvalue=0,
                        ),
                    ],
                ),
            ),
        ],
    )
Exemplo n.º 17
0
def _parameter_valuespec_graylog_messages():
    return Dictionary(elements=[
        (
            "msgs_upper",
            Tuple(
                title=_("Total message count upper levels"),
                elements=[
                    Integer(title=_("Warning at")),
                    Integer(title=_("Critical at")),
                ],
            ),
        ),
        (
            "msgs_lower",
            Tuple(
                title=_("Total message count lower levels"),
                elements=[
                    Integer(title=_("Warning if below")),
                    Integer(title=_("Critical if below")),
                ],
            ),
        ),
        (
            "msgs_avg",
            Integer(
                title=_("Message averaging"),
                help=
                _("By activating averaging, Check_MK will compute the average of "
                  "the message count over a given interval. If you define "
                  "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=30,
            ),
        ),
        (
            "msgs_avg_upper",
            Tuple(
                title=_("Average message count upper levels"),
                elements=[
                    Integer(title=_("Warning at")),
                    Integer(title=_("Critical at")),
                ],
            ),
        ),
        (
            "msgs_avg_lower",
            Tuple(
                title=_("Average message count lower levels"),
                elements=[
                    Integer(title=_("Warning if below")),
                    Integer(title=_("Critical if below")),
                ],
            ),
        ),
        (
            "msgs_diff",
            Age(
                title=_(
                    "Timespan for difference calculation of total number of "
                    "messages"),
                display=["days", "hours", "minutes"],
                default_value=1800,
            ),
        ),
        (
            "msgs_diff_lower",
            Tuple(
                title=_("Number of messages in defined timespan lower level"),
                elements=[
                    Integer(title=_("Warning below"), unit="messages"),
                    Integer(title=_("Critical below"), unit="messages"),
                ],
            ),
        ),
        (
            "msgs_diff_upper",
            Tuple(
                title=_("Number of messages in defined timespan upper level"),
                elements=[
                    Integer(title=_("Warning at"), unit="messages"),
                    Integer(title=_("Critical at"), unit="messages"),
                ],
            ),
        ),
    ], )
Exemplo n.º 18
0
def _valuespec_special_agents_cisco_prime():
    return Dictionary(
        elements=[
            (
                "host",
                CascadingDropdown(
                    choices=[
                        ("ip_address", _("IP Address")),
                        ("host_name", _("Host name")),
                        (
                            "custom",
                            _("Custom Host"),
                            Dictionary(
                                elements=[(
                                    "host",
                                    TextInput(
                                        title=_("Custom Host"),
                                        allow_empty=False,
                                    ),
                                )],
                                optional_keys=[],
                            ),
                        ),
                    ],
                    default_value="ip_address",
                    title=_("Host to use for connecting to Cisco Prime"),
                ),
            ),
            (
                "basicauth",
                Tuple(
                    title=_("BasicAuth settings (optional)"),
                    help=_(
                        "The credentials for api calls with authentication."),
                    elements=[
                        TextInput(title=_("Username"), allow_empty=False),
                        PasswordFromStore(title=_("Password of the user"),
                                          allow_empty=False),
                    ],
                ),
            ),
            ("port", Integer(title=_("Port"), default_value=8080)),
            (
                "no-tls",
                FixedValue(
                    value=True,
                    title=_("Don't use TLS/SSL/Https (unsecure)"),
                    totext=_("TLS/SSL/Https disabled"),
                ),
            ),
            (
                "no-cert-check",
                FixedValue(
                    value=True,
                    title=_("Disable SSL certificate validation"),
                    totext=_("SSL certificate validation is disabled"),
                ),
            ),
            (
                "timeout",
                Integer(
                    title=_("Connect Timeout"),
                    help=_("The network timeout in seconds"),
                    default_value=60,
                    minvalue=1,
                    unit=_("seconds"),
                ),
            ),
        ],
        title=_("Cisco Prime"),
    )
Exemplo n.º 19
0
agent_config_dict_dirs = Dictionary(
    title=_("Change <b>default directories</b>"),
    help=_("This settings allow to override paths where Robotmk stores files. "),
    elements=[
        ("robotdir", TextUnicode(
            help=_(
                "Defines where the Robotmk plugin will search for <b>Robot suites</b>. By default this is:<br>"
                " - <tt>/usr/lib/check_mk_agent/robot</tt> (Linux)<br>"
                " - <tt>C:\\ProgramData\\checkmk\\agent\\robot</tt> (Windows) <br>"
                "Windows paths can be given with single backslashes; OS dependent path validation is made during the agent baking.<br>"
            ),
            title=_("Robot suites directory (<tt>robotdir</tt>)"),
            allow_empty=False,
            size=100,
            default_value=""
            )
        ),
        ("outputdir", TextUnicode(
            help=_(
                "Defines where Robot Framework <b>XML/HTML</b> and the <b>Robotmk JSON state files</b> will be stored. By default this is:<br>"                
                " - <tt>/var/log/robotmk</tt> (Linux)<br>"
                " - <tt>C:\\ProgramData\\checkmk\\agent\\log\\robotmk</tt> (Windows) <br>"
                "Windows paths can be given with single backslashes; OS dependent path validation is made during the agent baking.<br>"
            ),
            title=_("Output directory"),
            allow_empty=False,
            size=100,
            default_value=""
            )
        ),
        ("logdir", TextUnicode(
            help=_(
                "Defines where Robotmk <b>controller/runner execution log files</b> will be written to. By default this is:<br>"
                " - <tt>/var/log/robotmk</tt> (Linux)<br>"
                " - <tt>C:\\ProgramData\\checkmk\\agent\\log\\robotmk</tt> (Windows) <br>"
                "Windows paths can be given with single backslashes; OS dependent path validation is made during the agent baking.<br>"
            ),
            title=_("Log directory"),
            allow_empty=False,
            size=100,
            default_value=""
            )
        ),
    ])
Exemplo n.º 20
0
def _parameter_valuespec_mssql_tablespaces():
    return Dictionary(elements=[
        ("size",
         Tuple(
             title=_("Upper levels for size"),
             elements=[Filesize(title=_("Warning at")),
                       Filesize(title=_("Critical at"))],
         )),
        ("reserved",
         Alternative(
             title=_("Upper levels for reserved space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[Filesize(title=_("Warning at")),
                               Filesize(title=_("Critical at"))],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("data",
         Alternative(
             title=_("Upper levels for data"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[Filesize(title=_("Warning at")),
                               Filesize(title=_("Critical at"))],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("indexes",
         Alternative(
             title=_("Upper levels for indexes"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[Filesize(title=_("Warning at")),
                               Filesize(title=_("Critical at"))],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("unused",
         Alternative(
             title=_("Upper levels for unused space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[Filesize(title=_("Warning at")),
                               Filesize(title=_("Critical at"))],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("unallocated",
         Alternative(
             title=_("Lower levels for unallocated space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning below")),
                         Filesize(title=_("Critical below"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning below")),
                         Percentage(title=_("Critical below"))
                     ],
                 ),
             ],
         )),
    ],)
Exemplo n.º 21
0
def _parameter_valuespec_diskstat():
    return Dictionary(
        help=
        _("With this rule you can set limits for various disk IO statistics. "
          "Keep in mind that not all of these settings may be applicable for the actual "
          "check. For example, if the check doesn't provide a <i>Read wait</i> information in its "
          "output, any configuration setting referring to <i>Read wait</i> will have no effect."
          ),
        elements=[
            (
                "read",
                Levels(
                    title=_("Read throughput"),
                    unit=_("MB/s"),
                    default_levels=(50.0, 100.0),
                ),
            ),
            (
                "write",
                Levels(
                    title=_("Write throughput"),
                    unit=_("MB/s"),
                    default_levels=(50.0, 100.0),
                ),
            ),
            (
                "utilization",
                Levels(
                    title=_("Disk Utilization"),
                    unit=_("%"),
                    default_levels=(80.0, 90.0),
                ),
            ),
            (
                "latency",
                Levels(
                    title=_("Disk Latency"),
                    unit=_("ms"),
                    default_levels=(80.0, 160.0),
                ),
            ),
            (
                "read_latency",
                Levels(
                    title=_("Disk Read Latency"),
                    unit=_("ms"),
                    default_levels=(80.0, 160.0),
                ),
            ),
            (
                "write_latency",
                Levels(
                    title=_("Disk Write Latency"),
                    unit=_("ms"),
                    default_levels=(80.0, 160.0),
                ),
            ),
            ("read_wait",
             Levels(title=_("Read wait"),
                    unit=_("ms"),
                    default_levels=(30.0, 50.0))),
            (
                "write_wait",
                Levels(title=_("Write wait"),
                       unit=_("ms"),
                       default_levels=(30.0, 50.0)),
            ),
            (
                "average",
                Age(
                    title=_("Averaging"),
                    help=
                    _("When averaging is set, then all of the disk's metrics are averaged "
                      "over the selected interval - rather then the check interval. This allows "
                      "you to make your monitoring less reactive to short peaks. But it will also "
                      "introduce a loss of accuracy in your graphs. "),
                    default_value=300,
                ),
            ),
            (
                "read_ios",
                Levels(title=_("Read operations"),
                       unit=_("1/s"),
                       default_levels=(400.0, 600.0)),
            ),
            (
                "write_ios",
                Levels(title=_("Write operations"),
                       unit=_("1/s"),
                       default_levels=(300.0, 400.0)),
            ),
        ],
    )
Exemplo n.º 22
0
def _parameter_valuespec_brocade_fcport():
    return Dictionary(elements=[
        ("bw",
         Alternative(
             title=_("Throughput levels"),
             help=
             _("Please note: in a few cases the automatic detection of the link speed "
               "does not work. In these cases you have to set the link speed manually "
               "below if you want to monitor percentage values"),
             elements=[
                 Tuple(title=_(
                     "Used bandwidth of port relative to the link speed"),
                       elements=[
                           Percentage(title=_("Warning at"),
                                      unit=_("percent")),
                           Percentage(title=_("Critical at"),
                                      unit=_("percent")),
                       ]),
                 Tuple(title=_("Used Bandwidth of port in megabyte/s"),
                       elements=[
                           Integer(title=_("Warning at"), unit=_("MByte/s")),
                           Integer(title=_("Critical at"), unit=_("MByte/s")),
                       ])
             ])),
        ("assumed_speed",
         Float(title=_("Assumed link speed"),
               help=_("If the automatic detection of the link speed does "
                      "not work you can set the link speed here."),
               unit=_("GByte/s"))),
        ("rxcrcs",
         Tuple(title=_("CRC errors rate"),
               elements=[
                   Percentage(title=_("Warning at"), unit=_("percent")),
                   Percentage(title=_("Critical at"), unit=_("percent")),
               ])),
        ("rxencoutframes",
         Tuple(title=_("Enc-Out frames rate"),
               elements=[
                   Percentage(title=_("Warning at"), unit=_("percent")),
                   Percentage(title=_("Critical at"), unit=_("percent")),
               ])),
        ("rxencinframes",
         Tuple(title=_("Enc-In frames rate"),
               elements=[
                   Percentage(title=_("Warning at"), unit=_("percent")),
                   Percentage(title=_("Critical at"), unit=_("percent")),
               ])),
        ("notxcredits",
         Tuple(title=_("No-TxCredits errors"),
               elements=[
                   Percentage(title=_("Warning at"), unit=_("percent")),
                   Percentage(title=_("Critical at"), unit=_("percent")),
               ])),
        ("c3discards",
         Tuple(title=_("C3 discards"),
               elements=[
                   Percentage(title=_("Warning at"), unit=_("percent")),
                   Percentage(title=_("Critical at"), unit=_("percent")),
               ])),
        ("average",
         Integer(
             title=_("Averaging"),
             help=_(
                 "If this parameter is set, all throughputs 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,
         )),
        ("phystate",
         Optional(
             ListChoice(
                 title=_("Allowed states (otherwise check will be critical)"),
                 choices=[
                     (1, _("noCard")),
                     (2, _("noTransceiver")),
                     (3, _("laserFault")),
                     (4, _("noLight")),
                     (5, _("noSync")),
                     (6, _("inSync")),
                     (7, _("portFault")),
                     (8, _("diagFault")),
                     (9, _("lockRef")),
                 ]),
             title=_("Physical state of port"),
             negate=True,
             label=_("ignore physical state"),
         )),
        ("opstate",
         Optional(
             ListChoice(
                 title=_("Allowed states (otherwise check will be critical)"),
                 choices=[
                     (0, _("unknown")),
                     (1, _("online")),
                     (2, _("offline")),
                     (3, _("testing")),
                     (4, _("faulty")),
                 ]),
             title=_("Operational state"),
             negate=True,
             label=_("ignore operational state"),
         )),
        ("admstate",
         Optional(
             ListChoice(
                 title=_("Allowed states (otherwise check will be critical)"),
                 choices=[
                     (1, _("online")),
                     (2, _("offline")),
                     (3, _("testing")),
                     (4, _("faulty")),
                 ]),
             title=_("Administrative state"),
             negate=True,
             label=_("ignore administrative state"),
         )),
    ], )
Exemplo n.º 23
0
def _parameter_valuespec_jenkins_jobs():
    return Dictionary(elements=[
        ("jenkins_job_score",
         Tuple(
             title=_("Job score"),
             elements=[
                 Integer(title=_("Warning below"), unit="%"),
                 Integer(title=_("Critical below"), unit="%"),
             ],
         )),
        ("jenkins_last_build",
         Tuple(
             title=_("Time since last build"),
             elements=[
                 Age(title=_("Warning if older than")),
                 Age(title=_("Critical if older than")),
             ],
         )),
        ("jenkins_time_since",
         Tuple(
             title=_("Time since last successful build"),
             elements=[
                 Age(title=_("Warning if older than")),
                 Age(title=_("Critical if older than")),
             ],
         )),
        ('jenkins_build_duration',
         Tuple(
             title=_("Duration of last build"),
             elements=[
                 Age(title=_("Warning at")),
                 Age(title=_("Critical at")),
             ],
         )),
        ("job_state",
         Dictionary(
             title=_('Override check state based on job state'),
             elements=[
                 ("aborted",
                  MonitoringState(title=_("State when job is in state aborted"), default_value=0)),
                 ("blue",
                  MonitoringState(title=_("State when job is in state success"), default_value=0)),
                 ("disabled",
                  MonitoringState(title=_("State when job is in state disabled"), default_value=0)),
                 ("notbuilt",
                  MonitoringState(title=_("State when job is in state not built"),
                                  default_value=0)),
                 ("red",
                  MonitoringState(title=_("State when job is in state failed"), default_value=2)),
                 ("yellow",
                  MonitoringState(title=_("State when job is in state unstable"), default_value=1)),
             ],
         )),
        ("build_result",
         Dictionary(
             title=_('Override check state based on last build result'),
             elements=[
                 ("success",
                  MonitoringState(title=_("State when last build result is: success"),
                                  default_value=0)),
                 ("unstable",
                  MonitoringState(title=_("State when last build result is: unstable"),
                                  default_value=1)),
                 ("failure",
                  MonitoringState(title=_("State when last build result is: failed"),
                                  default_value=2)),
                 ("aborted",
                  MonitoringState(title=_("State when last build result is: aborted"),
                                  default_value=0)),
                 ("null",
                  MonitoringState(title=_("State when last build result is: module not built"),
                                  default_value=1)),
                 ("none",
                  MonitoringState(title=_("State when build result is: running"), default_value=0)),
             ],
         )),
    ],)
Exemplo n.º 24
0
def _parameter_valuespec_redis_info_clients():
    return Dictionary(elements=[
        ("connected_lower",
         Tuple(
             title=_("Total number of client connections lower level"),
             elements=[
                 Integer(
                     title=_("Warning below"),
                     unit="connections",
                 ),
                 Integer(
                     title=_("Critical below"),
                     unit="connections",
                 ),
             ],
         )),
        ("connected_upper",
         Tuple(
             title=_("Total number of client connections upper level"),
             elements=[
                 Integer(
                     title=_("Warning at"),
                     unit="connections",
                 ),
                 Integer(
                     title=_("Critical at"),
                     unit="connections",
                 ),
             ],
         )),
        ("output_lower",
         Tuple(
             title=_("Longest output list lower level"),
             elements=[
                 Integer(title=_("Warning below")),
                 Integer(title=_("Critical below")),
             ],
         )),
        ("output_upper",
         Tuple(
             title=_("Longest output list upper level"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("input_lower",
         Tuple(
             title=_("Biggest input buffer lower level"),
             elements=[
                 Integer(title=_("Warning below"), unit="issues"),
                 Integer(title=_("Critical below"), unit="íssues"),
             ],
         )),
        ("input_upper",
         Tuple(
             title=_("Biggest input buffer upper level"),
             elements=[
                 Integer(title=_("Warning at")),
                 Integer(title=_("Critical at")),
             ],
         )),
        ("blocked_lower",
         Tuple(
             title=
             _("Total number of clients pending on a blocking call lower level"
               ),
             elements=[
                 Integer(
                     title=_("Warning below"),
                     unit="clients",
                 ),
                 Integer(
                     title=_("Critical below"),
                     unit="clients",
                 ),
             ],
         )),
        ("blocked_upper",
         Tuple(
             title=
             _("Total number of clients pending on a blocking call upper level"
               ),
             elements=[
                 Integer(
                     title=_("Warning at"),
                     unit="clients",
                 ),
                 Integer(
                     title=_("Critical at"),
                     unit="clients",
                 ),
             ],
         )),
    ], )
Exemplo n.º 25
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,
                 ),
             ),
         ],
     )
Exemplo n.º 26
0
def _parameter_valuespec_kernel_performance():
    return Dictionary(elements=[
        ("ctxt",
         Levels(
             unit=_("events per second"),
             title=_("Context Switches"),
             default_levels=(1000, 5000),
             default_difference=(500.0, 1000.0),
             default_value=None,
         )),
        ("processes",
         Levels(
             unit=_("events per second"),
             title=_("Process Creations"),
             default_levels=(1000, 5000),
             default_difference=(500.0, 1000.0),
             default_value=None,
         )),
        ("pgmajfault",
         Levels(
             unit=_("events per second"),
             title=_("Major Page Faults"),
             default_levels=(1000, 5000),
             default_difference=(500.0, 1000.0),
             default_value=None,
         )),
        (
            "page_swap_in_levels_lower",
            Tuple(title=_("Swap In Lower"),
                  elements=[
                      Float(title=_("Swap In warning below"),
                            unit=_("events per second")),
                      Float(title=_("Swap In critical below"),
                            unit=_("events per second"))
                  ]),
        ),
        (
            "page_swap_in_levels",
            Tuple(title=_("Swap In Upper"),
                  elements=[
                      Float(title=_("Swap In warning at"),
                            unit=_("events per second")),
                      Float(title=_("Swap In critical at"),
                            unit=_("events per second"))
                  ]),
        ),
        (
            "page_swap_out_levels_lower",
            Tuple(title=_("Swap Out Lower"),
                  elements=[
                      Float(title=_("Swap Out warning below"),
                            unit=_("events per second")),
                      Float(title=_("Swap Out critical below"),
                            unit=_("events per second"))
                  ]),
        ),
        (
            "page_swap_out_levels",
            Tuple(title=_("Swap Out Upper"),
                  elements=[
                      Float(title=_("Swap Out warning at"),
                            unit=_("events per second")),
                      Float(title=_("Swap Out critical at"),
                            unit=_("events per second"))
                  ]),
        ),
    ], )
Exemplo n.º 27
0
def _parameter_valuespec_oracle_dataguard_stats():
    return Dictionary(
        help=_(
            "The Data-Guard statistics are available in Oracle Enterprise Edition with enabled Data-Guard. "
            "The <tt>init.ora</tt> parameter <tt>dg_broker_start</tt> must be <tt>TRUE</tt> for this check. "
            "The apply and transport lag can be configured with this rule."
        ),
        elements=[
            (
                "active_dataguard_option",
                MonitoringState(
                    title=_("State in case of Active Data-Guard Option is active: "),
                    help=_("The Active Data-Guard Option needs an addional License from Oracle."),
                    default_value=1,
                ),
            ),
            (
                "mrp_option",
                Tuple(
                    title=_("State in case Managed Recovery Process (MRP) is started or stopped"),
                    help=_(
                        "The MRP is usally started on each physical "
                        "standby node. But in some setups this may vary and the process should "
                        "only be started on specific or random nodes. Here you may define which "
                        "state a specific node or service should have in case the MRP is started "
                        "or stopped."
                    ),
                    elements=[
                        MonitoringState(title=_("State in case MRP is started"), default_value=0),
                        MonitoringState(title=_("State in case MRP is stopped"), default_value=2),
                    ],
                ),
            ),
            (
                "primary_broker_state",
                Checkbox(
                    title=_("Check State of Broker on Primary: "),
                    default_value=False,
                    help=_(
                        "Data-Guards with dg_broker_start=false needs Ignore Brokerstate to monitor "
                        "the Switchoverstate on Primary."
                    ),
                ),
            ),
            (
                "apply_lag",
                Tuple(
                    title=_("Apply Lag Maximum Time"),
                    help=_("The maximum limit for the apply lag in <tt>v$dataguard_stats</tt>."),
                    elements=[
                        Age(
                            title=_("Warning at"),
                        ),
                        Age(
                            title=_("Critical at"),
                        ),
                    ],
                ),
            ),
            (
                "apply_lag_min",
                Tuple(
                    title=_("Apply Lag Minimum Time"),
                    help=_(
                        "The minimum limit for the apply lag in <tt>v$dataguard_stats</tt>. "
                        "This is only useful if also <i>Apply Lag Maximum Time</i> has been configured."
                    ),
                    elements=[
                        Age(
                            title=_("Warning at"),
                        ),
                        Age(
                            title=_("Critical at"),
                        ),
                    ],
                ),
            ),
            (
                "transport_lag",
                Tuple(
                    title=_("Transport Lag"),
                    help=_("The limit for the transport lag in <tt>v$dataguard_stats</tt>"),
                    elements=[
                        Age(
                            title=_("Warning at"),
                        ),
                        Age(
                            title=_("Critical at"),
                        ),
                    ],
                ),
            ),
        ],
    )
Exemplo n.º 28
0
 def valuespec(self):
     return Dictionary(
         elements=[
             (
                 "start",
                 Alternative(
                     title=_("Started"),
                     elements=[
                         FixedValue(
                             value=None,
                             totext=_("No scan has been started yet."),
                         ),
                         AbsoluteDate(
                             include_time=True,
                             default_value=0,
                         ),
                     ],
                 ),
             ),
             (
                 "end",
                 Alternative(
                     title=_("Finished"),
                     elements=[
                         FixedValue(
                             value=None,
                             totext=_("No scan has finished yet."),
                         ),
                         FixedValue(
                             value=True,
                             totext="",  # currently running
                         ),
                         AbsoluteDate(
                             include_time=True,
                             default_value=0,
                         ),
                     ],
                 ),
             ),
             (
                 "state",
                 Alternative(
                     title=_("State"),
                     elements=[
                         FixedValue(
                             value=None,
                             totext="",  # Not started or currently running
                         ),
                         FixedValue(
                             value=True,
                             totext=_("Succeeded"),
                         ),
                         FixedValue(
                             value=False,
                             totext=_("Failed"),
                         ),
                     ],
                 ),
             ),
             (
                 "output",
                 TextInput(title=_("Output"), ),
             ),
         ],
         title=_("Last Scan Result"),
         optional_keys=[],
         default_text=_("No scan performed yet."),
     )
Exemplo n.º 29
0
def _parameter_valuespec_sshd_config():
    return Dictionary(elements=[
        ("PermitRootLogin",
         Transform(DropdownChoice(
             title=_("Permit root login"),
             choices=[
                 ('yes', _('yes')),
                 ('key-based', _('without-password/prohibit-password (Key based)')),
                 ('forced-commands-only', _('forced-commands-only')),
                 ('no', _('no')),
             ],
             default_value="key-based",
         ),
                   forth=transform_ssh_config)),
        ("Protocol",
         DropdownChoice(
             title=_("Allowed protocols"),
             choices=[
                 ('1', _('Version 1')),
                 ('2', _('Version 2')),
                 ('1,2', _('Version 1 and 2')),
             ],
             default_value="2",
         )),
        ("Port",
         ListOfIntegers(
             title=_("Allowed Ports"),
             minvalue=0,
             maxvalue=65535,
             orientation="horizontal",
             default_value=[22],
         )),
        ("PasswordAuthentication",
         DropdownChoice(
             title=_("Allow password authentication"),
             help=_("Specifies whether password authentication is allowed"),
             choices=[
                 ('yes', _('Yes')),
                 ('no', _('No')),
             ],
             default_value="no",
         )),
        ("PermitEmptyPasswords",
         DropdownChoice(
             title=_("Permit empty passwords"),
             help=_("If password authentication is used this option "
                    "specifies wheter the server allows login to accounts "
                    "with empty passwords"),
             choices=[
                 ('yes', _('Yes')),
                 ('no', _('No')),
             ],
             default_value="no",
         )),
        ("ChallengeResponseAuthentication",
         DropdownChoice(
             title=_("Allow challenge-response authentication"),
             choices=[
                 ('yes', _('Yes')),
                 ('no', _('No')),
             ],
             default_value="no",
         )),
        ("X11Forwarding",
         DropdownChoice(
             title=_("Permit X11 forwarding"),
             choices=[
                 ('yes', _('Yes')),
                 ('no', _('No')),
             ],
             default_value="no",
         )),
        ("UsePAM",
         DropdownChoice(
             title=_("Use pluggable authentication module"),
             choices=[
                 ('yes', _('Yes')),
                 ('no', _('No')),
             ],
             default_value="no",
         )),
        ("Ciphers", ListOfStrings(
            title=_("Allowed Ciphers"),
            orientation="horizontal",
        )),
    ],)
Exemplo n.º 30
0
 def vs_parameters(cls):
     return Dictionary(title=_("Properties"),
                       render="form",
                       optional_keys=False,
                       elements=cls._vs_elements())