Exemple #1
0
def _parameter_valuespec_rabbitmq_vhosts():
    return Dictionary(elements=[
        ("msg_upper",
         Tuple(
             title=_("Upper level for total number of messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_lower",
         Tuple(
             title=_("Lower level for total number of messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_ready_upper",
         Tuple(
             title=_("Upper level for total number of ready messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_ready_lower",
         Tuple(
             title=_("Lower level for total number of ready messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_unack_upper",
         Tuple(
             title=_(
                 "Upper level for total number of unacknowledged messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_unack_lower",
         Tuple(
             title=_(
                 "Lower level for total number of unacknowledged messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_publish_upper",
         Tuple(
             title=_("Upper level for total number of published messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_publish_lower",
         Tuple(
             title=_("Lower level for total number of published messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_publish_rate_upper",
         Tuple(
             title=_("Upper level for published message rate"),
             elements=[
                 Float(title=_("Warning at"), unit="1/s"),
                 Float(title=_("Critical at"), unit="1/s"),
             ],
         )),
        ("msg_publish_rate_lower",
         Tuple(
             title=_("Lower level for published message rate"),
             elements=[
                 Float(title=_("Warning below"), unit="1/s"),
                 Float(title=_("Critical below"), unit="1/s"),
             ],
         )),
        ("msg_deliver_upper",
         Tuple(
             title=_("Upper level for total number of delivered messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_deliver_lower",
         Tuple(
             title=_("Lower level for total number of delivered messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_deliver_rate_upper",
         Tuple(
             title=_("Upper level for delivered message rate"),
             elements=[
                 Float(title=_("Warning at"), unit="1/s"),
                 Float(title=_("Critical at"), unit="1/s"),
             ],
         )),
        ("msg_deliver_rate_lower",
         Tuple(
             title=_("Lower level for delivered message rate"),
             elements=[
                 Float(title=_("Warning below"), unit="1/s"),
                 Float(title=_("Critical below"), unit="1/s"),
             ],
         )),
    ], )
Exemple #2
0
def _parameter_valuespec_ocprot_current():
    return Tuple(elements=[
        Float(title=_("Warning at"), unit=u"A", default_value=14.0),
        Float(title=_("Critical at"), unit=u"A", default_value=15.0),
    ],)
Exemple #3
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"),
                ],
            ),
        ),
    ], )
Exemple #4
0
    def _connection_elements(self):
        connection_elements = [
            ("directory_type",
             CascadingDropdown(
                 title=_("Directory type"),
                 help=
                 _("Select the software the LDAP directory is based on. Depending on "
                   "the selection e.g. the attribute names used in LDAP queries will "
                   "be altered."),
                 choices=[
                     ("ad", _("Active Directory"),
                      self._vs_directory_options("ad")),
                     ("openldap", _("OpenLDAP"),
                      self._vs_directory_options("openldap")),
                     ("389directoryserver", _("389 Directory Server"),
                      self._vs_directory_options("389directoryserver")),
                 ],
             )),
            ("bind",
             Tuple(
                 title=_("Bind credentials"),
                 help=
                 _("Set the credentials to be used to connect to the LDAP server. The "
                   "used account must not be allowed to do any changes in the directory "
                   "the whole connection is read only. "
                   "In some environment an anonymous connect/bind is allowed, in this "
                   "case you don't have to configure anything here."
                   "It must be possible to list all needed user and group objects from the "
                   "directory."),
                 elements=[
                     LDAPDistinguishedName(
                         title=_("Bind DN"),
                         help=
                         _("Specify the distinguished name to be used to bind to "
                           "the LDAP directory, e. g. <tt>CN=ldap,OU=users,DC=example,DC=com</tt>"
                           ),
                         size=63,
                     ),
                     IndividualOrStoredPassword(
                         title=_("Bind password"),
                         help=_("Specify the password to be used to bind to "
                                "the LDAP directory."),
                     ),
                 ],
             )),
            ("port",
             Integer(
                 title=_("TCP port"),
                 help=_("This variable allows to specify the TCP port to "
                        "be used to connect to the LDAP server. "),
                 minvalue=1,
                 maxvalue=65535,
                 default_value=389,
             )),
            ("use_ssl",
             FixedValue(
                 title=_("Use SSL"),
                 help=
                 _("Connect to the LDAP server with a SSL encrypted connection. The "
                   "<a href=\"wato.py?mode=edit_configvar&site=&varname=trusted_certificate_authorities\">trusted "
                   "certificates authorities</a> configured in Check_MK will be used to validate the "
                   "certificate provided by the LDAP server."),
                 value=True,
                 totext=_("Encrypt the network connection using SSL."),
             )),
            ("connect_timeout",
             Float(
                 title=_("Connect timeout"),
                 help=
                 _("Timeout for the initial connection to the LDAP server in seconds."
                   ),
                 unit=_("Seconds"),
                 minvalue=1.0,
                 default_value=2.0,
             )),
            ("version",
             DropdownChoice(
                 title=_("LDAP version"),
                 help=_(
                     "Select the LDAP version the LDAP server is serving. Most modern "
                     "servers use LDAP version 3."),
                 choices=[(2, "2"), (3, "3")],
                 default_value=3,
             )),
            ("page_size",
             Integer(
                 title=_("Page size"),
                 help=
                 _("LDAP searches can be performed in paginated mode, for example to improve "
                   "the performance. This enables pagination and configures the size of the pages."
                   ),
                 minvalue=1,
                 default_value=1000,
             )),
            ("response_timeout",
             Integer(
                 title=_("Response timeout"),
                 unit=_("Seconds"),
                 help=_("Timeout for LDAP query responses."),
                 minvalue=0,
                 default_value=5,
             )),
            ("suffix",
             TextInput(
                 allow_empty=False,
                 title=_("LDAP connection suffix"),
                 help=
                 _("The LDAP connection suffix can be used to distinguish equal named objects "
                   "(name conflicts), for example user accounts, from different LDAP connections.<br>"
                   "It is used in the following situations:<br><br>"
                   "During LDAP synchronization, the LDAP sync might discover that a user to be "
                   "synchronized from from the current LDAP is already being synchronized from "
                   "another LDAP connection. Without the suffix configured this results in a name "
                   "conflict and the later user not being synchronized. If the connection has a "
                   "suffix configured, this suffix is added to the later username in case of the name "
                   "conflict to resolve it. The user will then be named <tt>[username]@[suffix]</tt> "
                   "instead of just <tt>[username]</tt>.<br><br>"
                   "In the case a user which users name is existing in multiple LDAP directories, "
                   "but associated to different persons, your user can insert <tt>[username]@[suffix]</tt>"
                   " during login instead of just the plain <tt>[username]</tt> to tell which LDAP "
                   "directory he is assigned to. Users without name conflict just need to provide their "
                   "regular username as usual."),
                 regex=re.compile(r'^[A-Z0-9.-]+(?:\.[A-Z]{2,24})?$', re.I),
                 validate=self._validate_ldap_connection_suffix,
             )),
        ]

        return connection_elements
Exemple #5
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 ingress 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="%"),
             ],
         )),
    ], )
Exemple #6
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."
                      ),
                ),
            ),
        ],
    )
Exemple #7
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"),
         )),
    ], )
