コード例 #1
0
ファイル: ruckus_ap.py プロジェクト: m4c3/checkMK
 def parameter_valuespec(self):
     return Tuple(elements=[
         Optional(Tuple(elements=[
             Integer(title=_("Warning at"),
                     default_value=1,
                     unit=_("devices")),
             Integer(title=_("Critical at"),
                     default_value=1,
                     unit=_("devices")),
         ], ),
                  sameline=True,
                  label=_("Levels for <i>device time drifted</i>"),
                  none_label=_("No levels set"),
                  none_value=(None, None)),
         Optional(Tuple(elements=[
             Integer(title=_("Warning at"),
                     default_value=1,
                     unit=_("devices")),
             Integer(title=_("Critical at"),
                     default_value=1,
                     unit=_("devices")),
         ], ),
                  sameline=True,
                  label=_("Levels for <i>device not responding</i>"),
                  none_label=_("No levels set"),
                  none_value=(None, None)),
     ], )
コード例 #2
0
 def parameter_valuespec(self):
     return Tuple(elements=[
         Integer(
             title=_("Maximum age"),
             help=_("Maximum accepted age of the reported data in seconds"),
             unit=_("seconds"),
             default_value=60,
         ),
         Optional(
             TextAscii(allow_empty=False),
             title=_("Expected DC"),
             help=
             _("The hostname of the expected distinguished controller of the cluster"
               ),
         ),
         Optional(
             Integer(min_value=2, default_value=2),
             title=_("Number of Nodes"),
             help=_("The expected number of nodes in the cluster"),
         ),
         Optional(
             Integer(min_value=0, ),
             title=_("Number of Resources"),
             help=_("The expected number of resources in the cluster"),
         ),
     ], )
コード例 #3
0
ファイル: availability.py プロジェクト: a-s-995/checkmk-1
def _vs_annotation():
    extra_elements = []  # type: List[Tuple[str, ValueSpec]]
    if not cmk_version.is_raw_edition():
        extra_elements.append(("hide_from_report",
                               Checkbox(title=_("Hide annotation in report"))))

    return Dictionary(
        elements=[
            ("site", TextAscii(title=_("Site"))),
            ("host", TextUnicode(title=_("Hostname"))),
            ("service",
             Optional(TextUnicode(allow_empty=False),
                      sameline=True,
                      title=_("Service"))),
            ("from", AbsoluteDate(title=_("Start-Time"), include_time=True)),
            ("until", AbsoluteDate(title=_("End-Time"), include_time=True)),
            ("downtime",
             Optional(
                 DropdownChoice(choices=[
                     (True, _("regard as scheduled downtime")),
                     (False, _("do not regard as scheduled downtime")),
                 ], ),
                 title=_("Scheduled downtime"),
                 label=_("Reclassify downtime of this period"),
             )),
            ("text", TextAreaUnicode(title=_("Annotation"),
                                     allow_empty=False)),
        ] + extra_elements,
        title=_("Edit annotation"),
        optional_keys=[],
    )
コード例 #4
0
def _parameter_valuespec_proxmox_ve_node_info():
    # use Dictionary as Optional returning an empty dict if empty
    return Dictionary(elements=[
        (
            "required_node_status",
            Optional(
                title=_("Node Status"),
                label=_("Activate Check (off: ignore node status)"),
                default_value=True,
                valuespec=TextInput(
                    title=_("Warn if node status value is not"),
                    default_value="online",
                ),
            ),
        ),
        (
            "required_subscription_status",
            Optional(
                title=_("Subscription Status"),
                label=_("Activate Check (off: ignore subscription status)"),
                default_value=True,
                valuespec=TextInput(
                    title=_("Warn if subscription status value is not"),
                    default_value="Active",
                ),
            ),
        ),
    ])
コード例 #5
0
 def parameter_valuespec(self):
     return Optional(
         TextAscii(allow_empty=False),
         title=_("Expected node"),
         help=_("The hostname of the expected node to hold this resource."),
         none_label=_("Do not enforce the resource to be hold by a specific node."),
     )
