示例#1
0
def _parameter_valuespec_livestatus_status():
    return Dictionary(
        help=_("When monitoring the performance of a monitoring site (i.e. its core) "
               "then also settings are being checked, e.g. for manually disabled notifications. "
               "The status of the various situations can be configured here."),
        elements=[
            ("site_stopped", MonitoringState(title="State when the site is stopped",
                                             default_value=2)),
            ("execute_host_checks",
             MonitoringState(title="State when host checks are disabled", default_value=2)),
            ("execute_service_checks",
             MonitoringState(title="State when service checks are disabled", default_value=2)),
            ("accept_passive_host_checks",
             MonitoringState(title="State when not accepting passive host checks",
                             default_value=2)),
            ("accept_passive_service_checks",
             MonitoringState(title="State when not accepting passive service checks",
                             default_value=2)),
            ("check_host_freshness",
             MonitoringState(title="State when not checking host freshness", default_value=2)),
            ("check_service_freshness",
             MonitoringState(title="State when not checking service freshness", default_value=2)),
            ("enable_event_handlers",
             MonitoringState(title="State when event handlers are disabled", default_value=0)),
            ("enable_flap_detection",
             MonitoringState(title="State when flap detection is disabled", default_value=1)),
            ("enable_notifications",
             MonitoringState(title="State when notifications are disabled", default_value=2)),
            ("process_performance_data",
             MonitoringState(title="State when performance data is disabled", default_value=1)),
            ("check_external_commands",
             MonitoringState(title="State when not checking external commands", default_value=2)),
            ("site_cert_days",
             Tuple(
                 title=_("Site certificate validity"),
                 help=_("Minimum number of days a certificate has to be valid."),
                 elements=[
                     Integer(
                         title=_("Warning at or below"),
                         minvalue=0,
                         unit=_("days"),
                         default_value=30,
                     ),
                     Integer(
                         title=_("Critical at or below"),
                         minvalue=0,
                         unit=_("days"),
                         default_value=7,
                     ),
                 ],
             )),
            ("average_latency_generic",
             Tuple(title=_("Levels Latency Check"),
                   help=_("Set Levels for the Check Latency Time"),
                   elements=[
                       Age(
                           title=_("Warning at or above"),
                           default_value=30,
                       ),
                       Age(
                           title=_("Critical at or above"),
                           default_value=60,
                       ),
                   ])),
            ("average_latency_cmk",
             Tuple(title=_("Levels Latency Checkmk"),
                   help=_("Set Levels for the Checkmk Latency Time"),
                   elements=[
                       Age(
                           title=_("Warning at or above"),
                           default_value=30,
                       ),
                       Age(
                           title=_("Critical at or above"),
                           default_value=60,
                       ),
                   ])),
            ("average_latency_fetcher",
             Tuple(title=_("Levels Latency Fetcher"),
                   help=_("Set Levels for the Fetcher Latency Time"),
                   elements=[
                       Age(
                           title=_("Warning at or above"),
                           default_value=30,
                       ),
                       Age(
                           title=_("Critical at or above"),
                           default_value=60,
                       ),
                   ])),
            ("helper_usage_generic",
             Tuple(title=_("Levels Helper usage Check"),
                   help=_("Set Levels for the Check helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="60",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("helper_usage_cmk",
             Tuple(title=_("Levels Helper usage Checkmk"),
                   help=_("Set Levels for the Checkmk helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="60",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("helper_usage_fetcher",
             Tuple(title=_("Levels Helper usage fetcher"),
                   help=_("Set Levels for the fetcher helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="40",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="80",
                       ),
                   ])),
            ("helper_usage_checker",
             Tuple(title=_("Levels Helper usage checker"),
                   help=_("Set Levels for the checker helper Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="40",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="80",
                       ),
                   ])),
            ("livestatus_usage",
             Tuple(title=_("Levels Livestatus Usage"),
                   help=_("Set Levels for the Checkmk Livestatus Usage"),
                   elements=[
                       Percentage(
                           title=_("Warning at or above"),
                           default_value="80",
                       ),
                       Percentage(
                           title=_("Critical at or above"),
                           default_value="90",
                       ),
                   ])),
            ("livestatus_overflows_rate",
             Tuple(title=_("Levels Livestatus Overflows"),
                   help=_("Set Levels for the Checkmk Livestatus Overflows"),
                   elements=[
                       Float(
                           title=_("Warning at or above"),
                           unit=_("/s"),
                           default_value="0.01",
                       ),
                       Float(
                           title=_("Critical at or above"),
                           unit=_("/s"),
                           default_value="0.02",
                       ),
                   ])),
            ("levels_hosts",
             Tuple(title=_("Levels Hosts"),
                   help=_("Set Levels for the number of Hosts"),
                   elements=[
                       Integer(
                           title=_("Warning at or above"),
                           unit=_("Hosts"),
                       ),
                       Integer(
                           title=_("Critical at or above"),
                           unit=_("Hosts"),
                       ),
                   ])),
            ("levels_services",
             Tuple(title=_("Levels Services"),
                   help=_("Set Levels for the number of Services"),
                   elements=[
                       Integer(
                           title=_("Warning at or above"),
                           unit=_("Services"),
                       ),
                       Integer(
                           title=_("Critical at or above"),
                           unit=_("Services"),
                       ),
                   ])),
        ],
    )
示例#2
0
 def parameter_valuespec(self):
     return Tuple(elements=[
         Percentage(title=_("Warning if less than"), unit=_("% memory left")),
         Percentage(title=_("Critical if less than"), unit=_("% memory left")),
     ],)
示例#3
0
 def _vs_host_renaming(self):
     return CascadingDropdown(
         orientation="horizontal",
         choices=[
             (
                 "case",
                 _("Case translation"),
                 DropdownChoice(choices=[
                     ("upper", _("Convert hostnames to upper case")),
                     ("lower", _("Convert hostnames to lower case")),
                 ]),
             ),
             ("add_suffix", _("Add Suffix"), Hostname()),
             ("add_prefix", _("Add Prefix"), Hostname()),
             ("drop_domain", _("Drop Domain Suffix")),
             ("reverse_dns",
              _("Convert IP addresses of hosts into host their DNS names")),
             (
                 "regex",
                 _("Regular expression substitution"),
                 Tuple(
                     help=
                     _("Please specify a regular expression in the first field. This expression should at "
                       "least contain one subexpression exclosed in brackets - for example <tt>vm_(.*)_prod</tt>. "
                       "In the second field you specify the translated host name and can refer to the first matched "
                       "group with <tt>\\1</tt>, the second with <tt>\\2</tt> and so on, for example <tt>\\1.example.org</tt>"
                       ),
                     elements=[
                         RegExp(
                             title=
                             _("Regular expression for the beginning of the host name"
                               ),
                             help=
                             _("Must contain at least one subgroup <tt>(...)</tt>"
                               ),
                             mingroups=0,
                             maxgroups=9,
                             size=30,
                             allow_empty=False,
                             mode=RegExp.prefix,
                         ),
                         TextInput(
                             title=_("Replacement"),
                             help=
                             _("Use <tt>\\1</tt>, <tt>\\2</tt> etc. to replace matched subgroups, <tt>\\0</tt> to insert to original host name"
                               ),
                             size=30,
                             allow_empty=False,
                         ),
                     ],
                 ),
             ),
             (
                 "explicit",
                 _("Explicit renaming"),
                 Tuple(
                     orientation="horizontal",
                     elements=[
                         Hostname(title=_("current host name"),
                                  allow_empty=False),
                         Hostname(title=_("new host name"),
                                  allow_empty=False),
                     ],
                 ),
             ),
         ],
     )
示例#4
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),
                ],
            ),
        ),
    ]