Exemple #8
0
 def parameter_valuespec(self):
     return Dictionary(
         help=_("Here you can configure the 3.3V and 12V voltage levels for each power supply."),
         elements=[
             ("levels_33v_lower",
              Tuple(
                  title=_("3.3 Volt Output Lower Levels"),
                  elements=[
                      Float(title=_("warning if below or equal"), unit="V", default_value=3.25),
                      Float(title=_("critical if below or equal"), unit="V", default_value=3.20),
                  ],
              )),
             ("levels_33v_upper",
              Tuple(
                  title=_("3.3 Volt Output Upper Levels"),
                  elements=[
                      Float(title=_("warning if above or equal"), unit="V", default_value=3.4),
                      Float(title=_("critical if above or equal"), unit="V", default_value=3.45),
                  ],
              )),
             ("levels_5v_lower",
              Tuple(
                  title=_("5 Volt Output Lower Levels"),
                  elements=[
                      Float(title=_("warning if below or equal"), unit="V", default_value=3.25),
                      Float(title=_("critical if below or equal"), unit="V", default_value=3.20),
                  ],
              )),
             ("levels_5v_upper",
              Tuple(
                  title=_("5 Volt Output Upper Levels"),
                  elements=[
                      Float(title=_("warning if above or equal"), unit="V", default_value=3.4),
                      Float(title=_("critical if above or equal"), unit="V", default_value=3.45),
                  ],
              )),
             ("levels_12v_lower",
              Tuple(
                  title=_("12 Volt Output Lower Levels"),
                  elements=[
                      Float(title=_("warning if below or equal"), unit="V", default_value=11.9),
                      Float(title=_("critical if below or equal"), unit="V", default_value=11.8),
                  ],
              )),
             ("levels_12v_upper",
              Tuple(
                  title=_("12 Volt Output Upper Levels"),
                  elements=[
                      Float(title=_("warning if above or equal"), unit="V", default_value=12.1),
                      Float(title=_("critical if above or equal"), unit="V", default_value=12.2),
                  ],
              ))
         ],
     )
def _parameter_valuespec_postgres_stat_database():
    return Dictionary(
        help=
        _("This check monitors how often database objects in a PostgreSQL Database are accessed"
          ),
        elements=[
            (
                "blocks_read",
                Tuple(
                    title=_("Blocks read"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("blocks/s")),
                        Float(title=_("Critical at"), unit=_("blocks/s")),
                    ],
                ),
            ),
            (
                "xact_commit",
                Tuple(
                    title=_("Commits"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_fetched",
                Tuple(
                    title=_("Fetches"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_deleted",
                Tuple(
                    title=_("Deletes"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_updated",
                Tuple(
                    title=_("Updates"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
            (
                "tup_inserted",
                Tuple(
                    title=_("Inserts"),
                    elements=[
                        Float(title=_("Warning at"), unit=_("/s")),
                        Float(title=_("Critical at"), unit=_("/s")),
                    ],
                ),
            ),
        ],
    )
Exemple #10
0
def _parameter_valuespec_nfsiostats():
    return Dictionary(
        title=_("NFS IO Statistics"),
        optional_keys=True,
        elements=[
            ("op_s",
             Tuple(
                 title=_("Operations"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="1/s"),
                     Float(title=_("Critical at"), default_value=None, unit="1/s"),
                 ],
             )),
            ("rpc_backlog",
             Tuple(
                 title=_("RPC Backlog"),
                 elements=[
                     Float(title=_("Warning below"), default_value=None, unit="queue"),
                     Float(title=_("Critical below"), default_value=None, unit="queue"),
                 ],
             )),
            ("read_ops",
             Tuple(
                 title=_("Read Operations /s"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="1/s"),
                     Float(title=_("Critical at"), default_value=None, unit="1/s"),
                 ],
             )),
            ("read_b_s",
             Tuple(
                 title=_("Reads size /s"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="bytes/s"),
                     Float(title=_("Critical at"), default_value=None, unit="bytes/s"),
                 ],
             )),
            ("read_b_op",
             Tuple(
                 title=_("Read bytes per operation"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="bytes/op"),
                     Float(title=_("Critical at"), default_value=None, unit="bytes/op"),
                 ],
             )),
            ("read_retrans",
             Tuple(
                 title=_("Read Retransmissions"),
                 elements=[
                     Percentage(title=_("Warning at"), default_value=None),
                     Percentage(title=_("Critical at"), default_value=None),
                 ],
             )),
            ("read_avg_rtt_ms",
             Tuple(
                 title=_("Read Average RTT (ms)"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="ms"),
                     Float(title=_("Critical at"), default_value=None, unit="ms"),
                 ],
             )),
            ("read_avg_exe_ms",
             Tuple(
                 title=_("Read Average Executions (ms)"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="ms"),
                     Float(title=_("Critical at"), default_value=None, unit="ms"),
                 ],
             )),
            ("write_ops_s",
             Tuple(
                 title=_("Write Operations/s"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="1/s"),
                     Float(title=_("Critical at"), default_value=None, unit="1/s"),
                 ],
             )),
            ("write_b_s",
             Tuple(
                 title=_("Write size /s"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="bytes/s"),
                     Float(title=_("Critical at"), default_value=None, unit="bytes/s"),
                 ],
             )),
            ("write_b_op",
             Tuple(
                 title=_("Write bytes per operation"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="bytes/s"),
                     Float(title=_("Critical at"), default_value=None, unit="bytes/s"),
                 ],
             )),
            ("write_retrans",
             Tuple(
                 title=_("Write Retransmissions"),
                 elements=[
                     Percentage(title=_("Warning at"), default_value=None),
                     Percentage(title=_("Critical at"), default_value=None),
                 ],
             )),
            ("write_avg_rtt_ms",
             Tuple(
                 title=_("Write Avg RTT (ms)"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="ms"),
                     Float(title=_("Critical at"), default_value=None, unit="ms"),
                 ],
             )),
            ("write_avg_exe_ms",
             Tuple(
                 title=_("Write Avg exe (ms)"),
                 elements=[
                     Float(title=_("Warning at"), default_value=None, unit="ms"),
                     Float(title=_("Critical at"), default_value=None, unit="ms"),
                 ],
             )),
        ],
    )
Exemple #11
0
def _parameter_valuespec_msx_database():
    return Dictionary(
        title=_("Set Levels"),
        elements=[
            (
                "read_attached_latency",
                Tuple(
                    title=_("I/O Database Reads (Attached) Average Latency"),
                    elements=[
                        Float(title=_("Warning at"),
                              unit=_("ms"),
                              default_value=200.0),
                        Float(title=_("Critical at"),
                              unit=_("ms"),
                              default_value=250.0),
                    ],
                ),
            ),
            (
                "read_recovery_latency",
                Tuple(
                    title=_("I/O Database Reads (Recovery) Average Latency"),
                    elements=[
                        Float(title=_("Warning at"),
                              unit=_("ms"),
                              default_value=150.0),
                        Float(title=_("Critical at"),
                              unit=_("ms"),
                              default_value=200.0),
                    ],
                ),
            ),
            (
                "write_latency",
                Tuple(
                    title=_("I/O Database Writes (Attached) Average Latency"),
                    elements=[
                        Float(title=_("Warning at"),
                              unit=_("ms"),
                              default_value=40.0),
                        Float(title=_("Critical at"),
                              unit=_("ms"),
                              default_value=50.0),
                    ],
                ),
            ),
            (
                "log_latency",
                Tuple(
                    title=_("I/O Log Writes Average Latency"),
                    elements=[
                        Float(title=_("Warning at"),
                              unit=_("ms"),
                              default_value=5.0),
                        Float(title=_("Critical at"),
                              unit=_("ms"),
                              default_value=10.0),
                    ],
                ),
            ),
        ],
        optional_keys=[],
    )