コード例 #6
0
ファイル: timeperiods.py プロジェクト: tklecker/checkmk
 def _vs_ical(self):
     return Dictionary(
         title=_('Import iCalendar File'),
         render="form",
         optional_keys=False,
         elements=[
             ('file',
              FileUpload(
                  title=_('iCalendar File'),
                  help=_("Select an iCalendar file (<tt>*.ics</tt>) from your PC"),
                  custom_validate=self._validate_ical_file,
              )),
             ('horizon',
              Integer(
                  title=_('Time horizon for repeated events'),
                  help=
                  _("When the iCalendar file contains definitions of repeating events, these repeating "
                    "events will be resolved to single events for the number of years you specify here."
                   ),
                  minvalue=0,
                  maxvalue=50,
                  default_value=10,
                  unit=_('years'),
              )),
             ('times',
              Optional(
                  ListOfTimeRanges(default_value=[None],),
                  title=_('Use specific times'),
                  label=_('Use specific times instead of whole day'),
                  help=
                  _("When you specify explicit time definitions here, these will be added to each "
                    "date which is added to the resulting time period. By default the whole day is "
                    "used."),
              )),
         ])
コード例 #7
0
def _parameter_valuespec_vms_procs():
    return Optional(
        Tuple(elements=[
            Integer(title=_("Warning at"), unit=_("processes"), default_value=100),
            Integer(title=_("Critical at"), unit=_("processes"), default_value=200)
        ],),
        title=_("Impose levels on number of processes"),
    )
コード例 #8
0
def _parameter_valuespec_heartbeat_crm_resources():
    return Optional(
        valuespec=TextInput(allow_empty=False),
        title=_("Expected node"),
        help=_("The hostname of the expected node to hold this resource."),
        none_label=_(
            "Do not enforce the resource to be hold by a specific node."),
    )
コード例 #9
0
def _parameter_valuespec_temperature_trends():
    return Dictionary(
        title=_("Temperature Trend Analysis"),
        help=
        _("This rule enables and configures a trend analysis and corresponding limits for devices, "
          "which have their own limits configured on the device. It will only work for supported "
          "checks, right now the <tt>adva_fsp_temp</tt> check."),
        elements=[
            (
                "trend_range",
                Optional(
                    Integer(
                        title=_(
                            "Time range for temperature trend computation"),
                        default_value=30,
                        minvalue=5,
                        unit=_("minutes"),
                    ),
                    title=_("Trend computation"),
                    label=_("Enable trend computation"),
                ),
            ),
            (
                "trend_c",
                Tuple(
                    title=_(
                        "Levels on trends in degrees Celsius per time range"),
                    elements=[
                        Integer(title=_("Warning at"),
                                unit="°C / " + _("range"),
                                default_value=5),
                        Integer(title=_("Critical at"),
                                unit="°C / " + _("range"),
                                default_value=10),
                    ],
                ),
            ),
            (
                "trend_timeleft",
                Tuple(
                    title=_("Levels on the time left until limit is reached"),
                    elements=[
                        Integer(
                            title=_("Warning if below"),
                            unit=_("minutes"),
                            default_value=240,
                        ),
                        Integer(
                            title=_("Critical if below"),
                            unit=_("minutes"),
                            default_value=120,
                        ),
                    ],
                ),
            ),
        ],
    )
コード例 #10
0
def _parameter_valuespec_msexch_database_size():
    return Optional(
        Tuple(elements=[
            Filesize(title=_("warning at")),
            Filesize(title=_("critical at")),
        ],),
        help=_("The check will trigger a warning or critical state if the size of the "
               "database exceeds these levels."),
        title=_("Impose limits on the size of the database"),
    )
コード例 #11
0
ファイル: omd_configuration.py プロジェクト: xorsiz0r/checkmk
 def valuespec(self):
     return Optional(
         LivestatusViaTCP(),
         title=_("Access to Livestatus via TCP"),
         help=_("Check_MK Livestatus usually listens only on a local UNIX socket - "
                "for reasons of performance and security. This option is used "
                "to make it reachable via TCP on a port configurable with LIVESTATUS_TCP_PORT."),
         label=_("Enable Livestatus access via network (TCP)"),
         none_label=_("Livestatus is available locally"),
     )
