def websphere_mq_common_elements(): return [ ("message_count", OptionalDropdownChoice(title=_('Maximum number of messages'), choices=[(None, _("Ignore these levels"))], otherlabel=_("Set absolute levels"), explicit=Tuple( title=_('Maximum number of messages'), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ]), default_value=(1000, 1200))), ("message_count_perc", OptionalDropdownChoice( title=_('Percentage of queue length'), help= _('This setting only applies if the WebSphere MQ reports the queue length' ), choices=[(None, _("Ignore these levels"))], otherlabel=_("Set relative levels"), explicit=Tuple(title=_('Percentage of queue length'), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), default_value=(80.0, 90.0))), ]
def _vs_topic(cls): choices = cls._topic_choices() return Alternative( elements=[ FixedValue( None, title=_("Use default topic"), totext="", ), OptionalDropdownChoice( title=_("Individual topic"), choices=choices, default_value=choices[0][0] if choices else "", explicit=TextUnicode( size=30, allow_empty=False, ), otherlabel="%s" % _("Add new topic"), ), ], title=_("Topic") + "<sup>*</sup>", style="dropdown", orientation="horizontal", )
def _parameter_valuespec_memory_relative(): return OptionalDropdownChoice(title=_("Memory usage"), choices=[(None, _("Do not impose levels"))], otherlabel=_("Percentual levels ->"), explicit=Tuple(elements=[ Integer(title=_("Warning at"), default_value=85, unit="%"), Integer(title=_("Critical at"), default_value=90, unit="%"), ],))
def _get_topic_valuespec(self): return OptionalDropdownChoice( title=_("Topic") + "<sup>*</sup>", choices=self._effective_config.get_topic_choices(), explicit=TextInput(), otherlabel=_("Create new topic"), default_value=None, help=_("Different tags can be grouped in topics to make the visualization and " "selections in the GUI more comfortable."), )
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))), ], )
def _parameter_valuespec_ibm_mq_queues(): return Dictionary( help=_( "See 'Queue status attributes' in IBM manual" "(https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.2.0/com.ibm.mq.explorer.doc/e_status_queue.html)" " for detailed explanations of these parameters."), elements=[ ("curdepth", OptionalDropdownChoice( title=_("Current queue depth"), help=_("CURDEPTH: The number of messages currently on the queue."), choices=[((None, None), _("Ignore these levels"))], otherlabel=_("Set absolute levels"), explicit=Tuple( title=_('Maximum number of messages'), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ], ), )), ("curdepth_perc", OptionalDropdownChoice( help=_("CURDEPTH_PERC: Percentage (CURDEPTH/MAXDEPTH) of the number of" " messages currently on the queue."), title=_('Current queue depth in %'), choices=[((None, None), _("Ignore these levels"))], otherlabel=_("Set relative levels"), default_value=(80.0, 90.0), explicit=Tuple( title=_('Percentage of queue depth'), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ], ), )), ("msgage", Tuple( help=_("MSGAGE: The age, in seconds, of the oldest message on the queue."), title=_("Oldest message age"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ("lgetage", Tuple( help=_("The age, in seconds, when the last message was retrieved from the queue." " Calculated by subtracting LGETDATE/LGETTIME from current timestamp."), title=_("Last get age"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ("lputage", Tuple( help=_("The age, in seconds, when the last message was put to the queue. " " Calculated by subtracting LPUTDATE/LPUTTIME from current timestamp."), title=_("Last put age"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ("ipprocs", Dictionary( help=_("IPPROCS: The number of applications that are currently connected to" " the queue to get messages from the queue."), title=_("Open input count"), elements=[ ("lower", Tuple( title=_("Lower levels"), elements=[ Integer(title=_("Warning if below")), Integer(title=_("Critical if below")), ], )), ("upper", Tuple( title=_("Upper levels"), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ], )), ], )), ("opprocs", Dictionary( help=_("OPPROCS: The number of applications that are currently connected" " to the queue to put messages on the queue."), title=_("Open output count"), elements=[ ("lower", Tuple( title=_("Lower levels"), elements=[ Integer(title=_("Warning if below")), Integer(title=_("Critical if below")), ], )), ("upper", Tuple( title=_("Upper levels"), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ], )), ], )), ], )
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, )
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, )