Exemple #12
0
 def parameter_valuespec(self):
     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=_("Gbit/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")),
                  ],
              )),
             ("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=5,
              )),
             #("phystate",
             # Optional(
             #     ListChoice(
             #         title=_("Allowed states (otherwise check will be critical)"),
             #         choices=[
             #             (1, _("unknown")),
             #             (2, _("failed")),
             #             (3, _("bypassed")),
             #             (4, _("active")),
             #             (5, _("loopback")),
             #             (6, _("txfault")),
             #             (7, _("nomedia")),
             #             (8, _("linkdown")),
             #         ],),
             #     title=_("Physical state of port"),
             #     negate=True,
             #     label=_("ignore physical state"),
             # )),
             #("opstate",
             # Optional(
             #     ListChoice(
             #         title=_("Allowed states (otherwise check will be critical)"),
             #         choices=[
             #             (1, _("unknown")),
             #             (2, _("unused")),
             #             (3, _("ready")),
             #             (4, _("warning")),
             #             (5, _("failure")),
             #             (6, _("not participating")),
             #             (7, _("initializing")),
             #             (8, _("bypass")),
             #             (9, _("ols")),
             #         ],),
             #     title=_("Operational state"),
             #     negate=True,
             #     label=_("ignore operational state"),
             # )),
             #("admstate",
             # Optional(
             #     ListChoice(
             #         title=_("Allowed states (otherwise check will be critical)"),
             #         choices=[
             #             (1, _("unknown")),
             #             (2, _("online")),
             #             (3, _("offline")),
             #             (4, _("bypassed")),
             #             (5, _("diagnostics")),
             #         ],),
             #     title=_("Administrative state"),
             #     negate=True,
             #     label=_("ignore administrative state"),
             # ))
         ],)
Exemple #13
0
def _parameter_valuespec_pfsense_counter():
    return Dictionary(
        help=
        _("This rule set is for configuring levels for global packet counters."
          ),
        elements=[
            ("average",
             Integer(
                 title=_("Averaging"),
                 help=
                 _("When this option is activated then the packet rates are being "
                   "averaged <b>before</b> the levels are being applied. Setting this to zero will "
                   "deactivate averaging."),
                 unit=_("minutes"),
                 default_value=3,
                 minvalue=1,
                 label=_("Compute average over last "),
             )),
            ("fragment",
             Tuple(
                 title=_("Levels for rate of fragmented packets"),
                 elements=[
                     Float(title=_("Warning at"),
                           unit=_("pkts/s"),
                           default_value=100.0),
                     Float(title=_("Critical at"),
                           unit=_("pkts/s"),
                           default_value=10000.0),
                 ],
             )),
            ("normalized",
             Tuple(
                 title=_("Levels for rate of normalized packets"),
                 elements=[
                     Float(title=_("Warning at"),
                           unit=_("pkts/s"),
                           default_value=100.0),
                     Float(title=_("Critical at"),
                           unit=_("pkts/s"),
                           default_value=10000.0),
                 ],
             )),
            ("badoffset",
             Tuple(
                 title=_("Levels for rate of packets with bad offset"),
                 elements=[
                     Float(title=_("Warning at"),
                           unit=_("pkts/s"),
                           default_value=100.0),
                     Float(title=_("Critical at"),
                           unit=_("pkts/s"),
                           default_value=10000.0),
                 ],
             )),
            ("short",
             Tuple(
                 title=_("Levels for rate of short packets"),
                 elements=[
                     Float(title=_("Warning at"),
                           unit=_("pkts/s"),
                           default_value=100.0),
                     Float(title=_("Critical at"),
                           unit=_("pkts/s"),
                           default_value=10000.0),
                 ],
             )),
            ("memdrop",
             Tuple(
                 title=
                 _("Levels for rate of packets dropped due to memory limitations"
                   ),
                 elements=[
                     Float(title=_("Warning at"),
                           unit=_("pkts/s"),
                           default_value=100.0),
                     Float(title=_("Critical at"),
                           unit=_("pkts/s"),
                           default_value=10000.0),
                 ],
             )),
        ],
    )