コード例 #12
0
def _vs_notify():
    dest_choices: List[CascadingDropdownChoice] = [
        ('broadcast', _('Everybody (Broadcast)')),
        ('list', _('A list of specific users'),
         DualListChoice(
             choices=sorted([(uid, u.get('alias', uid))
                             for uid, u in config.multisite_users.items()],
                            key=lambda x: x[1].lower()),
             allow_empty=False,
         )),
        #('contactgroup', _('All members of a contact group')),
        ('online', _('All online users')),
    ]

    return Dictionary(
        elements=[
            ('text',
             TextAreaUnicode(
                 title=_('Text'),
                 help=_('Insert the text to be sent to all reciepents.'),
                 allow_empty=False,
                 empty_text=_('You need to provide a text.'),
                 cols=50,
                 rows=10)),
            ('dest',
             CascadingDropdown(
                 title=_('Send notification to'),
                 help=_(
                     'You can send the notification to a list of multiple users, which '
                     'can be choosen out of these predefined filters.'),
                 choices=dest_choices,
             )),
            ('methods',
             ListChoice(
                 title=_('How to notify'),
                 allow_empty=False,
                 choices=[(k, v['title'])
                          for k, v in _notify_methods().items()],
                 default_value=['popup'],
             )),
            ('valid_till',
             Optional(
                 AbsoluteDate(include_time=True, ),
                 title=_('Automatically invalidate notification'),
                 label=_('Enable automatic invalidation at'),
                 help=
                 _('It is possible to automatically delete messages when the '
                   'configured time is reached. This makes it possible to inform '
                   'users about a scheduled event but suppress the notification '
                   'after the event has happened.'),
             )),
        ],
        validate=_validate_msg,
        optional_keys=[],
    )
コード例 #13
0
ファイル: cpu_utilization.py プロジェクト: m4c3/checkMK
 def parameter_valuespec(self):
     return Optional(
         Tuple(elements=[
             Percentage(title=_("Warning at a utilization of")),
             Percentage(title=_("Critical at a utilization of"))
         ]),
         label=_("Alert on too high CPU utilization"),
         help=_("The CPU utilization sums up the percentages of CPU time that is used "
                "for user processes and kernel routines over all available cores within "
                "the last check interval. The possible range is from 0% to 100%"),
         default_value=(90.0, 95.0))
コード例 #14
0
def _parameter_valuespec_db2_backup():
    return Optional(
        Tuple(elements=[
            Age(title=_("Warning at"),
                display=["days", "hours", "minutes"],
                default_value=86400 * 14),
            Age(title=_("Critical at"),
                display=["days", "hours", "minutes"],
                default_value=86400 * 28)
        ], ),
        title=_("Specify time since last successful backup"),
    )
コード例 #15
0
ファイル: omd_configuration.py プロジェクト: xorsiz0r/checkmk
 def valuespec(self):
     return Optional(
         Integer(
             title=_("Port number"),
             minvalue=1,
             maxvalue=65535,
             default_value=5667,
         ),
         title=_("Listen for passive checks via NSCA"),
         help=_("Enable listening for passible checks via NSCA. With the default configuration "
                "the TCP port 5667 will be opened. You may also want to update the NSCA "
                "configuration file %s to fit your needs.") %
         site_neutral_path("etc/nsca/nsca.cfg"),
         label=_("Enable listening for passive checks using NSCA"),
         none_label=_("NSCA is disabled"),
     )
コード例 #16
0
def _parameter_valuespec_proxmox_ve_vm_info():
    # use Dictionary as Optional returning an empty dict if empty
    return Dictionary(
        title=_("Check Parameter"),
        elements=[(
            "required_vm_status",
            Optional(
                title=_("Modify: Check VM Status (off: keep default)"),
                label=_("Activate Check (off: ignore VM status)"),
                default_value=True,
                valuespec=TextInput(
                    title=_("Warn if VM status value is not"),
                    default_value="running",
                ),
            ),
        )],
    )
コード例 #17
0
ファイル: omd_configuration.py プロジェクト: xorsiz0r/checkmk
 def valuespec(self):
     return Optional(
         ListChoice(
             choices=[
                 ("SNMPTRAP", _("Receive SNMP traps (UDP/162)")),
                 ("SYSLOG", _("Receive Syslog messages (UDP/514)")),
                 ("SYSLOG_TCP", _("Receive Syslog messages (TCP/514)")),
             ],
             title=_("Listen for incoming messages via"),
             empty_text=_("Locally enabled"),
         ),
         title=_("Event Console"),
         help=_("This option enables the Event Console - The event processing and "
                "classification daemon of Check_MK. You can also configure whether "
                "or not the Event Console shal listen for incoming SNMP traps or "
                "syslog messages. Please note that only a single Check_MK site per "
                "Check_MK server can listen for such messages."),
         label=_("Event Console enabled"),
         none_label=_("Event Console disabled"),
         indent=False,
     )
