Esempio n. 1
0
def _parameter_valuespec_fcp():
    return Dictionary(elements=[
        ("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 8Gbit/s instead of 16Gbit/s)."),
             choices=[
                 (None, _("ignore speed")),
                 (4000000000, "4 Gbit/s"),
                 (8000000000, "8 Gbit/s"),
                 (16000000000, "16 Gbit/s"),
             ],
             otherlabel=_("specify manually ->"),
             explicit=Integer(title=_("Other speed in bits per second"),
                              label=_("Bits per second")))),
        ("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."),
         )),
        ("read_latency",
         Levels(title=_("Read latency"),
                unit=_("ms"),
                default_value=None,
                default_levels=(50.0, 100.0))),
        ("write_latency",
         Levels(title=_("Write latency"),
                unit=_("ms"),
                default_value=None,
                default_levels=(50.0, 100.0))),
        ("latency",
         Levels(title=_("Overall latency"),
                unit=_("ms"),
                default_value=None,
                default_levels=(50.0, 100.0))),
    ], )
Esempio n. 2
0
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,
    )
Esempio n. 3
0
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"
            ],  # Created by discovery when using interface grouping
            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 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,
                 )),
                ("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")),
                     ])),
            ],
        ),
        forth=transform_if,
    )