Exemple #14
0
def _parameter_valuespec_skype():
    return Dictionary(elements=[
        ('failed_search_requests',
         Dictionary(
             title=_("Failed search requests"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Float(title=_("Warning at"), unit=_("per second"), default_value=1.0),
                      Float(title=_("Critical at"), unit=_("per second"), default_value=2.0),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('failed_locations_requests',
         Dictionary(
             title=_("Failed Get Locations Requests"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Float(title=_("Warning at"), unit=_("per second"), default_value=1.0),
                      Float(title=_("Critical at"), unit=_("per second"), default_value=2.0),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('failed_file_requests',
         Dictionary(
             title=_("Failed requests to Adressbook files"),
             elements=[("upper",
                        Tuple(elements=[
                            Float(title=_("Warning at"), unit=_("per second"), default_value=1.0),
                            Float(title=_("Critical at"), unit=_("per second"), default_value=2.0),
                        ],))],
             optional_keys=[],
         )),
        ('join_failures',
         Dictionary(
             title=_("Failures of the join launcher service"),
             elements=[("upper",
                        Tuple(elements=[
                            Integer(title=_("Warning at"), default_value=1),
                            Integer(title=_("Critical at"), default_value=2),
                        ],))],
             optional_keys=[],
         )),
        ('failed_validate_cert',
         Dictionary(
             title=_("Failed certificate validations"),
             elements=[("upper",
                        Tuple(elements=[
                            Integer(title=_("Warning at"), default_value=1),
                            Integer(title=_("Critical at"), default_value=2),
                        ],))],
             optional_keys=[],
         )),
        ('timedout_ad_requests',
         Dictionary(
             title=_("Timed out Active Directory Requests"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Float(title=_("Warning at"), unit=_("per second"), default_value=0.01),
                      Float(title=_("Critical at"), unit=_("per second"), default_value=0.02),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('5xx_responses',
         Dictionary(
             title=_("HTTP 5xx Responses"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Float(title=_("Warning at"), unit=_("per second"), default_value=1.0),
                      Float(title=_("Critical at"), unit=_("per second"), default_value=2.0),
                  ],)),
             ],
             optional_keys=[],
         )),
        ('asp_requests_rejected',
         Dictionary(
             title=_("ASP Requests Rejected"),
             elements=[
                 ("upper",
                  Tuple(elements=[
                      Integer(title=_("Warning at"), default_value=1),
                      Integer(title=_("Critical at"), default_value=2),
                  ],)),
             ],
             optional_keys=[],
         )),
    ],)
Exemple #15
0
def _phase_elements():
    return [
        (
            "voltage",
            Tuple(
                title=_("Voltage"),
                elements=[
                    Integer(title=_("warning if below"), unit="V", default_value=210),
                    Integer(title=_("critical if below"), unit="V", default_value=200),
                ],
            ),
        ),
        (
            "power",
            Tuple(
                title=_("Power"),
                elements=[
                    Integer(title=_("warning at"), unit="W", default_value=1000),
                    Integer(title=_("critical at"), unit="W", default_value=1200),
                ],
            ),
        ),
        (
            "appower",
            Tuple(
                title=_("Apparent Power"),
                elements=[
                    Integer(title=_("warning at"), unit="VA", default_value=1100),
                    Integer(title=_("critical at"), unit="VA", default_value=1300),
                ],
            ),
        ),
        (
            "current",
            Tuple(
                title=_("Current"),
                elements=[
                    Integer(title=_("warning at"), unit="A", default_value=5),
                    Integer(title=_("critical at"), unit="A", default_value=10),
                ],
            ),
        ),
        (
            "frequency",
            Tuple(
                title=_("Frequency"),
                elements=[
                    Integer(title=_("warning if below"), unit="Hz", default_value=45),
                    Integer(title=_("critical if below"), unit="Hz", default_value=40),
                    Integer(title=_("warning if above"), unit="Hz", default_value=55),
                    Integer(title=_("critical if above"), unit="Hz", default_value=60),
                ],
            ),
        ),
        (
            "differential_current_ac",
            Tuple(
                title=_("Differential current AC"),
                elements=[
                    Float(title=_("warning at"), unit="mA", default_value=3.5),
                    Float(title=_("critical at"), unit="mA", default_value=30),
                ],
            ),
        ),
        (
            "differential_current_dc",
            Tuple(
                title=_("Differential current DC"),
                elements=[
                    Float(title=_("warning at"), unit="mA", default_value=70),
                    Float(title=_("critical at"), unit="mA", default_value=100),
                ],
            ),
        ),
    ]
Exemple #16
0
def _special_agents_siemens_plc_siemens_plc_value():
    return [
        Transform(
            valuespec=CascadingDropdown(
                title=_("The Area"),
                choices=[
                    (
                        "db",
                        _("Datenbaustein"),
                        Integer(
                            title="<nobr>%s</nobr>" % _("DB Number"),
                            minvalue=1,
                        ),
                    ),
                    ("input", _("Input")),
                    ("output", _("Output")),
                    ("merker", _("Merker")),
                    ("timer", _("Timer")),
                    ("counter", _("Counter")),
                ],
                orientation="horizontal",
                sorted=True,
            ),
            # Transform old Integer() value spec to new cascading dropdown value
            forth=lambda x: isinstance(x, int) and ("db", x) or x,
        ),
        Float(
            title=_("Address"),
            display_format="%.1f",
            help=
            _("Addresses are specified with a dot notation, where number "
              "before the dot specify the byte to fetch and the number after the "
              "dot specifies the bit to fetch. The number of the bit is always "
              "between 0 and 7."),
        ),
        CascadingDropdown(
            title=_("Datatype"),
            choices=[
                ("dint", _("Double Integer (DINT)")),
                ("real", _("Real Number (REAL)")),
                ("bit", _("Single Bit (BOOL)")),
                (
                    "str",
                    _("String (STR)"),
                    Integer(
                        minvalue=1,
                        title=_("Size"),
                        unit=_("Bytes"),
                    ),
                ),
                (
                    "raw",
                    _("Raw Bytes (HEXSTR)"),
                    Integer(
                        minvalue=1,
                        title=_("Size"),
                        unit=_("Bytes"),
                    ),
                ),
            ],
            orientation="horizontal",
            sorted=True,
        ),
        DropdownChoice(
            title=_("Type of the value"),
            choices=[
                (None, _("Unclassified")),
                ("temp", _("Temperature")),
                ("hours_operation", _("Hours of operation")),
                ("hours_since_service", _("Hours since service")),
                ("hours", _("Hours")),
                ("seconds_operation", _("Seconds of operation")),
                ("seconds_since_service", _("Seconds since service")),
                ("seconds", _("Seconds")),
                ("counter", _("Increasing counter")),
                ("flag", _("State flag (on/off)")),
                ("text", _("Text")),
            ],
            sorted=True,
        ),
        ID(
            title=_("Ident of the value"),
            help=_(" An identifier of your choice. This identifier "
                   "is used by the Check_MK checks to access "
                   "and identify the single values. The identifier "
                   "needs to be unique within a group of VALUETYPES."),
        ),
    ]
Exemple #17
0
def _parameter_valuespec_temperature():
    return Transform(
        Dictionary(elements=[
            (
                "levels",
                Transform(Tuple(title=_("Upper Temperature Levels"),
                                elements=[
                                    Float(title=_("Warning at"),
                                          unit=u"°C",
                                          default_value=26),
                                    Float(title=_("Critical at"),
                                          unit=u"°C",
                                          default_value=30),
                                ]),
                          forth=lambda elems:
                          (float(elems[0]), float(elems[1]))),
            ),
            (
                "levels_lower",
                Transform(Tuple(title=_("Lower Temperature Levels"),
                                elements=[
                                    Float(title=_("Warning below"),
                                          unit=u"°C",
                                          default_value=0),
                                    Float(title=_("Critical below"),
                                          unit=u"°C",
                                          default_value=-10),
                                ]),
                          forth=lambda elems:
                          (float(elems[0]), float(elems[1]))),
            ),
            ("output_unit",
             DropdownChoice(title=_("Display values in "),
                            choices=[
                                ("c", _("Celsius")),
                                ("f", _("Fahrenheit")),
                                ("k", _("Kelvin")),
                            ])),
            ("input_unit",
             DropdownChoice(
                 title=_("Override unit of sensor"),
                 help=
                 _("In some rare cases the unit that is signalled by the sensor "
                   "is wrong and e.g. the sensor sends values in Fahrenheit while "
                   "they are misinterpreted as Celsius. With this setting you can "
                   "force the reading of the sensor to be interpreted as customized. "
                   ),
                 choices=[
                     ("c", _("Celsius")),
                     ("f", _("Fahrenheit")),
                     ("k", _("Kelvin")),
                 ])),
            ("device_levels_handling",
             DropdownChoice(
                 title=_(
                     "Interpretation of the device's own temperature status"),
                 choices=[
                     ("usr", _("Ignore device's own levels")),
                     ("dev", _("Only use device's levels, ignore yours")),
                     ("best",
                      _("Use least critical of your and device's levels")),
                     ("worst",
                      _("Use most critical of your and device's levels")),
                     ("devdefault",
                      _("Use device's levels if present, otherwise yours")),
                     ("usrdefault",
                      _("Use your own levels if present, otherwise the device's"
                        )),
                 ],
                 default_value="usrdefault",
             )),
            (
                "trend_compute",
                Dictionary(
                    title=_("Trend computation"),
                    label=_("Enable trend computation"),
                    elements=
                    [("period",
                      Integer(title=_(
                          "Observation period for temperature trend computation"
                      ),
                              default_value=30,
                              minvalue=5,
                              unit=_("minutes"))),
                     ("trend_levels",
                      Tuple(
                          title=_("Levels on temperature increase per period"),
                          elements=[
                              Integer(title=_("Warning at"),
                                      unit=u"°C / " + _("period"),
                                      default_value=5),
                              Integer(title=_("Critical at"),
                                      unit=u"°C / " + _("period"),
                                      default_value=10)
                          ])),
                     ("trend_levels_lower",
                      Tuple(
                          title=_("Levels on temperature decrease per period"),
                          elements=[
                              Integer(title=_("Warning at"),
                                      unit=u"°C / " + _("period"),
                                      default_value=5),
                              Integer(title=_("Critical at"),
                                      unit=u"°C / " + _("period"),
                                      default_value=10)
                          ])),
                     ("trend_timeleft",
                      Tuple(title=_(
                          "Levels on the time left until a critical temperature (upper or lower) is reached"
                      ),
                            elements=[
                                Integer(
                                    title=_("Warning if below"),
                                    unit=_("minutes"),
                                    default_value=240,
                                ),
                                Integer(
                                    title=_("Critical if below"),
                                    unit=_("minutes"),
                                    default_value=120,
                                ),
                            ]))],
                    optional_keys=[
                        "trend_levels", "trend_levels_lower", "trend_timeleft"
                    ],
                ),
            ),
        ], ),
        forth=lambda v: isinstance(v, tuple) and {"levels": v} or v,
    )
Exemple #18
0
def _parameter_valuespec_ipmi():
    return Dictionary(
        elements=[
            (
                "sensor_states",
                ListOf(
                    Tuple(elements=[TextInput(),
                                    MonitoringState()], ),
                    title=_("Set states of IPMI sensor status texts"),
                    help=_(
                        "The pattern specified here must match exactly the beginning of "
                        "the sensor state (case sensitive)."),
                ),
            ),
            (
                "ignored_sensors",
                ListOfStrings(
                    title=_(
                        "Ignore the following IPMI sensors (only summary)"),
                    help=
                    _("Names of IPMI sensors that should be ignored when summarizing."
                      "The pattern specified here must match exactly the beginning of "
                      "the actual sensor name (case sensitive)."),
                    orientation="horizontal",
                ),
            ),
            (
                "ignored_sensorstates",
                ListOfStrings(
                    title=_(
                        "Ignore the following IPMI sensor states (only summary)"
                    ),
                    help=
                    _("IPMI sensors with these states that should be ignored when summarizing."
                      "The pattern specified here must match exactly the beginning of "
                      "the actual sensor state (case sensitive)."),
                    orientation="horizontal",
                    default_value=["nr", "ns"],
                ),
            ),
            (
                "numerical_sensor_levels",
                ListOf(
                    Tuple(elements=[
                        TextInput(
                            title=_("Sensor name"),
                            help=
                            _("Enter the name of the sensor. In single mode, this can be read off "
                              "from the service descriptions of the services 'IPMI Sensor ...'."
                              ),
                        ),
                        Dictionary(elements=[
                            (
                                "lower",
                                Tuple(
                                    title=_("Lower levels"),
                                    elements=[
                                        Float(label=_("Warning at")),
                                        Float(label=_("Critical at")),
                                    ],
                                ),
                            ),
                            (
                                "upper",
                                Tuple(
                                    title=_("Upper levels"),
                                    elements=[
                                        Float(label=_("Warning at")),
                                        Float(label=_("Critical at")),
                                    ],
                                ),
                            ),
                        ], ),
                    ], ),
                    title=_(
                        "Set lower and upper levels for numerical sensors"),
                ),
            ),
        ],
        ignored_keys=["ignored_sensors", "ignored_sensor_states"],
    )
Exemple #19
0
def _parameter_valuespec_ddn_s2a_wait() -> Dictionary:
    return Dictionary(elements=[
        ("read_avg",
         Tuple(
             title=_("Read wait average"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ("read_min",
         Tuple(
             title=_("Read wait minimum"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ("read_max",
         Tuple(
             title=_("Read wait maximum"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ("write_avg",
         Tuple(
             title=_("Write wait average"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ("write_min",
         Tuple(
             title=_("Write wait minimum"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
        ("write_max",
         Tuple(
             title=_("Write wait maximum"),
             elements=[
                 Float(title=_("Warning at"), unit="s"),
                 Float(title=_("Critical at"), unit="s"),
             ],
         )),
    ],)
Exemple #20
0
def _parameter_valuespec_psu_wattage() -> Dictionary:
    return Dictionary(
        title=_("Levels for Power Supply Wattage"),
        elements=[
            (
                "levels_abs_upper",
                Tuple(
                    title=_("Upper levels (absolute)"),
                    elements=[
                        Float(title=_("Warning at"), unit="W"),
                        Float(title=_("Critical at"), unit="W"),
                    ],
                ),
            ),
            (
                "levels_abs_lower",
                Tuple(
                    title=_("Lower levels (absolute)"),
                    elements=[
                        Float(title=_("Warning below"), unit="W"),
                        Float(title=_("Critical below"), unit="W"),
                    ],
                ),
            ),
            (
                "levels_perc_upper",
                Tuple(
                    title=_("Upper levels (in percent)"),
                    elements=[
                        Percentage(
                            label=_("Warning at"),
                            default_value=80.0,
                            display_format="%.3f",
                        ),
                        Percentage(
                            label=_("Critical at"),
                            default_value=90.0,
                            display_format="%.3f",
                        ),
                    ],
                ),
            ),
            (
                "levels_perc_lower",
                Tuple(
                    title=_("Lower levels (in percent)"),
                    elements=[
                        Percentage(
                            label=_("Warning below"),
                            default_value=1.0,
                            display_format="%.3f",
                        ),
                        Percentage(
                            label=_("Critical below"),
                            default_value=0.1,
                            display_format="%.3f",
                        ),
                    ],
                ),
            ),
        ],
    )
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"))
                  ]),
        ),
    ], )
Exemple #22
0
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ("read_avg",
          Tuple(
              title=_(u"Read wait average"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
         ("read_min",
          Tuple(
              title=_(u"Read wait minimum"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
         ("read_max",
          Tuple(
              title=_(u"Read wait maximum"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
         ("write_avg",
          Tuple(
              title=_(u"Write wait average"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
         ("write_min",
          Tuple(
              title=_(u"Write wait minimum"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
         ("write_max",
          Tuple(
              title=_(u"Write wait maximum"),
              elements=[
                  Float(title=_(u"Warning at"), unit="s"),
                  Float(title=_(u"Critical at"), unit="s"),
              ],
          )),
     ],)
Exemple #23
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,
        )
Exemple #24
0
def _parameter_valuespec_rabbitmq_queues():
    return Dictionary(elements=[
        ("msg_upper",
         Tuple(
             title=_("Upper level for total number of messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_lower",
         Tuple(
             title=_("Lower level for total number of messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_ready_upper",
         Tuple(
             title=_("Upper level for total number of ready messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_ready_lower",
         Tuple(
             title=_("Lower level for total number of ready messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_unack_upper",
         Tuple(
             title=_(
                 "Upper level for total number of unacknowledged messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_unack_lower",
         Tuple(
             title=_(
                 "Lower level for total number of unacknowledged messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_publish_upper",
         Tuple(
             title=_("Upper level for total number of published messages"),
             elements=[
                 Integer(title=_("Warning at"), unit="messages"),
                 Integer(title=_("Critical at"), unit="messages"),
             ],
         )),
        ("msg_publish_lower",
         Tuple(
             title=_("Lower level for total number of published messages"),
             elements=[
                 Integer(title=_("Warning below"), unit="messages"),
                 Integer(title=_("Critical below"), unit="messages"),
             ],
         )),
        ("msg_publish_rate_upper",
         Tuple(
             title=_("Upper level for published message rate"),
             elements=[
                 Float(title=_("Warning at"), unit="1/s"),
                 Float(title=_("Critical at"), unit="1/s"),
             ],
         )),
        ("msg_publish_rate_lower",
         Tuple(
             title=_("Lower level for published message rate"),
             elements=[
                 Float(title=_("Warning below"), unit="1/s"),
                 Float(title=_("Critical below"), unit="1/s"),
             ],
         )),
        ("abs_memory",
         Tuple(
             title=_("Absolute levels for used memory"),
             elements=[
                 Filesize(title=_("Warning at")),
                 Filesize(title=_("Critical at")),
             ],
         )),
    ], )
Exemple #25
0
def _parameter_valuespec_azure_virtualnetworkgateways():
    return Dictionary(elements=[
        ('connections_levels_upper',
         Tuple(
             title=_("Upper levels on number of Point-to-site connections"),
             elements=[
                 Float(title=_("Warning at")),
                 Float(title=_("Critical at")),
             ],
         )),
        ('connections_levels_lower',
         Tuple(
             title=_("Lower levels on number of Point-to-site connections"),
             elements=[
                 Float(title=_("Warning below")),
                 Float(title=_("Critical below")),
             ],
         )),
        ('p2s_bandwidth_levels_upper',
         Tuple(
             title=_(
                 "Upper levels on Point-to-site bandwidth in bytes per second"
             ),
             elements=[
                 Float(title=_("Warning at"), unit="B/s"),
                 Float(title=_("Critical at"), unit="B/s"),
             ],
         )),
        ('p2s_bandwidth_levels_lower',
         Tuple(
             title=_(
                 "Lower levels on Point-to-site bandwidth in bytes per second"
             ),
             elements=[
                 Float(title=_("Warning below"), unit="B/s"),
                 Float(title=_("Critical below"), unit="B/s"),
             ],
         )),
        ('s2s_bandwidth_levels_upper',
         Tuple(
             title=_(
                 "Upper levels on Site-to-site bandwidth in bytes per second"),
             elements=[
                 Float(title=_("Warning at"), unit="B/s"),
                 Float(title=_("Critical at"), unit="B/s"),
             ],
         )),
        ('s2s_bandwidth_levels_lower',
         Tuple(
             title=_(
                 "Lower levels on Site-to-site bandwidth in bytes per second"),
             elements=[
                 Float(title=_("Warning below"), unit="B/s"),
                 Float(title=_("Critical below"), unit="B/s"),
             ],
         )),
    ], )
Exemple #26
0
 def parameter_valuespec(self):
     return Dictionary(elements=[
         ("1xx",
          Tuple(
              title=_(
                  "Upper levels for \"fetch no body (1xx)\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("204",
          Tuple(
              title=_(
                  "Upper levels for \"fetch no body (204)\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("304",
          Tuple(
              title=_(
                  "Upper levels for \"fetch no body (304)\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("bad",
          Tuple(
              title=_(
                  "Upper levels for \"fetch had bad headers\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("eof",
          Tuple(
              title=_("Upper levels for \"fetch EOF\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("failed",
          Tuple(
              title=_("Upper levels for \"fetch failed\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
         ("zero",
          Tuple(
              title=_("Upper levels for \"fetch zero length\" per second"),
              elements=[
                  Float(title=_("Warning at"),
                        default_value=1.0,
                        allow_empty=False),
                  Float(title=_("Critical at"),
                        default_value=2.0,
                        allow_empty=False)
              ],
          )),
     ], )
Exemple #27
0
def vs_graph_render_option_elements(default_values=None, exclude=None):
    # Allow custom default values to be specified by the caller. This is, for example,
    # needed by the dashlets which should add the host/service by default.
    if default_values is None:
        default_values = artwork.get_default_graph_render_options()
    else:
        default_values = default_values.copy()
        for k, v in artwork.get_default_graph_render_options().items():
            default_values.setdefault(k, v)

    elements = [
        ("font_size", Fontsize(default_value=default_values["font_size"], )),
        ("show_title",
         DropdownChoice(
             title=_("Title"),
             choices=[
                 (False, _("Don't show graph title")),
                 (True, _("Show graph title")),
                 ("inline", _("Show graph title on graph area")),
             ],
             default_value=default_values["show_title"],
         )),
        ("title_format",
         Transform(
             CascadingDropdown(
                 title=_("Title format"),
                 orientation="vertical",
                 choices=[
                     ("plain", _("Just show graph title")),
                     ("add_title_infos", _("Add additional information"),
                      ListChoice(choices=[
                          ("add_host_name", _("Add host name")),
                          ("add_host_alias", _("Add host alias")),
                          ("add_service_description",
                           _("Add service description")),
                      ])),
                 ],
             ),
             forth=transform_graph_render_options_title_format,
         )),
        ("show_graph_time",
         Checkbox(
             title=_("Show graph time range"),
             label=_("Show the graph time range on top of the graph"),
             default_value=default_values["show_graph_time"],
         )),
        ("show_margin",
         Checkbox(
             title=_("Show margin round the graph"),
             label=_("Show a margin round the graph"),
             default_value=default_values["show_margin"],
         )),
        ("show_legend",
         Checkbox(
             title=_("Show legend"),
             label=_("Show the graph legend"),
             default_value=default_values["show_legend"],
         )),
        ("show_vertical_axis",
         Checkbox(
             title=_("Show vertical axis"),
             label=_("Show the graph vertical axis"),
             default_value=default_values["show_vertical_axis"],
         )),
        ("vertical_axis_width",
         CascadingDropdown(
             title=_("Vertical axis width"),
             orientation="horizontal",
             choices=[
                 ("fixed", _("Use fixed width (relative to font size)")),
                 ("explicit", _("Use absolute width:"),
                  Float(title="", default_value=40.0, unit=_("pt"))),
             ],
         )),
        ("show_time_axis",
         Checkbox(
             title=_("Show time axis"),
             label=_("Show the graph time axis"),
             default_value=default_values["show_time_axis"],
         )),
        ("show_controls",
         Checkbox(
             title=_("Show controls"),
             label=_("Show the graph controls"),
             default_value=default_values["show_controls"],
         )),
        ("show_pin",
         Checkbox(
             title=_("Show pin"),
             label=_("Show the pin"),
             default_value=default_values["show_pin"],
         )),
        ("show_time_range_previews",
         Checkbox(
             title=_("Show time range previews"),
             label="Show previews",
             default_value=default_values["show_time_range_previews"],
         )),
        ("foreground_color",
         GraphColor(
             title=_("Foreground color"),
             default_value=default_values["foreground_color"],
         )),
        ("background_color",
         GraphColor(
             title=_("Background color"),
             default_value=default_values["background_color"],
         )),
        ("canvas_color",
         GraphColor(
             title=_("Canvas color"),
             default_value=default_values["canvas_color"],
         )),
    ]

    if exclude:
        elements = [x for x in elements if x[0] not in exclude]

    return elements
Exemple #28
0
def _valuespec_active_checks_http():
    return Transform(
        valuespec=Dictionary(
            title=_("Check HTTP service"),
            help=_(
                "Check HTTP/HTTPS service using the plugin <tt>check_http</tt> "
                "from the standard Monitoring Plugins. "
                "This plugin tests the HTTP service on the specified host. "
                "It can test normal (HTTP) and secure (HTTPS) servers, follow "
                "redirects, search for strings and regular expressions, check "
                "connection times, and report on certificate expiration times."
            ),
            elements=[
                (
                    "name",
                    TextInput(
                        title=_("Service name"),
                        help=
                        _("Will be used in the service description. If the name starts with "
                          "a caret (<tt>^</tt>), the service description will not be prefixed with either "
                          "<tt>HTTP</tt> or <tt>HTTPS</tt>."),
                        allow_empty=False,
                        validate=_validate_active_check_http_name,
                        size=45,
                    ),
                ),
                ("host", _active_checks_http_hostspec()),
                ("proxy", _active_checks_http_proxyspec()),
                (
                    "mode",
                    CascadingDropdown(
                        title=_("Mode of the Check"),
                        help=
                        _("Perform a check of the URL or the certificate expiration."
                          ),
                        choices=[
                            (
                                "url",
                                _("Check the URL"),
                                Dictionary(
                                    title=_("URL Checking"),
                                    elements=[
                                        (
                                            "uri",
                                            TextInput(
                                                title=
                                                _("URI to fetch (default is <tt>/</tt>)"
                                                  ),
                                                help=
                                                _("The URI of the request. This should start with"
                                                  " '/' and not include the domain"
                                                  " (e.g. '/index.html')."),
                                                allow_empty=False,
                                                default_value="/",
                                                size=45,
                                            ),
                                        ),
                                        (
                                            "ssl",
                                            Transform(
                                                valuespec=DropdownChoice(
                                                    title=
                                                    _("Use SSL/HTTPS for the connection"
                                                      ),
                                                    choices=[
                                                        (
                                                            "auto",
                                                            _("Use SSL with auto negotiation"
                                                              ),
                                                        ),
                                                        ("1.2",
                                                         _("Use SSL, enforce TLSv1.2"
                                                           )),
                                                        ("1.1",
                                                         _("Use SSL, enforce TLSv1.1"
                                                           )),
                                                        ("1",
                                                         _("Use SSL, enforce TLSv1"
                                                           )),
                                                        ("2",
                                                         _("Use SSL, enforce SSLv2"
                                                           )),
                                                        ("3",
                                                         _("Use SSL, enforce SSLv3"
                                                           )),
                                                    ],
                                                    default_value="auto",
                                                ),
                                                forth=lambda x: x is True and
                                                "auto" or x,
                                            ),
                                        ),
                                        (
                                            "response_time",
                                            Tuple(
                                                title=_(
                                                    "Expected response time"),
                                                elements=[
                                                    Float(
                                                        title=_(
                                                            "Warning if above"
                                                        ),
                                                        unit="ms",
                                                        default_value=100.0,
                                                    ),
                                                    Float(
                                                        title=_(
                                                            "Critical if above"
                                                        ),
                                                        unit="ms",
                                                        default_value=200.0,
                                                    ),
                                                ],
                                            ),
                                        ),
                                        (
                                            "timeout",
                                            Integer(
                                                title=
                                                _("Seconds before connection times out"
                                                  ),
                                                unit=_("sec"),
                                                default_value=10,
                                            ),
                                        ),
                                        (
                                            "user_agent",
                                            TextInput(
                                                title=_("User Agent"),
                                                help=
                                                _('String to be sent in http header as "User Agent"'
                                                  ),
                                                allow_empty=False,
                                            ),
                                        ),
                                        (
                                            "add_headers",
                                            ListOfStrings(
                                                title=_(
                                                    "Additional header lines"),
                                                orientation="vertical",
                                                valuespec=TextInput(size=40),
                                            ),
                                        ),
                                        (
                                            "auth",
                                            Tuple(
                                                title=_("Authorization"),
                                                help=
                                                _("Credentials for HTTP Basic Authentication"
                                                  ),
                                                elements=[
                                                    TextInput(
                                                        title=_("Username"),
                                                        size=12,
                                                        allow_empty=False,
                                                    ),
                                                    IndividualOrStoredPassword(
                                                        title=_("Password"), ),
                                                ],
                                            ),
                                        ),
                                        (
                                            "onredirect",
                                            DropdownChoice(
                                                title=_(
                                                    "How to handle redirect"),
                                                choices=[
                                                    ("ok", _("Make check OK")),
                                                    ("warning",
                                                     _("Make check WARNING")),
                                                    ("critical",
                                                     _("Make check CRITICAL")),
                                                    ("follow",
                                                     _("Follow the redirection"
                                                       )),
                                                    (
                                                        "sticky",
                                                        _("Follow, but stay to same IP address"
                                                          ),
                                                    ),
                                                    (
                                                        "stickyport",
                                                        _("Follow, but stay to same IP-address and port"
                                                          ),
                                                    ),
                                                ],
                                                default_value="follow",
                                            ),
                                        ),
                                        (
                                            "expect_response_header",
                                            TextInput(title=_(
                                                "String to expect in response headers"
                                            ), ),
                                        ),
                                        (
                                            "expect_response",
                                            ListOfStrings(
                                                title=
                                                _("Strings to expect in server response"
                                                  ),
                                                help=
                                                _("At least one of these strings is expected in "
                                                  "the first (status) line of the server response "
                                                  "(default: <tt>HTTP/1.</tt>). If specified skips "
                                                  "all other status line logic (ex: 3xx, 4xx, 5xx "
                                                  "processing)"),
                                            ),
                                        ),
                                        (
                                            "expect_string",
                                            TextInput(
                                                title=
                                                _("Fixed string to expect in the content"
                                                  ),
                                                allow_empty=False,
                                            ),
                                        ),
                                        (
                                            "expect_regex",
                                            Transform(
                                                valuespec=Tuple(
                                                    orientation="vertical",
                                                    show_titles=False,
                                                    elements=[
                                                        RegExp(
                                                            label=
                                                            _("Regular expression: "
                                                              ),
                                                            mode=RegExp.infix,
                                                            maxlen=1023,
                                                        ),
                                                        Checkbox(label=_(
                                                            "Case insensitive")
                                                                 ),
                                                        Checkbox(label=_(
                                                            "return CRITICAL if found, OK if not"
                                                        )),
                                                        Checkbox(label=_(
                                                            "Multiline string matching"
                                                        )),
                                                    ],
                                                ),
                                                forth=lambda x: len(x) == 3 and
                                                tuple(list(x) + [False]) or x,
                                                title=
                                                _("Regular expression to expect in content"
                                                  ),
                                            ),
                                        ),
                                        (
                                            "post_data",
                                            Tuple(
                                                title=_("Send HTTP POST data"),
                                                elements=[
                                                    TextInput(
                                                        title=_(
                                                            "HTTP POST data"),
                                                        help=
                                                        _("Data to send via HTTP POST method. "
                                                          "Please make sure, that the data is URL-encoded."
                                                          ),
                                                        size=40,
                                                    ),
                                                    TextInput(
                                                        title=_(
                                                            "Content-Type"),
                                                        default_value=
                                                        "text/html",
                                                    ),
                                                ],
                                            ),
                                        ),
                                        (
                                            "method",
                                            DropdownChoice(
                                                title=_("HTTP Method"),
                                                default_value="GET",
                                                choices=[
                                                    ("GET", "GET"),
                                                    ("POST", "POST"),
                                                    ("OPTIONS", "OPTIONS"),
                                                    ("TRACE", "TRACE"),
                                                    ("PUT", "PUT"),
                                                    ("DELETE", "DELETE"),
                                                    ("HEAD", "HEAD"),
                                                    ("CONNECT", "CONNECT"),
                                                    ("PROPFIND", "PROPFIND"),
                                                ],
                                            ),
                                        ),
                                        (
                                            "no_body",
                                            FixedValue(
                                                value=True,
                                                title=
                                                _("Don't wait for document body"
                                                  ),
                                                help=
                                                _("Note: this still does an HTTP GET or POST, not a HEAD."
                                                  ),
                                                totext=_(
                                                    "don't wait for body"),
                                            ),
                                        ),
                                        (
                                            "page_size",
                                            Tuple(
                                                title=_("Page size to expect"),
                                                elements=[
                                                    Integer(title=_("Minimum"),
                                                            unit=_("Bytes")),
                                                    Integer(title=_("Maximum"),
                                                            unit=_("Bytes")),
                                                ],
                                            ),
                                        ),
                                        (
                                            "max_age",
                                            Age(
                                                title=_("Maximum age"),
                                                help=
                                                _("Warn, if the age of the page is older than this"
                                                  ),
                                                default_value=3600 * 24,
                                            ),
                                        ),
                                        (
                                            "urlize",
                                            FixedValue(
                                                value=True,
                                                title=_("Clickable URLs"),
                                                totext=
                                                _("Format check output as hyperlink"
                                                  ),
                                                help=
                                                _("With this option the check produces an output that is a valid hyperlink "
                                                  "to the checked URL and this clickable."
                                                  ),
                                            ),
                                        ),
                                        (
                                            "extended_perfdata",
                                            FixedValue(
                                                value=True,
                                                totext=_("Extended perfdata"),
                                                title=
                                                _("Record additional performance data"
                                                  ),
                                                help=
                                                _("This option makes the HTTP check produce more detailed performance data values "
                                                  "like the connect time, header time, time till first byte received and the "
                                                  "transfer time."),
                                            ),
                                        ),
                                    ],
                                ),
                            ),
                            (
                                "cert",
                                _("Check SSL Certificate Age"),
                                Dictionary(
                                    title=_("Certificate Checking"),
                                    help=_(
                                        "Port defaults to 443. In this mode the URL"
                                        " is not checked."),
                                    elements=[
                                        (
                                            "cert_days",
                                            Transform(
                                                valuespec=Tuple(
                                                    title=_("Age"),
                                                    help=_(
                                                        "Minimum number of days a certificate"
                                                        " has to be valid."),
                                                    elements=[
                                                        Integer(
                                                            title=
                                                            _("Warning at or below"
                                                              ),
                                                            minvalue=0,
                                                            unit=_("days"),
                                                        ),
                                                        Integer(
                                                            title=
                                                            _("Critical at or below"
                                                              ),
                                                            minvalue=0,
                                                            unit=_("days"),
                                                        ),
                                                    ],
                                                ),
                                                forth=transform_cert_days,
                                            ),
                                        ),
                                    ],
                                    required_keys=["cert_days"],
                                ),
                            ),
                        ],
                    ),
                ),
                (
                    "disable_sni",
                    FixedValue(
                        value=True,
                        totext="",
                        title=
                        _("Advanced: Disable SSL/TLS hostname extension support (SNI)"
                          ),
                        help=
                        _("In earlier versions of Check_MK users had to enable SNI explicitly."
                          " We now assume users allways want SNI support. If you don't, you"
                          " can disable it with this option."),
                    ),
                ),
            ],
            required_keys=["name", "host", "mode"],
            validate=_active_checks_http_validate_all,
        ),
        forth=_active_checks_http_transform_check_http,
    )
Exemple #29
0
 def _vs_rules(self):
     return Dictionary(
         optional_keys=False,
         elements=[
             (
                 "agent_port",
                 Integer(
                     minvalue=1,
                     maxvalue=65535,
                     default_value=6556,
                     title=_('Checkmk Agent Port (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"),
                          ("varname", "agent_ports")]),
                     help=_(
                         "This variable allows to specify the TCP port to "
                         "be used to connect to the agent on a per-host-basis."
                     ),
                 ),
             ),
             (
                 "tcp_connect_timeout",
                 Float(
                     minvalue=1.0,
                     default_value=5.0,
                     unit=_("sec"),
                     display_format="%.0f",  # show values consistent to
                     size=2,  # SNMP-Timeout
                     title=_(
                         'TCP Connection Timeout (<a href="%s">Rules</a>)')
                     % watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"),
                          ("varname", "tcp_connect_timeouts")]),
                     help=
                     _("This variable allows to specify a timeout for the "
                       "TCP connection to the Check_MK agent on a per-host-basis."
                       "If the agent does not respond within this time, it is considered to be unreachable."
                       ),
                 ),
             ),
             (
                 "snmp_timeout",
                 Integer(
                     title=_('SNMP-Timeout (<a href="%s">Rules</a>)') %
                     watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"),
                          ("varname", "snmp_timing")]),
                     help=
                     _("After a request is sent to the remote SNMP agent we will wait up to this "
                       "number of seconds until assuming the answer get lost and retrying."
                       ),
                     default_value=1,
                     minvalue=1,
                     maxvalue=60,
                     unit=_("sec"),
                 ),
             ),
             (
                 "snmp_retries",
                 Integer(
                     title=_('SNMP-Retries (<a href="%s">Rules</a>)') %
                     watolib.folder_preserving_link(
                         [("mode", "edit_ruleset"),
                          ("varname", "snmp_timing")]),
                     default_value=5,
                     minvalue=0,
                     maxvalue=50,
                 ),
             ),
         ],
     )
Exemple #30
0
def _parameter_valuespec_disk_io():
    return Dictionary(
        elements=[
            (
                "read",
                Levels(
                    title=_("Read throughput"),
                    unit=_("MB/s"),
                    default_value=None,
                    default_levels=(50.0, 100.0),
                ),
            ),
            (
                "write",
                Levels(
                    title=_("Write throughput"),
                    unit=_("MB/s"),
                    default_value=None,
                    default_levels=(50.0, 100.0),
                ),
            ),
            (
                "average",
                Integer(
                    title=_("Average"),
                    help=_(
                        "When averaging is set, a floating average value "
                        "of the disk throughput is computed and the levels for read "
                        "and write will be applied to the average instead of the current "
                        "value."
                    ),
                    default_value=5,
                    minvalue=1,
                    unit=_("minutes"),
                ),
            ),
            (
                "latency",
                Tuple(
                    title=_("IO Latency"),
                    elements=[
                        Float(title=_("warning at"), unit=_("ms"), default_value=80.0),
                        Float(title=_("critical at"), unit=_("ms"), default_value=160.0),
                    ],
                ),
            ),
            (
                "latency_perfdata",
                Checkbox(
                    title=_("Performance Data for Latency"),
                    label=_("Collect performance data for disk latency"),
                    help=_(
                        "Note: enabling performance data for the latency might "
                        "cause incompatibilities with existing historical data "
                        "if you are running PNP4Nagios in SINGLE mode."
                    ),
                ),
            ),
            (
                "read_ql",
                Tuple(
                    title=_("Read Queue-Length"),
                    elements=[
                        Float(title=_("warning at"), default_value=80.0),
                        Float(title=_("critical at"), default_value=90.0),
                    ],
                ),
            ),
            (
                "write_ql",
                Tuple(
                    title=_("Write Queue-Length"),
                    elements=[
                        Float(title=_("warning at"), default_value=80.0),
                        Float(title=_("critical at"), default_value=90.0),
                    ],
                ),
            ),
            (
                "ql_perfdata",
                Checkbox(
                    title=_("Performance Data for Queue Length"),
                    label=_("Collect performance data for disk latency"),
                    help=_(
                        "Note: enabling performance data for the latency might "
                        "cause incompatibilities with existing historical data "
                        "if you are running PNP4Nagios in SINGLE mode."
                    ),
                ),
            ),
            (
                "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),
                ),
            ),
        ],
    )