コード例 #18
0
    def parameters(cls, mode):
        parameters = super(Overridable, cls).parameters(mode)

        if cls.has_overriding_permission("publish"):

            parameters += [
                (_("General Properties"), [
                    (2.2, 'public',
                     Optional(
                         title=_("Visibility"),
                         label=_('Make this %s available for other users') % cls.phrase("title"),
                         none_label=_("Don't publish to other users"),
                         none_value=False,
                         valuespec=PublishTo(
                             title="",
                             type_title=cls.phrase("title"),
                             with_foreign_groups=cls.has_overriding_permission(
                                 "publish_to_foreign_groups"),
                         ),
                     )),
                ]),
            ]

        return parameters
コード例 #19
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"))),
        ],
    )
コード例 #20
0
             Percentage(title=_("Warning at"),
                        unit=_("% usage"),
                        allow_int=True,
                        default_value=50),
             Percentage(title=_("Critical at"),
                        unit=_("% usage"),
                        allow_int=True,
                        default_value=60)
         ]))
]

size_trend_elements = [
    ("trend_range",
     Optional(Integer(title=_("Time Range for 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=[
コード例 #21
0
ファイル: if.py プロジェクト: tboerger/checkmk
def _parameter_valuespec_if():
    # Transform old traffic related levels which used "traffic" and "traffic_minimum"
    # keys where each was configured with an Alternative valuespec
    return Transform(
        Dictionary(
            ignored_keys=[
                "aggregate",
                "discovered_oper_status",
                "discovered_admin_status",
                "discovered_speed",
            ],  # Created by discovery
            elements=[
                ("errors_in", _vs_if_errors("IN")),
                ("errors_out", _vs_if_errors("OUT")),
                ("speed",
                 OptionalDropdownChoice(
                     title=_("Operating speed"),
                     help=_("If you use this parameter then the check goes warning if the "
                            "interface is not operating at the expected speed (e.g. it "
                            "is working with 100Mbit/s instead of 1Gbit/s.<b>Note:</b> "
                            "some interfaces do not provide speed information. In such cases "
                            "this setting is used as the assumed speed when it comes to "
                            "traffic monitoring (see below)."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second")))),
                ("state",
                 Optional(ListChoice(
                     title=_("Allowed operational states:"),
                     choices=defines.interface_oper_states(),
                     allow_empty=False,
                 ),
                          title=_("Operational state"),
                          help=_(
                              "If you activate the monitoring of the operational state "
                              "(<tt>ifOperStatus</tt>), the check will go critical if the current "
                              "state of the interface does not match one of the expected states."),
                          label=_("Ignore the operational state"),
                          none_label=_("ignore"),
                          negate=True)),
                ("map_operstates",
                 ListOf(
                     Tuple(orientation="horizontal",
                           elements=[
                               ListChoice(
                                   choices=defines.interface_oper_states(),
                                   allow_empty=False,
                               ),
                               MonitoringState()
                           ]),
                     title=_('Map operational states'),
                     help=_(
                         'Map the operational state (<tt>ifOperStatus</tt>) to a monitoring state.')
                 )),
                ("admin_state",
                 Optional(
                     ListChoice(
                         title=_("Allowed admin states:"),
                         choices=_admin_states(),
                         allow_empty=False,
                     ),
                     title=_("Admin state (SNMP with 64-bit counters only)"),
                     help=_("If you activate the monitoring of the admin state "
                            "(<tt>ifAdminStatus</tt>), the check will go critical if the "
                            "current state of the interface does not match one of the expected "
                            "states. " + _note_for_admin_state_options()),
                     label=_("Ignore the admin state"),
                     none_label=_("ignore"),
                     negate=True)),
                ("map_admin_states",
                 ListOf(
                     Tuple(orientation="horizontal",
                           elements=[
                               ListChoice(
                                   choices=_admin_states(),
                                   allow_empty=False,
                               ),
                               MonitoringState(),
                           ]),
                     title=_('Map admin states (SNMP with 64-bit counters only)'),
                     help=_("Map the admin state (<tt>ifAdminStatus</tt>) to a monitoring state. " +
                            _note_for_admin_state_options()),
                 )),
                ("assumed_speed_in",
                 OptionalDropdownChoice(
                     title=_("Assumed input speed"),
                     help=_(
                         "If the automatic detection of the link speed does not work "
                         "or the switch's capabilities are throttled because of the network setup "
                         "you can set the assumed speed here."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     default_value=16000000,
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second"),
                                      size=10))),
                ("assumed_speed_out",
                 OptionalDropdownChoice(
                     title=_("Assumed output speed"),
                     help=_(
                         "If the automatic detection of the link speed does not work "
                         "or the switch's capabilities are throttled because of the network setup "
                         "you can set the assumed speed here."),
                     choices=[
                         (None, _("ignore speed")),
                         (10000000, "10 Mbit/s"),
                         (100000000, "100 Mbit/s"),
                         (1000000000, "1 Gbit/s"),
                         (10000000000, "10 Gbit/s"),
                     ],
                     otherlabel=_("specify manually ->"),
                     default_value=1500000,
                     explicit=Integer(title=_("Other speed in bits per second"),
                                      label=_("Bits per second"),
                                      size=12))),
                ("unit",
                 DropdownChoice(
                     title=_("Measurement unit"),
                     help=_("Here you can specifiy the measurement unit of the network interface"),
                     default_value="byte",
                     choices=[
                         ("bit", _("Bits")),
                         ("byte", _("Bytes")),
                     ],
                 )),
                ("infotext_format",
                 DropdownChoice(
                     title=_("Change infotext in check output"),
                     help=
                     _("This setting allows you to modify the information text which is displayed between "
                       "the two brackets in the check output. Please note that this setting does not work for "
                       "grouped interfaces, since the additional information of grouped interfaces is different"
                      ),
                     choices=[
                         ("alias", _("Show alias")),
                         ("description", _("Show description")),
                         ("alias_and_description", _("Show alias and description")),
                         ("alias_or_description", _("Show alias if set, else description")),
                         ("desription_or_alias", _("Show description if set, else alias")),
                         ("hide", _("Hide infotext")),
                     ])),
                ("traffic",
                 ListOf(
                     CascadingDropdown(title=_("Direction"),
                                       orientation="horizontal",
                                       choices=[
                                           ('both', _("In / Out"), vs_interface_traffic()),
                                           ('in', _("In"), vs_interface_traffic()),
                                           ('out', _("Out"), vs_interface_traffic()),
                                       ]),
                     title=_("Used bandwidth (minimum or maximum traffic)"),
                     help=_("Setting levels on the used bandwidth is optional. If you do set "
                            "levels you might also consider using averaging."),
                 )),
                ("total_traffic",
                 ListOf(
                     CascadingDropdown(title=_("Direction"),
                                       orientation="horizontal",
                                       choices=[
                                           ('total', _("Total traffic"), vs_interface_traffic()),
                                       ]),
                     title=_("Used total bandwidth (in + out) (minimum or maximum traffic)"),
                     help=
                     _("By activating this item, the sum of incoming and outgoing traffic will "
                       "be monitored via a seperate metric. Setting levels on the used total bandwidth "
                       "is optional. If you do set levels you might also consider using averaging."
                      ),
                 )),
                ("average",
                 Integer(
                     title=_("Average values for used bandwidth"),
                     help=_("By activating the computation of averages, the levels on "
                            "traffic and speed 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,
                     default_value=15,
                 )),
                (
                    "nucasts",
                    Tuple(
                        title=_("Non-unicast packet rates"),
                        help=_(
                            "Setting levels on non-unicast packet rates is optional. This may help "
                            "to detect broadcast storms and other unwanted traffic."),
                        elements=[
                            Integer(title=_("Warning at"), unit=_("pkts / sec")),
                            Integer(title=_("Critical at"), unit=_("pkts / sec")),
                        ]),
                ),
                ("multicast",
                 Alternative(title=_("Multicast packet rates"),
                             help=_(
                                 "These levels make the check go warning or critical whenever the "
                                 "<b>percentual packet rate</b> or the <b>absolute packet "
                                 "rate</b> of the monitored interface reaches the given "
                                 "bounds. The percentual packet rate is computed by "
                                 "dividing the number of multicast packets by the number "
                                 "of unicast packets."),
                             elements=[
                                 Tuple(title=_("Percentual levels for multicast packets"),
                                       elements=[
                                           Percentage(title=_("Warning at"),
                                                      unit=_("percent packets"),
                                                      default_value=10.0,
                                                      display_format='%.3f'),
                                           Percentage(title=_("Critical at"),
                                                      unit=_("percent packets"),
                                                      default_value=20.0,
                                                      display_format='%.3f')
                                       ]),
                                 Tuple(title=_("Absolute levels for multicast packets"),
                                       elements=[
                                           Integer(title=_("Warning at"), unit=_("pkts / sec")),
                                           Integer(title=_("Critical at"), unit=_("pkts / sec"))
                                       ])
                             ])),
                ("broadcast",
                 Alternative(title=_("Broadcast packet rates"),
                             help=_(
                                 "These levels make the check go warning or critical whenever the "
                                 "<b>percentual packet rate</b> or the <b>absolute packet "
                                 "rate</b> of the monitored interface reaches the given "
                                 "bounds. The percentual packet rate is computed by "
                                 "dividing the number of broadcast packets by the number "
                                 "of unicast packets."),
                             elements=[
                                 Tuple(title=_("Percentual levels for broadcast packets"),
                                       elements=[
                                           Percentage(title=_("Warning at"),
                                                      unit=_("percent packets"),
                                                      default_value=10.0,
                                                      display_format='%.3f'),
                                           Percentage(title=_("Critical at"),
                                                      unit=_("percent packets"),
                                                      default_value=20.0,
                                                      display_format='%.3f')
                                       ]),
                                 Tuple(title=_("Absolute levels for broadcast packets"),
                                       elements=[
                                           Integer(title=_("Warning at"), unit=_("pkts / sec")),
                                           Integer(title=_("Critical at"), unit=_("pkts / sec"))
                                       ])
                             ])),
                ("average_bm",
                 Integer(
                     title=_("Average values for broad- and multicast packet rates"),
                     help=_(
                         "By activating the computation of averages, the levels on "
                         "broad- and multicast packet rates 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,
                     default_value=15,
                 )),
                ("discards",
                 Tuple(title=_("Absolute levels for discards rates"),
                       elements=[
                           Integer(title=_("Warning at"), unit=_("discards")),
                           Integer(title=_("Critical at"), unit=_("discards"))
                       ])),
                ("match_same_speed",
                 DropdownChoice(title=_("Speed of interface groups (Netapp only)"),
                                help=_("Choose the behaviour for different interface speeds in "
                                       "interface groups. The default is \"Check and WARN\". This "
                                       "feature is currently only supported by the check "
                                       "netapp_api_if."),
                                choices=[
                                    ("check_and_warn", _("Check and WARN")),
                                    ("check_and_crit", _("Check and CRIT")),
                                    ("check_and_display", _("Check and display only")),
                                    ("dont_show_and_check", _("Don't show and check")),
                                ])),
                ("home_port",
                 DropdownChoice(title=_("Is-Home state (Netapp only)"),
                                help=_("Choose the behaviour when the current port is not the "
                                       "home port of the respective interface. The default is "
                                       "\"Check and Display\". This feature is currently only "
                                       "supported by the check netapp_api_if."),
                                choices=[
                                    ("check_and_warn", _("Check and WARN")),
                                    ("check_and_crit", _("Check and CRIT")),
                                    ("check_and_display", _("Check and display only")),
                                    ("dont_show_and_check", _("Don't show home port info")),
                                ])),
            ],
        ),
        forth=transform_if,
    )
コード例 #22
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=_("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"),
          )),
     ], )
コード例 #23
0
def _parameter_valuespec_netapp_volumes():
    return Dictionary(elements=[
        ("levels",
         Alternative(
             title=_("Levels for volume"),
             show_alternative_title=True,
             default_value=(80.0, 90.0),
             match=match_dual_level_type,
             elements=[
                 get_free_used_dynamic_valuespec("used", "volume"),
                 Transform(
                     get_free_used_dynamic_valuespec("free",
                                                     "volume",
                                                     default_value=(20.0,
                                                                    10.0)),
                     forth=transform_filesystem_free,
                     back=transform_filesystem_free,
                 )
             ],
         )),
        ("perfdata",
         ListChoice(
             title=_("Performance data for protocols"),
             help=
             _("Specify for which protocol performance data should get recorded."
               ),
             choices=[
                 ("", _("Summarized data of all protocols")),
                 ("nfs", _("NFS")),
                 ("cifs", _("CIFS")),
                 ("san", _("SAN")),
                 ("fcp", _("FCP")),
                 ("iscsi", _("iSCSI")),
             ],
         )),
        ("magic",
         Float(title=_(
             "Magic factor (automatic level adaptation for large volumes)"),
               default_value=0.8,
               minvalue=0.1,
               maxvalue=1.0)),
        ("magic_normsize",
         Integer(title=_("Reference size for magic factor"),
                 default_value=20,
                 minvalue=1,
                 unit=_("GB"))),
        ("levels_low",
         Tuple(
             title=_("Minimum levels if using magic factor"),
             help=_(
                 "The volume levels will never fall below these values, when using "
                 "the magic factor and the volume is very small."),
             elements=[
                 Percentage(title=_("Warning if above"),
                            unit=_("% usage"),
                            allow_int=True,
                            default_value=50),
                 Percentage(title=_("Critical if above"),
                            unit=_("% usage"),
                            allow_int=True,
                            default_value=60)
             ],
         )),
        ("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),
                     ],
                 )
             ],
             default_value=(10.0, 5.0),
         )),
        ("show_inodes",
         DropdownChoice(
             title=_("Display inode usage in check output..."),
             choices=[
                 ("onproblem", _("Only in case of a problem")),
                 ("onlow",
                  _("Only in case of a problem or if inodes are below 50%")),
                 ("always", _("Always")),
             ],
             default_value="onlow",
         )),
        ("trend_range",
         Optional(Integer(
             title=_("Time Range for 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 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 disk 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"))),
    ], )
コード例 #24
0
ファイル: if.py プロジェクト: m4c3/checkMK
 def parameter_valuespec(self):
     # Transform old traffic related levels which used "traffic" and "traffic_minimum"
     # keys where each was configured with an Alternative valuespec
     return Transform(
         Dictionary(
             ignored_keys=[
                 "aggregate"
             ],  # Created by discovery when using interface grouping
             elements=[
                 ("errors",
                  Alternative(
                      title=_("Levels for error rates"),
                      help=
                      _("These levels make the check go warning or critical whenever the "
                        "<b>percentual error rate</b> or the <b>absolute error rate</b> of the monitored interface reaches "
                        "the given bounds. The percentual error rate is computed by dividing number of "
                        "errors by the total number of packets (successful plus errors)."
                        ),
                      elements=[
                          Tuple(
                              title=_("Percentual levels for error rates"),
                              elements=[
                                  Percentage(title=_("Warning at"),
                                             unit=_("percent errors"),
                                             default_value=0.01,
                                             display_format='%.3f'),
                                  Percentage(title=_("Critical at"),
                                             unit=_("percent errors"),
                                             default_value=0.1,
                                             display_format='%.3f')
                              ]),
                          Tuple(title=_("Absolute levels for error rates"),
                                elements=[
                                    Integer(title=_("Warning at"),
                                            unit=_("errors")),
                                    Integer(title=_("Critical at"),
                                            unit=_("errors"))
                                ])
                      ])),
                 ("speed",
                  OptionalDropdownChoice(
                      title=_("Operating speed"),
                      help=
                      _("If you use this parameter then the check goes warning if the "
                        "interface is not operating at the expected speed (e.g. it "
                        "is working with 100Mbit/s instead of 1Gbit/s.<b>Note:</b> "
                        "some interfaces do not provide speed information. In such cases "
                        "this setting is used as the assumed speed when it comes to "
                        "traffic monitoring (see below)."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second")))),
                 ("state",
                  Optional(
                      ListChoice(title=_("Allowed states:"),
                                 choices=defines.interface_oper_states()),
                      title=_("Operational state"),
                      help=
                      _("If you activate the monitoring of the operational state (<tt>ifOperStatus</tt>) "
                        "the check will get warning or critical if the current state "
                        "of the interface does not match one of the expected states. Note: the status 9 (<i>admin down</i>) "
                        "is only visible if you activate this status during switch port inventory or if you manually "
                        "use the check plugin <tt>if64adm</tt> instead of <tt>if64</tt>."
                        ),
                      label=_("Ignore the operational state"),
                      none_label=_("ignore"),
                      negate=True)),
                 ("map_operstates",
                  ListOf(
                      Tuple(
                          orientation="horizontal",
                          elements=[
                              DropdownChoice(
                                  choices=defines.interface_oper_states()),
                              MonitoringState()
                          ]),
                      title=_('Map operational states'),
                  )),
                 ("assumed_speed_in",
                  OptionalDropdownChoice(
                      title=_("Assumed input speed"),
                      help=
                      _("If the automatic detection of the link speed does not work "
                        "or the switch's capabilities are throttled because of the network setup "
                        "you can set the assumed speed here."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      default_value=16000000,
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second"),
                          size=10))),
                 ("assumed_speed_out",
                  OptionalDropdownChoice(
                      title=_("Assumed output speed"),
                      help=
                      _("If the automatic detection of the link speed does not work "
                        "or the switch's capabilities are throttled because of the network setup "
                        "you can set the assumed speed here."),
                      choices=[
                          (None, _("ignore speed")),
                          (10000000, "10 Mbit/s"),
                          (100000000, "100 Mbit/s"),
                          (1000000000, "1 Gbit/s"),
                          (10000000000, "10 Gbit/s"),
                      ],
                      otherlabel=_("specify manually ->"),
                      default_value=1500000,
                      explicit=Integer(
                          title=_("Other speed in bits per second"),
                          label=_("Bits per second"),
                          size=12))),
                 ("unit",
                  RadioChoice(
                      title=_("Measurement unit"),
                      help=
                      _("Here you can specifiy the measurement unit of the network interface"
                        ),
                      default_value="byte",
                      choices=[
                          ("bit", _("Bits")),
                          ("byte", _("Bytes")),
                      ],
                  )),
                 ("infotext_format",
                  DropdownChoice(
                      title=_("Change infotext in check output"),
                      help=
                      _("This setting allows you to modify the information text which is displayed between "
                        "the two brackets in the check output. Please note that this setting does not work for "
                        "grouped interfaces, since the additional information of grouped interfaces is different"
                        ),
                      choices=[
                          ("alias", _("Show alias")),
                          ("description", _("Show description")),
                          ("alias_and_description",
                           _("Show alias and description")),
                          ("alias_or_description",
                           _("Show alias if set, else description")),
                          ("desription_or_alias",
                           _("Show description if set, else alias")),
                          ("hide", _("Hide infotext")),
                      ])),
                 ("traffic",
                  ListOf(
                      CascadingDropdown(title=_("Direction"),
                                        orientation="horizontal",
                                        choices=[
                                            ('both', _("In / Out"),
                                             vs_interface_traffic()),
                                            ('in', _("In"),
                                             vs_interface_traffic()),
                                            ('out', _("Out"),
                                             vs_interface_traffic()),
                                        ]),
                      title=_(
                          "Used bandwidth (minimum or maximum traffic)"),
                      help=
                      _("Setting levels on the used bandwidth is optional. If you do set "
                        "levels you might also consider using averaging."),
                  )),
                 (
                     "nucasts",
                     Tuple(
                         title=_("Non-unicast packet rates"),
                         help=
                         _("Setting levels on non-unicast packet rates is optional. This may help "
                           "to detect broadcast storms and other unwanted traffic."
                           ),
                         elements=[
                             Integer(title=_("Warning at"),
                                     unit=_("pkts / sec")),
                             Integer(title=_("Critical at"),
                                     unit=_("pkts / sec")),
                         ]),
                 ),
                 ("discards",
                  Tuple(title=_("Absolute levels for discards rates"),
                        elements=[
                            Integer(title=_("Warning at"),
                                    unit=_("discards")),
                            Integer(title=_("Critical at"),
                                    unit=_("discards"))
                        ])),
                 ("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,
                      default_value=15,
                  )),
             ],
         ),
         forth=transform_if,
     )
コード例 #25
0
ファイル: notify.py プロジェクト: PLUTEX/checkmk
def _vs_notify():
    dest_choices: List[CascadingDropdownChoice] = [
        ("broadcast", _("Everybody (Broadcast)")),
        (
            "list",
            _("A list of specific users"),
            DualListChoice(
                choices=sorted(
                    [(uid, u.get("alias", uid)) for uid, u in config.multisite_users.items()],
                    key=lambda x: x[1].lower(),
                ),
                allow_empty=False,
            ),
        ),
        # ('contactgroup', _('All members of a contact group')),
        ("online", _("All online users")),
    ]

    return Dictionary(
        elements=[
            (
                "text",
                TextAreaUnicode(
                    title=_("Text"),
                    help=_("Insert the text to be sent to all reciepents."),
                    allow_empty=False,
                    empty_text=_("You need to provide a text."),
                    cols=50,
                    rows=10,
                ),
            ),
            (
                "dest",
                CascadingDropdown(
                    title=_("Send notification to"),
                    help=_(
                        "You can send the notification to a list of multiple users, which "
                        "can be choosen out of these predefined filters."
                    ),
                    choices=dest_choices,
                ),
            ),
            (
                "methods",
                ListChoice(
                    title=_("How to notify"),
                    allow_empty=False,
                    choices=[(k, v["title"]) for k, v in _notify_methods().items()],
                    default_value=["popup"],
                ),
            ),
            (
                "valid_till",
                Optional(
                    AbsoluteDate(
                        include_time=True,
                    ),
                    title=_("Automatically invalidate notification"),
                    label=_("Enable automatic invalidation at"),
                    help=_(
                        "It is possible to automatically delete messages when the "
                        "configured time is reached. This makes it possible to inform "
                        "users about a scheduled event but suppress the notification "
                        "after the event has happened."
                    ),
                ),
            ),
        ],
        validate=_validate_msg,
        optional_keys=[],
    )