示例#5
0
def _parameter_valuespec_mssql_tablespaces():
    return Dictionary(elements=[
        ("size",
         Tuple(
             title=_("Upper levels for size"),
             elements=[
                 Filesize(title=_("Warning at")),
                 Filesize(title=_("Critical at"))
             ],
         )),
        ("reserved",
         Alternative(
             title=_("Upper levels for reserved space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning at")),
                         Filesize(title=_("Critical at"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("data",
         Alternative(
             title=_("Upper levels for data"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning at")),
                         Filesize(title=_("Critical at"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("indexes",
         Alternative(
             title=_("Upper levels for indexes"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning at")),
                         Filesize(title=_("Critical at"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("unused",
         Alternative(
             title=_("Upper levels for unused space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning at")),
                         Filesize(title=_("Critical at"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at"))
                     ],
                 ),
             ],
         )),
        ("unallocated",
         Alternative(
             title=_("Lower levels for unallocated space"),
             elements=[
                 Tuple(
                     title=_("Absolute levels"),
                     elements=[
                         Filesize(title=_("Warning below")),
                         Filesize(title=_("Critical below"))
                     ],
                 ),
                 Tuple(
                     title=_("Percentage levels"),
                     elements=[
                         Percentage(title=_("Warning below")),
                         Percentage(title=_("Critical below"))
                     ],
                 ),
             ],
         )),
    ], )
示例#6
0
from cmk.gui.plugins.wato import (
    CheckParameterRulespecWithoutItem,
    rulespec_registry,
    RulespecGroupCheckParametersApplications,
)

mailqueue_params = Dictionary(
    elements=[
        (
            "deferred",
            Tuple(
                title=_("Mails in outgoing mail queue/deferred mails"),
                help=_("This rule is applied to the number of E-Mails currently "
                       "in the deferred mail queue, or in the general outgoing mail "
                       "queue, if such a distinction is not available."),
                elements=[
                    Integer(title=_("Warning at"), unit=_("mails"), default_value=10),
                    Integer(title=_("Critical at"), unit=_("mails"), default_value=20),
                ],
            ),
        ),
        (
            "active",
            Tuple(
                title=_("Mails in active mail queue"),
                help=_("This rule is applied to the number of E-Mails currently "
                       "in the active mail queue"),
                elements=[
                    Integer(title=_("Warning at"), unit=_("mails"), default_value=800),
                    Integer(title=_("Critical at"), unit=_("mails"), default_value=1000),
                ],
示例#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"),
         )),
    ], )
示例#8
0
    def parameters(cls, mode):
        def bookmark_config_to_vs(v):
            if v:
                return (v["title"], v["url"], v["icon"], v["topic"])
            return v

        def bookmark_vs_to_config(v):
            return {
                "title": v[0],
                "url": v[1],
                "icon": v[2],
                "topic": v[3],
            }

        parameters = super(BookmarkList, cls).parameters(mode)

        parameters += [(
            _("Bookmarks"),
            [
                # sort-index, key, valuespec
                (2.5, "default_topic",
                 TextInput(
                     title=_("Default Topic") + "<sup>*</sup>",
                     size=50,
                     allow_empty=False,
                 )),
                (
                    3.0,
                    "bookmarks",
                    ListOf(
                        # For the editor we want a compact dialog. The tuple horizontal editin mechanism
                        # is exactly the thing we want. But we want to store the data as dict. This is a
                        # nasty hack to use the transform by default. Better would be to make Dict render
                        # the same way the tuple is rendered.
                        Transform(
                            Tuple(
                                elements=[
                                    (TextInput(
                                        title=_("Title") + "<sup>*</sup>",
                                        size=30,
                                        allow_empty=False,
                                    )),
                                    (TextInput(
                                        title=_("URL"),
                                        size=50,
                                        allow_empty=False,
                                        validate=cls.validate_url,
                                    )),
                                    (IconSelector(title=_("Icon"),
                                                  with_emblem=False)),
                                    (cls._vs_topic()),
                                ],
                                orientation="horizontal",
                                title=_("Bookmarks"),
                            ),
                            forth=bookmark_config_to_vs,
                            back=bookmark_vs_to_config,
                        )))
            ])]

        return parameters
示例#9
0
 def valuespec(self):
     return Dictionary(
         title=_("Automatic disk space cleanup"),
         help=
         _("You can configure your monitoring site to free disk space based on the ages "
           "of files or free space of the volume the site is placed on.<br>"
           "The monitoring site is executing the program <tt>diskspace</tt> 5 past "
           "every full hour as cron job. Details about the execution are logged to the file "
           "<tt>var/log/diskspace.log</tt>. You can always execut this program manually "
           "(add the <tt>-v</tt> option to see details about the actions taken)."
           ),
         elements=[
             (
                 "max_file_age",
                 Age(
                     minvalue=1,  # 1 sec
                     default_value=31536000,  # 1 year
                     title=_("Delete files older than"),
                     help=
                     _("The historic events (state changes, downtimes etc.) of your hosts and services "
                       "is stored in the monitoring "
                       "history as plain text log files. One history log file contains the monitoring "
                       "history of a given time period of all hosts and services. The files which are "
                       "older than the configured time will be removed on the next execution of the "
                       "disk space cleanup.<br>"
                       "The historic metrics are stored in files for each host and service "
                       "individually. When a host or service is removed from the monitoring, it's "
                       "metric files remain untouched on your disk until the files last update "
                       "(modification time) is longer ago than the configure age."
                       ))),
             (
                 "min_free_bytes",
                 Tuple(
                     elements=[
                         Filesize(
                             title=_("Cleanup when disk space is below"),
                             minvalue=1,  # min 1 byte
                             default_value=0,
                         ),
                         Age(
                             title=_("Never remove files newer than"),
                             minvalue=1,  # minimum 1 sec
                             default_value=2592000,  # 1 month
                             help=_(
                                 "With this option you can prevent cleanup of files which have been updated "
                                 "within this time range."),
                         ),
                     ],
                     title=_(
                         "Delete additional files when disk space is below"
                     ),
                     help=
                     _("When the disk space cleanup by file age was not able to gain enough "
                       "free disk space, then the cleanup mechanism starts cleaning up additional "
                       "files. The files are deleted by age, the oldest first, until the files are "
                       "newer than the configured minimum file age."))),
             (
                 "cleanup_abandoned_host_files",
                 Age(
                     title=_("Cleanup abandoned host files older than"),
                     minvalue=3600,  # 1 hour
                     default_value=2592000,  # 1 month
                     help=
                     _("During monitoring there are several dedicated files created for each host. "
                       "There are, for example, the discovered services, performance data and "
                       "different temporary files created. During deletion of a host, these files "
                       "are normally deleted. But there are cases, where the files are left on "
                       "the disk until manual deletion, for example if you move a host from one "
                       "site to another or deleting a host manually from the configuration.<br>"
                       "The performance data (RRDs) and HW/SW inventory archive are never deleted "
                       "during host deletion. They are only deleted automatically when you enable "
                       "this option and after the configured period."))),
         ],
         default_keys=["cleanup_abandoned_host_files"],
         empty_text=_("Disk space cleanup is disabled"),
     )
示例#10
0
def _parameter_valuespec_memory_simple():
    return Transform(
        valuespec=Dictionary(
            help=_(
                "Memory levels for simple devices not running more complex OSs"
            ),
            elements=[
                (
                    "levels",
                    CascadingDropdown(
                        title=_("Levels for RAM usage"),
                        choices=[
                            (
                                "perc_used",
                                _("Percentual levels for used RAM"),
                                Tuple(elements=[
                                    Percentage(
                                        title=_("Warning at a RAM usage of"),
                                        default_value=80.0,
                                        maxvalue=None,
                                    ),
                                    Percentage(
                                        title=_("Critical at a RAM usage of"),
                                        default_value=90.0,
                                        maxvalue=None,
                                    ),
                                ], ),
                            ),
                            (
                                "abs_free",
                                _("Absolute levels for free RAM"),
                                Tuple(elements=[
                                    Filesize(title=_("Warning below")),
                                    Filesize(title=_("Critical below")),
                                ], ),
                            ),
                        ],
                    ),
                ),
                (
                    "levels_swap",
                    CascadingDropdown(
                        title=_("Levels for swap usage"),
                        choices=[
                            (
                                "perc_used",
                                _("Percentual levels for used swap"),
                                Tuple(elements=[
                                    Percentage(
                                        title=_("Warning at a swap usage of"),
                                        maxvalue=None),
                                    Percentage(
                                        title=_("Critical at a swap usage of"),
                                        maxvalue=None),
                                ], ),
                            ),
                            (
                                "abs_free",
                                _("Absolute levels for free swap"),
                                Tuple(elements=[
                                    Filesize(title=_("Warning below")),
                                    Filesize(title=_("Critical below")),
                                ], ),
                            ),
                        ],
                    ),
                ),
                (
                    "swap_errors",
                    MonitoringState(
                        title=_("Monitoring state in case of swap errors"),
                        default_value=0,
                    ),
                ),
            ],
            optional_keys=True,
        ),
        # Convert default levels from discovered checks
        forth=lambda v: not isinstance(v, dict) and
        {"levels": ("perc_used", v)} or v,
    )
示例#11
0
文件: ps.py 项目: surajrb/checkmk
def process_level_elements():
    cpu_rescale_max_choices = [
        (True, _("100% is all cores at full load")),
        (False, _("N * 100% as each core contributes with 100% at full load")),
    ]  # type: DropdownChoices
    return [
        ("cpu_rescale_max",
         DropdownChoice(
             title=_("CPU rescale maximum load"),
             help=_(
                 "CPU utilization is delivered by the Operating "
                 "System as a per CPU core basis. Thus each core contributes "
                 "with a 100% at full utilization, producing a maximum load "
                 "of N*100% (N=number of cores). For simplicity this maximum "
                 "can be rescaled down, making 100% the maximum and thinking "
                 "in terms of total CPU utilization."),
             default_value=True,
             choices=cpu_rescale_max_choices,
             invalid_choice_title=_("Unspecified.") + " " +
             _("Starting from version 1.6.0 this value must be configured. "
               "Read Werk #6646 for further information."),
             invalid_choice_error=_("CPU rescale maximum load is Unspecified.")
             + " " +
             _("Starting from version 1.6.0 this value must be configured. "
               "Read Werk #6646 for further information."),
         )),
        ('levels',
         Tuple(
             title=_('Levels for process count'),
             help=_(
                 "Please note that if you specify and also if you modify levels "
                 "here, the change is activated only during an inventory."
                 "Saving this rule is not enough. This is due to the nature of"
                 "inventory rules."),
             elements=[
                 Integer(
                     title=_("Critical below"),
                     unit=_("processes"),
                     default_value=1,
                 ),
                 Integer(
                     title=_("Warning below"),
                     unit=_("processes"),
                     default_value=1,
                 ),
                 Integer(
                     title=_("Warning above"),
                     unit=_("processes"),
                     default_value=99999,
                 ),
                 Integer(
                     title=_("Critical above"),
                     unit=_("processes"),
                     default_value=99999,
                 ),
             ],
         )),
        ("cpulevels",
         Tuple(
             title=_("Levels on total CPU utilization"),
             help=_(
                 "By activating this options you can set levels on the total "
                 "CPU utilization of all included processes."),
             elements=[
                 Percentage(title=_("Warning at"),
                            default_value=90,
                            maxvalue=10000),
                 Percentage(title=_("Critical at"),
                            default_value=98,
                            maxvalue=10000),
             ],
         )),
        ("cpu_average",
         Integer(
             title=_("CPU Averaging"),
             help=
             _("By activating averaging, Check_MK will compute the average of "
               "the total CPU utilization over a given interval. If you have defined "
               "alerting levels then these will automatically be applied on the "
               "averaged value. This helps to mask out short peaks. "),
             unit=_("minutes"),
             minvalue=1,
             default_value=15,
         )),
        ("single_cpulevels",
         Tuple(
             title=_("Levels on CPU utilization of a single process"),
             help=_(
                 "Here you can define levels on the CPU utilization of single "
                 "processes. For performance reasons CPU Averaging will not be "
                 "applied to to the levels of single processes."),
             elements=[
                 Percentage(title=_("Warning at"),
                            default_value=90,
                            maxvalue=10000),
                 Percentage(title=_("Critical at"),
                            default_value=98,
                            maxvalue=10000),
             ],
         )),
        ("max_age",
         Tuple(
             title=_("Maximum allowed age"),
             help=_(
                 "Alarms you if the age of the process (not the consumed CPU "
                 "time, but the real time) exceed the configured levels."),
             elements=[
                 Age(title=_("Warning at"), default_value=3600),
                 Age(title=_("Critical at"), default_value=7200),
             ])),
        ("virtual_levels",
         Tuple(
             title=_("Virtual memory usage"),
             elements=[
                 Filesize(title=_("Warning at"),
                          default_value=1000 * 1024 * 1024 * 1024),
                 Filesize(title=_("Critical at"),
                          default_value=2000 * 1024 * 1024 * 1024),
             ],
         )),
        ("resident_levels",
         Tuple(
             title=_("Physical memory usage"),
             elements=[
                 Filesize(title=_("Warning at"),
                          default_value=100 * 1024 * 1024),
                 Filesize(title=_("Critical at"),
                          default_value=200 * 1024 * 1024),
             ],
         )),
        ("resident_levels_perc",
         Tuple(title=_("Physical memory usage, in percentage of total RAM"),
               elements=[
                   Percentage(title=_("Warning at"), default_value=25.0),
                   Percentage(title=_("Critical at"), default_value=50.0),
               ])),
        ("handle_count",
         Tuple(
             title=_('Handle Count (Windows only)'),
             help=
             _("The number of object handles in the processes object table. This includes "
               "open handles to threads, files and other resources like registry keys."
               ),
             elements=[
                 Integer(
                     title=_("Warning above"),
                     unit=_("handles"),
                 ),
                 Integer(
                     title=_("Critical above"),
                     unit=_("handles"),
                 ),
             ],
         )),
        ('process_info',
         DropdownChoice(
             title=_("Enable per-process details in long-output"),
             label=_("Enable per-process details"),
             help=
             _("If active, the long output of this service will contain a list of all the "
               "matching processes and their details (i.e. PID, CPU usage, memory usage). "
               "Please note that HTML output will only work if \"Escape HTML codes in "
               "plugin output\" is disabled in global settings. This might expose you to "
               "Cross-Site-Scripting (everyone with write-access to checks could get "
               "scripts executed on the monitoring site in the context of the user of the "
               "monitoring site) so please do this if you understand the consequences."
               ),
             choices=[
                 (None, _("Disable")),
                 ("text", _("Text output")),
                 ("html", _("HTML output")),
             ],
             default_value=None,
         )),
        ('process_info_arguments',
         Integer(
             title=_("Include process arguments in long-output"),
             label=_("Include per-process arguments (security risk!)"),
             help=
             _("If non-zero, the the list of all the matching processes and their details"
               " in the long-output will include up to the first N arguments of each"
               " processes. Please note this may include sensitive data like credentials,"
               " and is strongly discouraged."),
             default_value=0,
         )),
        ('icon',
         UserIconOrAction(
             title=_("Add custom icon or action"),
             help=
             _("You can assign icons or actions to the found services in the status GUI."
               ),
         )),
    ]
示例#12
0
文件: utils.py 项目: tklecker/checkmk
def get_free_used_dynamic_valuespec(
    what,
    name,
    default_value=(80.0, 90.0),
    *,
    maxvalue: Union[None, int, float] = 101.0,
):
    if what == "used":
        title = _("used space")
        course = _("above")

    else:
        title = _("free space")
        course = _("below")

    vs_subgroup: List[ValueSpec] = [
        Tuple(title=_("Percentage %s") % title,
              elements=[
                  Percentage(
                      title=_("Warning if %s") % course,
                      unit="%",
                      minvalue=0.0 if what == "used" else 0.0001,
                      maxvalue=maxvalue,
                  ),
                  Percentage(
                      title=_("Critical if %s") % course,
                      unit="%",
                      minvalue=0.0 if what == "used" else 0.0001,
                      maxvalue=maxvalue,
                  ),
              ]),
        Tuple(title=_("Absolute %s") % title,
              elements=[
                  Integer(
                      title=_("Warning if %s") % course,
                      unit=_("MB"),
                      minvalue=0 if what == "used" else 1,
                  ),
                  Integer(
                      title=_("Critical if %s") % course,
                      unit=_("MB"),
                      minvalue=0 if what == "used" else 1,
                  ),
              ])
    ]

    def validate_dynamic_levels(value, varprefix):
        if [v for v in value if v[0] < 0]:
            raise MKUserError(
                varprefix,
                _("You need to specify levels of at least 0 bytes."))

    return Alternative(
        title=_("Levels for %s %s") % (name, title),
        show_alternative_title=True,
        default_value=default_value,
        elements=vs_subgroup + [
            ListOf(
                Tuple(orientation="horizontal",
                      elements=[
                          Filesize(title=_("%s larger than") % name.title()),
                          Alternative(elements=vs_subgroup)
                      ]),
                title=_('Dynamic levels'),
                allow_empty=False,
                validate=validate_dynamic_levels,
            )
        ],
    )
示例#13
0
文件: utils.py 项目: tklecker/checkmk
             (True, _("Exclude reserved space")),
         ])),
]

fs_inodes_elements = [
    ("inodes_levels",
     Alternative(
         title=_("Levels for Inodes"),
         help=_(
             "The number of remaining inodes on the filesystem. "
             "Please note that this setting has no effect on some filesystem checks."
         ),
         elements=[
             Tuple(title=_("Percentage free"),
                   elements=[
                       Percentage(title=_("Warning if less than")),
                       Percentage(title=_("Critical if less than")),
                   ]),
             Tuple(
                 title=_("Absolute free"),
                 elements=[
                     Integer(title=_("Warning if less than"),
                             size=10,
                             unit=_("inodes"),
                             minvalue=0,
                             default_value=10000),
                     Integer(title=_("Critical if less than"),
                             size=10,
                             unit=_("inodes"),
                             minvalue=0,
                             default_value=5000),
示例#14
0
文件: drbd.py 项目: m3rlinux/checkmk
def _parameter_valuespec_drbd():
    return Dictionary(
        ignored_keys=[
            "roles_inventory",
            "diskstates_inventory",
        ],
        elements=[
            (
                "roles",
                Alternative(
                    title=_("Roles"),
                    elements=[
                        FixedValue(value=None, totext="", title=_("Do not monitor")),
                        ListOf(
                            valuespec=Tuple(
                                orientation="horizontal",
                                elements=[
                                    DropdownChoice(
                                        title=_("DRBD shows up as"),
                                        default_value="running",
                                        choices=[
                                            ("primary_secondary", _("Primary / Secondary")),
                                            ("primary_primary", _("Primary / Primary")),
                                            ("secondary_primary", _("Secondary / Primary")),
                                            ("secondary_secondary", _("Secondary / Secondary")),
                                        ],
                                    ),
                                    MonitoringState(
                                        title=_("Resulting state"),
                                    ),
                                ],
                                default_value=("ignore", 0),
                            ),
                            title=_("Set roles"),
                            add_label=_("Add role rule"),
                        ),
                    ],
                ),
            ),
            (
                "diskstates",
                Alternative(
                    title=_("Diskstates"),
                    elements=[
                        FixedValue(value=None, totext="", title=_("Do not monitor")),
                        ListOf(
                            valuespec=Tuple(
                                elements=[
                                    DropdownChoice(
                                        title=_("Diskstate"),
                                        choices=[
                                            ("primary_Diskless", _("Primary - Diskless")),
                                            ("primary_Attaching", _("Primary - Attaching")),
                                            ("primary_Failed", _("Primary - Failed")),
                                            ("primary_Negotiating", _("Primary - Negotiating")),
                                            ("primary_Inconsistent", _("Primary - Inconsistent")),
                                            ("primary_Outdated", _("Primary - Outdated")),
                                            ("primary_DUnknown", _("Primary - DUnknown")),
                                            ("primary_Consistent", _("Primary - Consistent")),
                                            ("primary_UpToDate", _("Primary - UpToDate")),
                                            ("secondary_Diskless", _("Secondary - Diskless")),
                                            ("secondary_Attaching", _("Secondary - Attaching")),
                                            ("secondary_Failed", _("Secondary - Failed")),
                                            ("secondary_Negotiating", _("Secondary - Negotiating")),
                                            (
                                                "secondary_Inconsistent",
                                                _("Secondary - Inconsistent"),
                                            ),
                                            ("secondary_Outdated", _("Secondary - Outdated")),
                                            ("secondary_DUnknown", _("Secondary - DUnknown")),
                                            ("secondary_Consistent", _("Secondary - Consistent")),
                                            ("secondary_UpToDate", _("Secondary - UpToDate")),
                                        ],
                                    ),
                                    MonitoringState(title=_("Resulting state")),
                                ],
                                orientation="horizontal",
                            ),
                            title=_("Set diskstates"),
                            add_label=_("Add diskstate rule"),
                        ),
                    ],
                ),
            ),
        ],
    )
示例#15
0
def _parameter_valuespec_netapp_luns():
    return Dictionary(
        title=_("Configure levels for used space"),
        elements=[
            ("ignore_levels",
             FixedValue(
                 title=
                 _("Ignore used space (this option disables any other options)"
                   ),
                 help=
                 _("Some luns, e.g. jfs formatted, tend to report incorrect used space values"
                   ),
                 totext=_("Ignore used space"),
                 value=True,
             )),
            ("levels",
             Alternative(
                 title=_("Levels for LUN"),
                 show_alternative_title=True,
                 default_value=(80.0, 90.0),
                 match=match_dual_level_type,
                 elements=[
                     get_free_used_dynamic_valuespec("used", "LUN"),
                     Transform(
                         get_free_used_dynamic_valuespec("free",
                                                         "LUN",
                                                         default_value=(20.0,
                                                                        10.0)),
                         forth=transform_filesystem_free,
                         back=transform_filesystem_free,
                     )
                 ],
             )),
            ("trend_range",
             Optional(Integer(
                 title=_("Time Range for lun filesystem trend computation"),
                 default_value=24,
                 minvalue=1,
                 unit=_("hours")),
                      title=_("Trend computation"),
                      label=_("Enable trend computation"))),
            ("trend_mb",
             Tuple(
                 title=_("Levels on trends in MB per time range"),
                 elements=[
                     Integer(title=_("Warning at"),
                             unit=_("MB / range"),
                             default_value=100),
                     Integer(title=_("Critical at"),
                             unit=_("MB / range"),
                             default_value=200)
                 ],
             )),
            ("trend_perc",
             Tuple(
                 title=_("Levels for the percentual growth per time range"),
                 elements=[
                     Percentage(
                         title=_("Warning at"),
                         unit=_("% / range"),
                         default_value=5,
                     ),
                     Percentage(
                         title=_("Critical at"),
                         unit=_("% / range"),
                         default_value=10,
                     ),
                 ],
             )),
            ("trend_timeleft",
             Tuple(
                 title=
                 _("Levels on the time left until the lun filesystem gets full"
                   ),
                 elements=[
                     Integer(
                         title=_("Warning if below"),
                         unit=_("hours"),
                         default_value=12,
                     ),
                     Integer(
                         title=_("Critical if below"),
                         unit=_("hours"),
                         default_value=6,
                     ),
                 ],
             )),
            ("trend_showtimeleft",
             Checkbox(
                 title=_("Display time left in check output"),
                 label=_("Enable"),
                 help=
                 _("Normally, the time left until the lun filesystem is full is only displayed when "
                   "the configured levels have been breached. If you set this option "
                   "the check always reports this information"))),
            ("trend_perfdata",
             Checkbox(
                 title=_("Trend performance data"),
                 label=_("Enable generation of performance data from trends"))
             ),
            ("read_only",
             Checkbox(
                 title=_("LUN is read-only"),
                 help=_("Display a warning if a LUN is not read-only. Without "
                        "this setting a warning will be displayed if a LUN is "
                        "read-only."),
                 label=_("Enable"))),
        ],
    )
示例#16
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"),
             # ))
         ],)
示例#17
0
def _parameter_valuespec_windows_printer_queues():
    return Transform(
        Dictionary(
            title=_("Windows Printer Configuration"),
            elements=[
                (
                    "levels",
                    Tuple(
                        title=_("Levels for the number of print jobs"),
                        help=_(
                            "This rule is applied to the number of print jobs "
                            "currently waiting in windows printer queue."),
                        elements=[
                            Integer(title=_("Warning at"),
                                    unit=_("jobs"),
                                    default_value=40),
                            Integer(title=_("Critical at"),
                                    unit=_("jobs"),
                                    default_value=60),
                        ],
                    ),
                ),
                ("crit_states",
                 ListChoice(
                     title=_("States who should lead to critical"),
                     choices=[
                         (0, "Unkown"),
                         (1, "Other"),
                         (2, "No Error"),
                         (3, "Low Paper"),
                         (4, "No Paper"),
                         (5, "Low Toner"),
                         (6, "No Toner"),
                         (7, "Door Open"),
                         (8, "Jammed"),
                         (9, "Offline"),
                         (10, "Service Requested"),
                         (11, "Output Bin Full"),
                     ],
                     default_value=[9, 10],
                 )),
                ("warn_states",
                 ListChoice(
                     title=_("States who should lead to warning"),
                     choices=[
                         (0, "Unkown"),
                         (1, "Other"),
                         (2, "No Error"),
                         (3, "Low Paper"),
                         (4, "No Paper"),
                         (5, "Low Toner"),
                         (6, "No Toner"),
                         (7, "Door Open"),
                         (8, "Jammed"),
                         (9, "Offline"),
                         (10, "Service Requested"),
                         (11, "Output Bin Full"),
                     ],
                     default_value=[8, 11],
                 )),
            ],
        ),
        forth=windows_printer_queues_forth,
    )
示例#18
0
def db_levels_common():
    return [
        ("levels",
         Alternative(
             title=_("Levels for the Tablespace usage"),
             default_value=(10.0, 5.0),
             elements=[
                 Tuple(title=_("Percentage free space"),
                       elements=[
                           Percentage(title=_("Warning if below"),
                                      unit=_("% free")),
                           Percentage(title=_("Critical if below"),
                                      unit=_("% free")),
                       ]),
                 Tuple(title=_("Absolute free space"),
                       elements=[
                           Integer(title=_("Warning if below"),
                                   unit=_("MB"),
                                   default_value=1000),
                           Integer(title=_("Critical if below"),
                                   unit=_("MB"),
                                   default_value=500),
                       ]),
                 ListOf(
                     Tuple(
                         orientation="horizontal",
                         elements=[
                             Filesize(title=_("Tablespace larger than")),
                             Alternative(
                                 title=_("Levels for the Tablespace size"),
                                 elements=[
                                     Tuple(
                                         title=_("Percentage free space"),
                                         elements=[
                                             Percentage(
                                                 title=_("Warning if below"),
                                                 unit=_("% free")),
                                             Percentage(
                                                 title=_("Critical if below"),
                                                 unit=_("% free")),
                                         ]),
                                     Tuple(
                                         title=_("Absolute free space"),
                                         elements=[
                                             Integer(
                                                 title=_("Warning if below"),
                                                 unit=_("MB")),
                                             Integer(
                                                 title=_("Critical if below"),
                                                 unit=_("MB")),
                                         ]),
                                 ]),
                         ],
                     ),
                     title=_('Dynamic levels'),
                 ),
             ])),
        ("magic",
         Float(title=_(
             "Magic factor (automatic level adaptation for large tablespaces)"
         ),
               help=_("This is only be used in case of percentual levels"),
               minvalue=0.1,
               maxvalue=1.0,
               default_value=0.9)),
        ("magic_normsize",
         Integer(title=_("Reference size for magic factor"),
                 minvalue=1,
                 default_value=1000,
                 unit=_("MB"))),
        ("magic_maxlevels",
         Tuple(
             title=_("Maximum levels if using magic factor"),
             help=_(
                 "The tablespace levels will never be raise above these values, when using "
                 "the magic factor and the tablespace is very small."),
             elements=[
                 Percentage(title=_("Maximum warning level"),
                            unit=_("% free"),
                            allow_int=True,
                            default_value=60.0),
                 Percentage(title=_("Maximum critical level"),
                            unit=_("% free"),
                            allow_int=True,
                            default_value=50.0),
             ])),
    ]
示例#19
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),
                ),
            ),
        ],
    )
示例#20
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),
    ], )
示例#21
0
def _parameter_valuespec_cisco_qos():
    return Dictionary(elements=[
        ("unit",
         DropdownChoice(
             title=_("Measurement unit"),
             help=
             _("Here you can specifiy the measurement unit of the network interface"
               ),
             default_value="bit",
             choices=[
                 ("bit", _("Bits")),
                 ("byte", _("Bytes")),
             ],
         )),
        ("post",
         Alternative(
             title=_("Used bandwidth (traffic)"),
             help=_(
                 "Settings levels on the used bandwidth is optional. If you do set "
                 "levels you might also consider using averaging."),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(
                     title=_("Absolute levels in bits or bytes per second"),
                     help=
                     _("Depending on the measurement unit (defaults to bit) the absolute levels are set in bit or byte"
                       ),
                     elements=[
                         Integer(title=_("Warning at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                         Integer(title=_("Critical at"),
                                 size=10,
                                 label=_("bits / bytes per second")),
                     ],
                 )
             ],
         )),
        ("average",
         Integer(
             title=_("Average values"),
             help=_(
                 "By activating the computation of averages, the levels on "
                 "errors and traffic are applied to the averaged value. That "
                 "way you can make the check react only on long-time changes, "
                 "not on one-minute events."),
             unit=_("minutes"),
             minvalue=1,
         )),
        ("drop",
         Alternative(
             title=_("Number of dropped bits or bytes per second"),
             help=_(
                 "Depending on the measurement unit (defaults to bit) you can set the warn and crit "
                 "levels for the number of dropped bits or bytes"),
             elements=[
                 Tuple(
                     title=_(
                         "Percentual levels (in relation to policy speed)"),
                     elements=[
                         Percentage(title=_("Warning at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                         Percentage(title=_("Critical at"),
                                    maxvalue=1000,
                                    label=_("% of port speed")),
                     ],
                 ),
                 Tuple(elements=[
                     Integer(title=_("Warning at"),
                             size=8,
                             label=_("bits / bytes per second")),
                     Integer(title=_("Critical at"),
                             size=8,
                             label=_("bits / bytes per second")),
                 ], )
             ],
         )),
    ], )
示例#22
0
def _parameter_valuespec_db_connections():
    return Transform(
        Dictionary(
            help=_(
                "This rule allows you to configure the number of maximum concurrent "
                "connections for a given database."),
            elements=[
                (
                    "levels_perc_active",
                    Tuple(
                        title=_(
                            "Percentage of maximum available active connections"
                        ),
                        elements=[
                            Percentage(
                                title=_("Warning at"),
                                # xgettext: no-python-format
                                unit=_("% of maximum active connections"),
                            ),
                            Percentage(
                                title=_("Critical at"),
                                # xgettext: no-python-format
                                unit=_("% of maximum active connections"),
                            ),
                        ],
                    ),
                ),
                (
                    "levels_abs_active",
                    Tuple(
                        title=_("Absolute number of active connections"),
                        elements=[
                            Integer(title=_("Warning at"),
                                    minvalue=0,
                                    unit=_("connections")),
                            Integer(title=_("Critical at"),
                                    minvalue=0,
                                    unit=_("connections")),
                        ],
                    ),
                ),
                (
                    "levels_perc_idle",
                    Tuple(
                        title=_(
                            "Percentage of maximum available idle connections"
                        ),
                        elements=[
                            Percentage(
                                title=_("Warning at"),
                                # xgettext: no-python-format
                                unit=_("% of maximum idle connections"),
                            ),
                            Percentage(
                                title=_("Critical at"),
                                # xgettext: no-python-format
                                unit=_("% of maximum idle connections"),
                            ),
                        ],
                    ),
                ),
                (
                    "levels_abs_idle",
                    Tuple(
                        title=_("Absolute number of idle connections"),
                        elements=[
                            Integer(title=_("Warning at"),
                                    minvalue=0,
                                    unit=_("idle connections")),
                            Integer(title=_("Critical at"),
                                    minvalue=0,
                                    unit=_("idle connections")),
                        ],
                    ),
                ),
            ],
        ),
        forth=_transform_connection_type,
    )
示例#23
0
def _parameter_valuespec_rabbitmq_cluster_stats():
    return Dictionary(elements=[
        ("channels_upper",
         Tuple(
             title=_("Upper level for total number of channels"),
             elements=[
                 Integer(title=_("Warning at"), unit="channels"),
                 Integer(title=_("Critical at"), unit="channels"),
             ],
         )),
        ("channels_lower",
         Tuple(
             title=_("Lower level for total number of channels"),
             elements=[
                 Integer(title=_("Warning below"), unit="channels"),
                 Integer(title=_("Critical below"), unit="channels"),
             ],
         )),
        ("connections_upper",
         Tuple(
             title=_("Upper level for total number of connections"),
             elements=[
                 Integer(title=_("Warning at"), unit="connections"),
                 Integer(title=_("Critical at"), unit="connections"),
             ],
         )),
        ("connections_lower",
         Tuple(
             title=_("Lower level for total number of connections"),
             elements=[
                 Integer(title=_("Warning below"), unit="connections"),
                 Integer(title=_("Critical below"), unit="connections"),
             ],
         )),
        ("consumers_upper",
         Tuple(
             title=_("Upper level for total number of consumers"),
             elements=[
                 Integer(title=_("Warning at"), unit="consumers"),
                 Integer(title=_("Critical at"), unit="consumers"),
             ],
         )),
        ("consumers_lower",
         Tuple(
             title=_("Lower level for total number of consumers"),
             elements=[
                 Integer(title=_("Warning below"), unit="consumers"),
                 Integer(title=_("Critical below"), unit="consumers"),
             ],
         )),
        ("exchanges_upper",
         Tuple(
             title=_("Upper level for total number of exchanges"),
             elements=[
                 Integer(title=_("Warning at"), unit="exchanges"),
                 Integer(title=_("Critical at"), unit="exchanges"),
             ],
         )),
        ("exchanges_lower",
         Tuple(
             title=_("Lower level for total number of exchanges"),
             elements=[
                 Integer(title=_("Warning below"), unit="exchanges"),
                 Integer(title=_("Critical below"), unit="exchanges"),
             ],
         )),
        ("queues_upper",
         Tuple(
             title=_("Upper level for total number of queues"),
             elements=[
                 Integer(title=_("Warning at"), unit="queues"),
                 Integer(title=_("Critical at"), unit="queues"),
             ],
         )),
        ("queues_lower",
         Tuple(
             title=_("Lower level for total number of queues"),
             elements=[
                 Integer(title=_("Warning below"), unit="queues"),
                 Integer(title=_("Critical below"), unit="queues"),
             ],
         )),
    ], )
 def parameter_valuespec(self):
     return Dictionary(
         help=
         _("This check monitors locking related information of MSSQL tablespaces."
           ),
         elements=[
             (
                 "lock_requests/sec",
                 Tuple(
                     title=_("Lock Requests / sec"),
                     help=
                     _("Number of new locks and lock conversions per second requested from the lock manager."
                       ),
                     elements=[
                         Float(title=_("Warning at"),
                               unit=_("requests/sec")),
                         Float(title=_("Critical at"),
                               unit=_("requests/sec")),
                     ],
                 ),
             ),
             (
                 "lock_timeouts/sec",
                 Tuple(
                     title=_("Lock Timeouts / sec"),
                     help=
                     _("Number of lock requests per second that timed out, including requests for NOWAIT locks."
                       ),
                     elements=[
                         Float(title=_("Warning at"),
                               unit=_("timeouts/sec")),
                         Float(title=_("Critical at"),
                               unit=_("timeouts/sec")),
                     ],
                 ),
             ),
             (
                 "number_of_deadlocks/sec",
                 Tuple(
                     title=_("Number of Deadlocks / sec"),
                     help=
                     _("Number of lock requests per second that resulted in a deadlock."
                       ),
                     elements=[
                         Float(title=_("Warning at"),
                               unit=_("deadlocks/sec")),
                         Float(title=_("Critical at"),
                               unit=_("deadlocks/sec")),
                     ],
                 ),
             ),
             (
                 "lock_waits/sec",
                 Tuple(
                     title=_("Lock Waits / sec"),
                     help=
                     _("Number of lock requests per second that required the caller to wait."
                       ),
                     elements=[
                         Float(title=_("Warning at"), unit=_("waits/sec")),
                         Float(title=_("Critical at"), unit=_("waits/sec")),
                     ],
                 ),
             ),
         ],
     )
示例#25
0
def _parameter_valuespec_ibm_mq_queues():
    return Dictionary(
        help=_(
            "See 'Queue status attributes' in IBM manual"
            "(https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.2.0/com.ibm.mq.explorer.doc/e_status_queue.html)"
            " for detailed explanations of these parameters."),
        elements=[
            ("curdepth",
             OptionalDropdownChoice(
                 title=_("Current queue depth"),
                 help=_(
                     "CURDEPTH: The number of messages currently on the queue."
                 ),
                 choices=[((None, None), _("Ignore these levels"))],
                 otherlabel=_("Set absolute levels"),
                 explicit=Tuple(
                     title=_('Maximum number of messages'),
                     elements=[
                         Integer(title=_("Warning at")),
                         Integer(title=_("Critical at")),
                     ],
                 ),
             )),
            ("curdepth_perc",
             OptionalDropdownChoice(
                 help=_(
                     "CURDEPTH_PERC: Percentage (CURDEPTH/MAXDEPTH) of the number of"
                     " messages currently on the queue."),
                 title=_('Current queue depth in %'),
                 choices=[((None, None), _("Ignore these levels"))],
                 otherlabel=_("Set relative levels"),
                 default_value=(80.0, 90.0),
                 explicit=Tuple(
                     title=_('Percentage of queue depth'),
                     elements=[
                         Percentage(title=_("Warning at")),
                         Percentage(title=_("Critical at")),
                     ],
                 ),
             )),
            ("msgage",
             Tuple(
                 help=
                 _("MSGAGE: The age, in seconds, of the oldest message on the queue."
                   ),
                 title=_("Oldest message age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("lgetage",
             Tuple(
                 help=
                 _("The age, in seconds, when the last message was retrieved from the queue."
                   " Calculated by subtracting LGETDATE/LGETTIME from current timestamp."
                   ),
                 title=_("Last get age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("lputage",
             Tuple(
                 help=
                 _("The age, in seconds, when the last message was put to the queue. "
                   " Calculated by subtracting LPUTDATE/LPUTTIME from current timestamp."
                   ),
                 title=_("Last put age"),
                 elements=[
                     Age(title=_("Warning at")),
                     Age(title=_("Critical at")),
                 ],
             )),
            ("ipprocs",
             Dictionary(
                 help=_(
                     "IPPROCS: The number of applications that are currently connected to"
                     " the queue to get messages from the queue."),
                 title=_("Open input count"),
                 elements=[
                     ("lower",
                      Tuple(
                          title=_("Lower levels"),
                          elements=[
                              Integer(title=_("Warning if below")),
                              Integer(title=_("Critical if below")),
                          ],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[
                              Integer(title=_("Warning at")),
                              Integer(title=_("Critical at")),
                          ],
                      )),
                 ],
             )),
            ("opprocs",
             Dictionary(
                 help=_(
                     "OPPROCS: The number of applications that are currently connected"
                     " to the queue to put messages on the queue."),
                 title=_("Open output count"),
                 elements=[
                     ("lower",
                      Tuple(
                          title=_("Lower levels"),
                          elements=[
                              Integer(title=_("Warning if below")),
                              Integer(title=_("Critical if below")),
                          ],
                      )),
                     ("upper",
                      Tuple(
                          title=_("Upper levels"),
                          elements=[
                              Integer(title=_("Warning at")),
                              Integer(title=_("Critical at")),
                          ],
                      )),
                 ],
             )),
        ],
    )
示例#26
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"),
                    ],
                ),
            ),
        ],
    )
示例#27
0
def _parameter_valuespec_memory_pagefile_win():
    return Dictionary(
        elements=[
            (
                "memory",
                Alternative(
                    title=_("Memory Levels"),
                    elements=[
                        Tuple(
                            title=_("Memory usage in percent"),
                            elements=[
                                Percentage(title=_("Warning at")),
                                Percentage(title=_("Critical at")),
                            ],
                        ),
                        Transform(
                            Tuple(
                                title=_("Absolute free memory"),
                                elements=[
                                    Filesize(title=_("Warning if less than")),
                                    Filesize(title=_("Critical if less than")),
                                ],
                            ),
                            # Note: Filesize values lesser 1MB will not work
                            # -> need hide option in filesize valuespec
                            back=lambda x:
                            (x[0] // 1024 // 1024, x[1] // 1024 // 1024),
                            forth=lambda x:
                            (x[0] * 1024 * 1024, x[1] * 1024 * 1024)),
                        PredictiveLevels(unit=_("GB"),
                                         default_difference=(0.5, 1.0))
                    ],
                    default_value=(80.0, 90.0))),
            (
                "pagefile",
                Alternative(
                    title=_("Commit charge Levels"),
                    elements=[
                        Tuple(
                            title=
                            _("Commit charge in percent (relative to commit limit)"
                              ),
                            elements=[
                                Percentage(title=_("Warning at")),
                                Percentage(title=_("Critical at")),
                            ],
                        ),
                        Transform(
                            Tuple(
                                title=_("Absolute commitable memory"),
                                elements=[
                                    Filesize(title=_("Warning if less than")),
                                    Filesize(title=_("Critical if less than")),
                                ],
                            ),
                            # Note: Filesize values lesser 1MB will not work
                            # -> need hide option in filesize valuespec
                            back=lambda x:
                            (x[0] // 1024 // 1024, x[1] // 1024 // 1024),
                            forth=lambda x:
                            (x[0] * 1024 * 1024, x[1] * 1024 * 1024)),
                        PredictiveLevels(unit=_("GB"),
                                         default_difference=(0.5, 1.0))
                    ],
                    default_value=(80.0, 90.0))),
            ("average",
             Integer(
                 title=_("Averaging"),
                 help=
                 _("If this parameter is set, all measured values will be averaged "
                   "over the specified time interval before levels are being applied. Per "
                   "default, averaging is turned off. "),
                 unit=_("minutes"),
                 minvalue=1,
                 default_value=60,
             )),
        ], )
示例#28
0
def _parameter_valuespec_ibm_svc_host():
    return Transform(
        Dictionary(elements=[
            (
                "active_hosts",
                Tuple(
                    title=_("Count of active hosts"),
                    elements=[
                        Integer(title=_("Warning at or below"),
                                minvalue=0,
                                unit=_("active hosts")),
                        Integer(title=_("Critical at or below"),
                                minvalue=0,
                                unit=_("active hosts")),
                    ],
                ),
            ),
            (
                "inactive_hosts",
                Tuple(
                    title=_("Count of inactive hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("inactive hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("inactive hosts")),
                    ],
                ),
            ),
            (
                "degraded_hosts",
                Tuple(
                    title=_("Count of degraded hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("degraded hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("degraded hosts")),
                    ],
                ),
            ),
            (
                "offline_hosts",
                Tuple(
                    title=_("Count of offline hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("offline hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("offline hosts")),
                    ],
                ),
            ),
            (
                "other_hosts",
                Tuple(
                    title=_("Count of other hosts"),
                    elements=[
                        Integer(title=_("Warning at or above"),
                                minvalue=0,
                                unit=_("other hosts")),
                        Integer(title=_("Critical at or above"),
                                minvalue=0,
                                unit=_("other hosts")),
                    ],
                ),
            ),
        ], ),
        forth=transform_ibm_svc_host,
    )
示例#29
0
def _parameter_valuespec_antivir_update_age():
    return Tuple(elements=[
        Age(title=_("Warning level for time since last update")),
        Age(title=_("Critical level for time since last update")),
    ], )
示例#30
0
def _parameter_valuespec_jenkins_jobs():
    return Dictionary(elements=[
        (
            "jenkins_job_score",
            Tuple(
                title=_("Job score"),
                elements=[
                    Integer(title=_("Warning below"), unit="%"),
                    Integer(title=_("Critical below"), unit="%"),
                ],
            ),
        ),
        (
            "jenkins_last_build",
            Tuple(
                title=_("Time since last build"),
                elements=[
                    Age(title=_("Warning if older than")),
                    Age(title=_("Critical if older than")),
                ],
            ),
        ),
        (
            "jenkins_time_since",
            Tuple(
                title=_("Time since last successful build"),
                elements=[
                    Age(title=_("Warning if older than")),
                    Age(title=_("Critical if older than")),
                ],
            ),
        ),
        (
            "jenkins_build_duration",
            Tuple(
                title=_("Duration of last build"),
                elements=[
                    Age(title=_("Warning at")),
                    Age(title=_("Critical at")),
                ],
            ),
        ),
        (
            "job_state",
            Dictionary(
                title=_("Override check state based on job state"),
                elements=[
                    (
                        "aborted",
                        MonitoringState(
                            title=_("State when job is in state aborted"),
                            default_value=0),
                    ),
                    (
                        "blue",
                        MonitoringState(
                            title=_("State when job is in state success"),
                            default_value=0),
                    ),
                    (
                        "disabled",
                        MonitoringState(
                            title=_("State when job is in state disabled"),
                            default_value=0),
                    ),
                    (
                        "notbuilt",
                        MonitoringState(
                            title=_("State when job is in state not built"),
                            default_value=0),
                    ),
                    (
                        "red",
                        MonitoringState(
                            title=_("State when job is in state failed"),
                            default_value=2),
                    ),
                    (
                        "yellow",
                        MonitoringState(
                            title=_("State when job is in state unstable"),
                            default_value=1),
                    ),
                ],
            ),
        ),
        (
            "build_result",
            Dictionary(
                title=_("Override check state based on last build result"),
                elements=[
                    (
                        "success",
                        MonitoringState(title=_(
                            "State when last build result is: success"),
                                        default_value=0),
                    ),
                    (
                        "unstable",
                        MonitoringState(
                            title=_(
                                "State when last build result is: unstable"),
                            default_value=1,
                        ),
                    ),
                    (
                        "failure",
                        MonitoringState(
                            title=_("State when last build result is: failed"),
                            default_value=2),
                    ),
                    (
                        "aborted",
                        MonitoringState(title=_(
                            "State when last build result is: aborted"),
                                        default_value=0),
                    ),
                    (
                        "null",
                        MonitoringState(
                            title=
                            _("State when last build result is: module not built"
                              ),
                            default_value=1,
                        ),
                    ),
                    (
                        "none",
                        MonitoringState(
                            title=_("State when build result is: running"),
                            default_value=0),
                    ),
                ],
            ),
        ),
    ], )