def parameter_valuespec(self): return Dictionary( help=_( "Allows to define absolute levels for all, running, paused, and stopped containers." ), elements=[ ("upper_levels", Tuple( title=_("Containers upper levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("lower_levels", Tuple( title=_("Containers lower levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("running_upper_levels", Tuple( title=_("Running containers upper levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("running_lower_levels", Tuple( title=_("Running containers lower levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("paused_upper_levels", Tuple( title=_("Paused containers upper levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("paused_lower_levels", Tuple( title=_("Paused containers lower levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("stopped_upper_levels", Tuple( title=_("Stopped containers upper levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ("stopped_lower_levels", Tuple( title=_("Stopped containers lower levels"), elements=[ Integer(title=_("Warning at"), allow_empty=False), Integer(title=_("Critical at"), allow_empty=False), ], )), ], )
def get_vs_flexible_notifications(): # Make sure, that list is not trivially false def validate_only_services(value, varprefix): for s in value: if s and s[0] != '!': return raise MKUserError(varprefix + "_0", _("The list of services will never match")) return CascadingDropdown( title=_("Notification Method"), choices=[ ("email", _("Plain Text Email (using configured templates)")), ( "flexible", _("Flexible Custom Notifications"), ListOf( Foldable( Dictionary( optional_keys=[ "service_blacklist", "only_hosts", "only_services", "escalation", "match_sl" ], columns=1, elements=[ ( "plugin", DropdownChoice( title=_("Notification Plugin"), choices=notification_script_choices, default_value="mail", ), ), ("parameters", ListOfStrings( title=_("Plugin Arguments"), help= _("You can specify arguments to the notification plugin here. " "Please refer to the documentation about the plugin for what " "parameters are allowed or required here."), )), ("disabled", Checkbox( title=_("Disabled"), label=_("Currently disable this notification"), default_value=False, )), ("timeperiod", cmk.gui.watolib.timeperiods.TimeperiodSelection( title=_("Timeperiod"), help=_("Do only notifiy alerts within this time period"), )), ( "escalation", Tuple( title= _("Restrict to n<sup>th</sup> to m<sup>th</sup> notification (escalation)" ), orientation="float", elements=[ Integer( label=_("from"), help= _("Let through notifications counting from this number" ), default_value=1, minvalue=1, maxvalue=999999, ), Integer( label=_("to"), help= _("Let through notifications counting upto this number" ), default_value=999999, minvalue=1, maxvalue=999999, ), ], ), ), ( "match_sl", Tuple( title=_("Match service level"), help= _("Host or Service must be in the following service level to get notification" ), orientation="horizontal", show_titles=False, elements=[ DropdownChoice(label=_("from:"), choices=cmk.gui.mkeventd.service_levels, prefix_values=True), DropdownChoice(label=_(" to:"), choices=cmk.gui.mkeventd.service_levels, prefix_values=True), ], ), ), ("host_events", ListChoice( title=_("Host Events"), choices=[ ('d', _("Host goes down")), ('u', _("Host gets unreachble")), ('r', _("Host goes up again")), ('f', _("Start or end of flapping state")), ('s', _("Start or end of a scheduled downtime ")), ('x', _("Acknowledgement of host problem")), ], default_value=['d', 'u', 'r', 'f', 's', 'x'], )), ("service_events", ListChoice( title=_("Service Events"), choices=[ ('w', _("Service goes into warning state")), ('u', _("Service goes into unknown state")), ('c', _("Service goes into critical state")), ('r', _("Service recovers to OK")), ('f', _("Start or end of flapping state")), ('s', _("Start or end of a scheduled downtime")), ('x', _("Acknowledgement of service problem")), ], default_value=['w', 'c', 'u', 'r', 'f', 's', 'x'], )), ( "only_hosts", ListOfStrings( title=_("Limit to the following hosts"), help= _("Configure the hosts for this notification. Without prefix, only exact, case sensitive matches, " "<tt>!</tt> for negation and <tt>~</tt> for regex matches." ), orientation="horizontal", # TODO: Clean this up to use an alternative between TextInput() and RegExp(). Also handle the negation in a different way valuespec=TextInput(size=20,), ), ), ( "only_services", ListOfStrings( title=_("Limit to the following services"), help= _("Configure regular expressions that match the beginning of the service names here. Prefix an " "entry with <tt>!</tt> in order to <i>exclude</i> that service." ), orientation="horizontal", # TODO: Clean this up to use an alternative between TextInput() and RegExp(). Also handle the negation in a different way valuespec=TextInput(size=20,), validate=validate_only_services, ), ), ( "service_blacklist", ListOfStrings( title=_("Blacklist the following services"), help= _("Configure regular expressions that match the beginning of the service names here." ), orientation="horizontal", valuespec=RegExp( size=20, mode=RegExp.prefix, ), validate=validate_only_services, ), ), ]), title_function=lambda v: _("Notify by: ") + notification_script_title(v[ "plugin"]), ), title=_("Flexible Custom Notifications"), add_label=_("Add notification"), ), ), ])
def _parameter_valuespec_windows_printer_queues(): return Transform( Dictionary( title=_("Windows Printer Configuration"), elements=[ ( "levels", Tuple( title=_("Levels for the number of print jobs"), help=_( "This rule is applied to the number of print jobs " "currently waiting in windows printer queue."), elements=[ Integer(title=_("Warning at"), unit=_("jobs"), default_value=40), Integer(title=_("Critical at"), unit=_("jobs"), default_value=60), ], ), ), ("crit_states", ListChoice( title=_("States who should lead to critical"), choices=[ (0, "Unkown"), (1, "Other"), (2, "No Error"), (3, "Low Paper"), (4, "No Paper"), (5, "Low Toner"), (6, "No Toner"), (7, "Door Open"), (8, "Jammed"), (9, "Offline"), (10, "Service Requested"), (11, "Output Bin Full"), ], default_value=[9, 10], )), ("warn_states", ListChoice( title=_("States who should lead to warning"), choices=[ (0, "Unkown"), (1, "Other"), (2, "No Error"), (3, "Low Paper"), (4, "No Paper"), (5, "Low Toner"), (6, "No Toner"), (7, "Door Open"), (8, "Jammed"), (9, "Offline"), (10, "Service Requested"), (11, "Output Bin Full"), ], default_value=[8, 11], )), ], ), forth=windows_printer_queues_forth, )
def _parameter_valuespec_ocprot_current(): return Tuple(elements=[ Float(title=_("Warning at"), unit=u"A", default_value=14.0), Float(title=_("Critical at"), unit=u"A", default_value=15.0), ], )
def _parameter_valuespec_skype(): return Dictionary(elements=[ ('failed_search_requests', Dictionary( title=_("Failed search requests"), elements=[ ("upper", Tuple(elements=[ Float(title=_("Warning at"), unit=_("per second"), default_value=1.0), Float(title=_("Critical at"), unit=_("per second"), default_value=2.0), ], )), ], optional_keys=[], )), ('failed_locations_requests', Dictionary( title=_("Failed Get Locations Requests"), elements=[ ("upper", Tuple(elements=[ Float(title=_("Warning at"), unit=_("per second"), default_value=1.0), Float(title=_("Critical at"), unit=_("per second"), default_value=2.0), ], )), ], optional_keys=[], )), ('failed_file_requests', Dictionary( title=_("Failed requests to Adressbook files"), elements=[("upper", Tuple(elements=[ Float(title=_("Warning at"), unit=_("per second"), default_value=1.0), Float(title=_("Critical at"), unit=_("per second"), default_value=2.0), ], ))], optional_keys=[], )), ('join_failures', Dictionary( title=_("Failures of the join launcher service"), elements=[("upper", Tuple(elements=[ Integer(title=_("Warning at"), default_value=1), Integer(title=_("Critical at"), default_value=2), ], ))], optional_keys=[], )), ('failed_validate_cert', Dictionary( title=_("Failed certificate validations"), elements=[("upper", Tuple(elements=[ Integer(title=_("Warning at"), default_value=1), Integer(title=_("Critical at"), default_value=2), ], ))], optional_keys=[], )), ('timedout_ad_requests', Dictionary( title=_("Timed out Active Directory Requests"), elements=[ ("upper", Tuple(elements=[ Float(title=_("Warning at"), unit=_("per second"), default_value=0.01), Float(title=_("Critical at"), unit=_("per second"), default_value=0.02), ], )), ], optional_keys=[], )), ('5xx_responses', Dictionary( title=_("HTTP 5xx Responses"), elements=[ ("upper", Tuple(elements=[ Float(title=_("Warning at"), unit=_("per second"), default_value=1.0), Float(title=_("Critical at"), unit=_("per second"), default_value=2.0), ], )), ], optional_keys=[], )), ('asp_requests_rejected', Dictionary( title=_("ASP Requests Rejected"), elements=[ ("upper", Tuple(elements=[ Integer(title=_("Warning at"), default_value=1), Integer(title=_("Critical at"), default_value=2), ], )), ], optional_keys=[], )), ], )
def _mongodb_cluster_count_tuple(title, course): return Tuple(title=_(title), elements=[ Integer(title=_("Warning if %s") % course, unit=_("count"), minvalue=0), Integer(title=_("Critical if %s") % course, unit=_("count"), minvalue=0), ])
def _parameter_valuespec_disk_io(): return Dictionary( elements=[ ( "read", Levels( title=_("Read throughput"), unit=_("MB/s"), default_value=None, default_levels=(50.0, 100.0), ), ), ( "write", Levels( title=_("Write throughput"), unit=_("MB/s"), default_value=None, default_levels=(50.0, 100.0), ), ), ( "average", Integer( title=_("Average"), help=_( "When averaging is set, a floating average value " "of the disk throughput is computed and the levels for read " "and write will be applied to the average instead of the current " "value." ), default_value=5, minvalue=1, unit=_("minutes"), ), ), ( "latency", Tuple( title=_("IO Latency"), elements=[ Float(title=_("warning at"), unit=_("ms"), default_value=80.0), Float(title=_("critical at"), unit=_("ms"), default_value=160.0), ], ), ), ( "latency_perfdata", Checkbox( title=_("Performance Data for Latency"), label=_("Collect performance data for disk latency"), help=_( "Note: enabling performance data for the latency might " "cause incompatibilities with existing historical data " "if you are running PNP4Nagios in SINGLE mode." ), ), ), ( "read_ql", Tuple( title=_("Read Queue-Length"), elements=[ Float(title=_("warning at"), default_value=80.0), Float(title=_("critical at"), default_value=90.0), ], ), ), ( "write_ql", Tuple( title=_("Write Queue-Length"), elements=[ Float(title=_("warning at"), default_value=80.0), Float(title=_("critical at"), default_value=90.0), ], ), ), ( "ql_perfdata", Checkbox( title=_("Performance Data for Queue Length"), label=_("Collect performance data for disk latency"), help=_( "Note: enabling performance data for the latency might " "cause incompatibilities with existing historical data " "if you are running PNP4Nagios in SINGLE mode." ), ), ), ( "read_ios", Levels( title=_("Read operations"), unit=_("1/s"), default_levels=(400.0, 600.0), ), ), ( "write_ios", Levels( title=_("Write operations"), unit=_("1/s"), default_levels=(300.0, 400.0), ), ), ], )
def _parameter_valuespec_tcp_connections(): return Dictionary( help=_( "This rule allows to monitor the existence of specific TCP connections or " "TCP/UDP listeners."), elements=[ ( "proto", DropdownChoice( title=_("Protocol"), choices=[("TCP", _("TCP")), ("UDP", _("UDP"))], default_value="TCP", ), ), ( "state", DropdownChoice(title=_("State"), choices=[ ("ESTABLISHED", "ESTABLISHED"), ("LISTENING", "LISTENING"), ("SYN_SENT", "SYN_SENT"), ("SYN_RECV", "SYN_RECV"), ("LAST_ACK", "LAST_ACK"), ("CLOSE_WAIT", "CLOSE_WAIT"), ("TIME_WAIT", "TIME_WAIT"), ("CLOSED", "CLOSED"), ("CLOSING", "CLOSING"), ("FIN_WAIT1", "FIN_WAIT1"), ("FIN_WAIT2", "FIN_WAIT2"), ("BOUND", "BOUND"), ]), ), ("local_ip", IPv4Address(title=_("Local IP address"))), ("local_port", Integer( title=_("Local port number"), minvalue=1, maxvalue=65535, )), ("remote_ip", IPv4Address(title=_("Remote IP address"))), ("remote_port", Integer( title=_("Remote port number"), minvalue=1, maxvalue=65535, )), ("max_states", Tuple( title=_("Maximum number of connections or listeners"), elements=[ Integer(title=_("Warning at")), Integer(title=_("Critical at")), ], )), ("min_states", Tuple( title=_("Minimum number of connections or listeners"), elements=[ Integer(title=_("Warning if below")), Integer(title=_("Critical if below")), ], )), ], )
Tuple, ValueSpec, ) from cmk.gui.plugins.wato import ( CheckParameterRulespecWithItem, rulespec_registry, RulespecGroupCheckParametersStorage, ) file_size_age_elements: List[_Tuple[str, ValueSpec]] = [ ("minage_oldest", Tuple( title=_("Minimal age of oldest file"), elements=[ Age(title=_("Warning below")), Age(title=_("Critical below")), ], )), ("maxage_oldest", Tuple( title=_("Maximal age of oldest file"), elements=[ Age(title=_("Warning at or above")), Age(title=_("Critical at or above")), ], )), ("minage_newest", Tuple( title=_("Minimal age of newest file"), elements=[
def _parameter_valuespec_oracle_tablespaces(): return Dictionary( help= _("A tablespace is a container for segments (tables, indexes, etc). A " "database consists of one or more tablespaces, each made up of one or " "more data files. Tables and indexes are created within a particular " "tablespace. " "This rule allows you to define checks on the size of tablespaces."), elements=db_levels_common() + [ ( "autoextend", DropdownChoice( title=_("Expected autoextend setting"), choices=[ (True, _("Autoextend is expected to be ON")), (False, _("Autoextend is expected to be OFF")), (None, _("Autoextend will be ignored")), ], ), ), ( "autoextend_severity", MonitoringState( title=_("Severity of invalid autoextend setting"), default_value=2, ), ), ( "defaultincrement", DropdownChoice( title=_("Default Increment"), choices=[ (True, _("State is WARNING in case the next extent has the default size." )), (False, _("Ignore default increment")), ], ), ), ( "map_file_online_states", ListOf( valuespec=Tuple( orientation="horizontal", elements=[ DropdownChoice(choices=[ ("RECOVER", _("Recover")), ("OFFLINE", _("Offline")), ], ), MonitoringState(), ], ), title=_("Map file online states"), ), ), ( "temptablespace", DropdownChoice( title=_("Monitor temporary Tablespace"), choices=[ (False, _("Ignore temporary Tablespaces (Default)")), (True, _("Apply rule to temporary Tablespaces")), ], ), ), ], )
def _parameter_valuespec_nimble_latency(): return Dictionary( help=_("You can set limits for the latency of read or write I/O operations of Nimble " "storage volumes. Note that the operations are shown in terms of number of " "operations as a percentage of total read or write I/O operations within various " "latency ranges (e.g. 0-0.1 ms, 0.1-0.2 ms, etc.). In order to effectively " "set limits for these volumes, please select WARN/CRIT levels in terms of " "percentage of overall number of operations. To accommodate the large range of " "Nimble storage devices and their various functionalities (all-flash, hybrid, " "tape, etc.), it is possible to select the starting point at which values should " "be considered. " "For example, for some devices, you may only want to be notified with a WARN if " "10% of operations have a latency of 10-20 ms or above, and a CRIT if 20% of " "operations reach this threshold. You can achieve this by setting the \"Range " "Reference\" parameter to 10-20 ms, and warning and critical levels to 10% and 20% " "respectively."), elements=[ ("range_reference", DropdownChoice( title="Range Reference", help=_("The latency range at which values should start to be considered."), choices=[ ("0.1", _("0.0 - 0.1 ms")), ("0.2", _("0.1 - 0.2 ms")), ("0.5", _("0.2 - 0.5 ms")), ("1", _("0.5 - 1.0 ms")), ("2", _("1.0 - 2.0 ms")), ("5", _("2.0 - 5.0 ms")), ("10", _("5.0 - 10.0 ms")), ("20", _("10.0 - 20.0 ms")), ("50", _("20.0 - 50.0 ms")), ("100", _("50.0 - 100.0 ms")), ("200", _("100.0 - 200.0 ms")), ("500", _("200.0 - 500.0 ms")), ("1000", _("500.0+ ms")), ], default_value="20", )), ( "read", Tuple( title=_("Read Latency"), elements=[ Percentage( title=_("Warning at"), unit="%", minvalue=0.0, maxvalue=100.0, default_value=10.0, ), Percentage( title=_("Critical at"), unit="%", minvalue=0.0, maxvalue=100.0, default_value=20.0, ), ], help=_("The default levels are suitable for hybrid storage systems. " "Please consider lowering them if your storage system is all-flash."), ), ), ( "write", Tuple( title=_("Write Latency"), elements=[ Percentage( title=_("Warning at"), unit="%", minvalue=0.0, maxvalue=100.0, default_value=10.0, ), Percentage( title=_("Critical at"), unit="%", minvalue=0.0, maxvalue=100.0, default_value=20.0, ), ], help=_("The default levels are suitable for hybrid storage systems. " "Please consider lowering them if your storage system is all-flash."), ), ), ], )
def _parameter_valuespec_oracle_dataguard_stats(): return Dictionary( help= _("The Data-Guard statistics are available in Oracle Enterprise Edition with enabled Data-Guard. " "The <tt>init.ora</tt> parameter <tt>dg_broker_start</tt> must be <tt>TRUE</tt> for this check. " "The apply and transport lag can be configured with this rule."), elements=[ ("active_dataguard_option", MonitoringState( title=_( "State in case of Active Data-Guard Option is active: "), help= _("The Active Data-Guard Option needs an addional License from Oracle." ), default_value=1, )), ("mrp_option", Tuple( title= _("State in case Managed Recovery Process (MRP) is started or stopped" ), help= _("The MRP is usally started on each physical " "standby node. But in some setups this may vary and the process should " "only be started on specific or random nodes. Here you may define which " "state a specific node or service should have in case the MRP is started " "or stopped."), elements=[ MonitoringState(title=_("State in case MRP is started"), default_value=0), MonitoringState(title=_("State in case MRP is stopped"), default_value=2), ])), ("primary_broker_state", Checkbox( title=_("Check State of Broker on Primary: "), default_value=False, help=_( "Data-Guards with dg_broker_start=false needs Ignore Brokerstate to monitor " "the Switchoverstate on Primary."), )), ("apply_lag", Tuple( title=_("Apply Lag Maximum Time"), help= _("The maximum limit for the apply lag in <tt>v$dataguard_stats</tt>." ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ("apply_lag_min", Tuple( title=_("Apply Lag Minimum Time"), help= _("The minimum limit for the apply lag in <tt>v$dataguard_stats</tt>. " "This is only useful if also <i>Apply Lag Maximum Time</i> has been configured." ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ("transport_lag", Tuple( title=_("Transport Lag"), help= _("The limit for the transport lag in <tt>v$dataguard_stats</tt>" ), elements=[ Age(title=_("Warning at"), ), Age(title=_("Critical at"), ) ], )), ], )
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and # conditions defined in the file COPYING, which is part of this source code package. from cmk.gui.i18n import _ from cmk.gui.valuespec import ( Age, DropdownChoice, MonitoringState, Tuple, ) run_duration = Tuple( title=_("Maximum run duration for last execution"), help=_("Here you can define an upper limit for the run duration of " "last execution of the job."), elements=[ Age(title=_("warning at")), Age(title=_("critical at")), ], ) consider_db_status = DropdownChoice( title=_("Job State"), help=_("The state of the job is ignored by default."), choices=[ (True, _("Ignore the state of the Job")), (False, _("Consider the state of the job")), ], ) status_disabled_jobs = MonitoringState(
def parameter_valuespec(self): return Dictionary(elements=[ ('get_requests_perc', Alternative(title=_("Upper percentual levels for GET requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('put_requests_perc', Alternative(title=_("Upper percentual levels for PUT requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('delete_requests_perc', Alternative(title=_("Upper percentual levels for DELETE requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('head_requests_perc', Alternative(title=_("Upper percentual levels for HEAD requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('post_requests_perc', Alternative(title=_("Upper percentual levels for POST requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('select_requests_perc', Alternative(title=_("Upper percentual levels for SELECT requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ('list_requests_perc', Alternative(title=_("Upper percentual levels for LIST requests"), style="dropdown", elements=[ Tuple(title=_("Set levels"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ]), Tuple(title=_("No levels"), elements=[ FixedValue(None, totext=""), FixedValue(None, totext=""), ]), ])), ])
def process_level_elements(): cpu_rescale_max_choices: DropdownChoices = [ ( True, # xgettext: no-python-format _("100% is all cores at full load"), ), (False, _("N * 100% as each core contributes with 100% at full load")), ] return [ ( "cpu_rescale_max", DropdownChoice( title=_("CPU rescale maximum load"), help=_( "CPU utilization is delivered by the Operating " "System as a per CPU core basis. Thus each core contributes " "with a 100% at full utilization, producing a maximum load " "of N*100% (N=number of cores). For simplicity this maximum " "can be rescaled down, making 100% the maximum and thinking " "in terms of total CPU utilization." ), default_value=True, choices=cpu_rescale_max_choices, invalid_choice_title=_("Unspecified.") + " " + _( "Starting from version 1.6.0 this value must be configured. " "Read Werk #6646 for further information." ), invalid_choice_error=_("CPU rescale maximum load is Unspecified.") + " " + _( "Starting from version 1.6.0 this value must be configured. " "Read Werk #6646 for further information." ), deprecated_choices=[CPU_RESCALE_MAX_UNSPEC], ), ), ( "levels", Tuple( title=_("Levels for process count"), help=_( "Please note that if you specify and also if you modify levels " "here, the change is activated only during an inventory." "Saving this rule is not enough. This is due to the nature of" "inventory rules." ), elements=[ Integer( title=_("Critical below"), unit=_("processes"), default_value=1, ), Integer( title=_("Warning below"), unit=_("processes"), default_value=1, ), Integer( title=_("Warning above"), unit=_("processes"), default_value=99999, ), Integer( title=_("Critical above"), unit=_("processes"), default_value=99999, ), ], ), ), ( "cpulevels", Tuple( title=_("Levels on total CPU utilization"), help=_( "By activating this options you can set levels on the total " "CPU utilization of all included processes." ), elements=[ Percentage(title=_("Warning at"), default_value=90, maxvalue=10000), Percentage(title=_("Critical at"), default_value=98, maxvalue=10000), ], ), ), ( "cpu_average", Integer( title=_("CPU Averaging"), help=_( "By activating averaging, Check_MK will compute the average of " "the total CPU utilization over a given interval. If you have defined " "alerting levels then these will automatically be applied on the " "averaged value. This helps to mask out short peaks. " ), unit=_("minutes"), minvalue=1, default_value=15, ), ), ( "single_cpulevels", Tuple( title=_("Levels on CPU utilization of a single process"), help=_( "Here you can define levels on the CPU utilization of single " "processes. For performance reasons CPU Averaging will not be " "applied to to the levels of single processes." ), elements=[ Percentage(title=_("Warning at"), default_value=90, maxvalue=10000), Percentage(title=_("Critical at"), default_value=98, maxvalue=10000), ], ), ), ( "min_age", Tuple( title=_("Minimum allowed age"), help=_( "Set lower levels on the age of the process (not the consumed CPU time, " "but the real time)." ), elements=[ Age(title=_("Warning at"), default_value=3600), Age(title=_("Critical at"), default_value=1800), ], ), ), ( "max_age", Tuple( title=_("Maximum allowed age"), help=_( "Set upper levels on the age of the process (not the consumed CPU time, " "but the real time)." ), elements=[ Age(title=_("Warning at"), default_value=3600), Age(title=_("Critical at"), default_value=7200), ], ), ), ( "virtual_levels", Tuple( title=_("Virtual memory usage"), elements=[ Filesize(title=_("Warning at"), default_value=1000 * 1024 * 1024 * 1024), Filesize(title=_("Critical at"), default_value=2000 * 1024 * 1024 * 1024), ], ), ), ( "resident_levels", Tuple( title=_("Physical memory usage"), elements=[ Filesize(title=_("Warning at"), default_value=100 * 1024 * 1024), Filesize(title=_("Critical at"), default_value=200 * 1024 * 1024), ], ), ), ( "resident_levels_perc", Tuple( title=_("Physical memory usage, in percentage of total RAM"), elements=[ Percentage(title=_("Warning at"), default_value=25.0), Percentage(title=_("Critical at"), default_value=50.0), ], ), ), ( "handle_count", Tuple( title=_("Handle Count (Windows only)"), help=_( "The number of object handles in the processes object table. This includes " "open handles to threads, files and other resources like registry keys." ), elements=[ Integer( title=_("Warning above"), unit=_("handles"), ), Integer( title=_("Critical above"), unit=_("handles"), ), ], ), ), ( "process_info", DropdownChoice( title=_("Enable per-process details in long-output"), label=_("Enable per-process details"), help=_( "If active, the long output of this service will contain a list of all the " "matching processes and their details (i.e. PID, CPU usage, memory usage). " "Please note that HTML output will only work if rules in the rulesets " '"%s" or "%s" are created or the global setting "%s" is disabled. ' "This might expose you to Cross-Site-Scripting attacks (everyone with " "write-access to checks could get scripts executed on the monitoring site " "in the context of the user of the monitoring site), so please do this if " "you understand the consequences." ) % ( _("Escape HTML codes in host output"), _("Escape HTML codes in service output"), _("Escape HTML codes in service output"), ), choices=[ (None, _("Disable")), ("text", _("Text output")), ("html", _("HTML output")), ], default_value=None, ), ), ( "process_info_arguments", Integer( title=_("Include process arguments in long-output"), label=_("Include per-process arguments (security risk!)"), help=_( "If non-zero, the list of all the matching processes and their details in the" " long-output will include up to the first N characters of all arguments for each" " process. Please note this may include sensitive data like credentials," " and is strongly discouraged." ), default_value=0, ), ), ( "icon", UserIconOrAction( title=_("Add custom icon or action"), help=_("You can assign icons or actions to the found services in the status GUI."), ), ), ]
def _parameter_valuespec_filestats(): return Dictionary( elements=file_size_age_elements + [ ("mincount", Tuple( title=_("Minimal file count"), elements=[ Integer(title=_("Warning below")), Integer(title=_("Critical below")), ], )), ("maxcount", Tuple( title=_("Maximal file count"), elements=[ Integer(title=_("Warning at or above")), Integer(title=_("Critical at or above")), ], )), ( "show_all_files", Checkbox( title=_("Show files in service details"), label=("Show files"), help= _("Display all files that have reached a WARN or a CRIT status in the " "service details. Note: displaying the files leads to a performance loss " "for large numbers of files within the file group. Please enable this feature " "only if it is needed."), ), ), ( "additional_rules", ListOf( Tuple(elements=[ TextUnicode( title=_("Display name"), help=_( "Specify a user-friendly name that will be displayed in the service " "details, along with the pattern to match."), ), RegExpUnicode( title=_("Filename/- expression"), mode="case_sensitive", size=70, ), Dictionary(elements=file_size_age_elements), ], ), title=_("Additional rules for outliers"), help= _("This feature is to apply different rules to files that are " "inconsistent with the files expected in this file group. " "This means that the rules set for the file group are overwritten. " "You can specify a filename or a regular expresion, and additional " "rules that are applied to the matching files. In case of multiple " "matching rules, the first matching rule is applied. " "Note: this feature is intended for outliers, and is therefore not " "suitable to configure subgroups. "), ), ), ], help= _("Here you can impose various levels on the results reported by the" " mk_filstats plugin. Note that some levels only apply to a matching" " output format (e.g. max/min count levels are not applied if only the" " smallest, largest, oldest and newest file is reported). In order to" " receive the required data, you must configure the plugin mk_filestats." ), )
def _parameter_valuespec_apc_symentra(): return Transform( Dictionary( elements=[ ( "capacity", Tuple( title=_("Levels of battery capacity"), elements=[ Percentage( title=_("Warning below"), default_value=95.0, ), Percentage( title=_("Critical below"), default_value=90.0, ), ], ), ), ( "calibration_state", MonitoringState( title=_("State if calibration is invalid"), default_value=0, ), ), ( "post_calibration_levels", Dictionary( title=_( "Levels of battery parameters after calibration"), help= _("After a battery calibration the battery capacity is reduced until the " "battery is fully charged again. Here you can specify an alternative " "lower level in this post-calibration phase. " "Since apc devices remember the time of the last calibration only " "as a date, the alternative lower level will be applied on the whole " "day of the calibration until midnight. You can extend this time period " "with an additional time span to make sure calibrations occuring just " "before midnight do not trigger false alarms."), elements=[ ( "altcapacity", Percentage( title= _("Alternative critical battery capacity after calibration" ), default_value=50, ), ), ( "additional_time_span", Integer( title= ("Extend post-calibration phase by additional time span" ), unit=_("minutes"), default_value=0, ), ), ], optional_keys=False, ), ), ( "battime", Tuple( title=_("Time left on battery"), elements=[ Age( title=_("Warning at"), help= _("Time left on Battery at and below which a warning state is triggered" ), default_value=0, display=["hours", "minutes"], ), Age( title=_("Critical at"), help= _("Time Left on Battery at and below which a critical state is triggered" ), default_value=0, display=["hours", "minutes"], ), ], ), ), ( "battery_replace_state", MonitoringState( title=_("State if battery needs replacement"), default_value=1, ), ), ], optional_keys=[ "post_calibration_levels", "output_load", "battime" ], ), forth=_apc_symentra_transform_apc_symmetra, )
rulespec_registry, RulespecGroupCheckParametersApplications, ) from cmk.gui.valuespec import Dictionary, Integer, Transform, Tuple, ValueSpec mailqueue_elements: typing.List[typing.Tuple[str, ValueSpec]] = [ ( "deferred", Tuple( title=_("Mails in outgoing mail queue/deferred mails"), help=_( "This rule is applied to the number of E-Mails currently " "in the deferred mail queue, or in the general outgoing mail " "queue, if such a distinction is not available."), elements=[ Integer(title=_("Warning at"), unit=_("mails"), default_value=10), Integer(title=_("Critical at"), unit=_("mails"), default_value=20), ], ), ), ( "active", Tuple( title=_("Mails in active mail queue"), help=_("This rule is applied to the number of E-Mails currently " "in the active mail queue"), elements=[
def _parameter_valuespec_systemd_services(): return Dictionary(elements=[ ("states", Dictionary( title=_("Map systemd states to monitoring states"), elements=[ ("active", MonitoringState( title=_("Monitoring state if service is active"), default_value=0, )), ("inactive", MonitoringState( title=_("Monitoring state if service is inactive"), default_value=0, )), ("failed", MonitoringState( title=_("Monitoring state if service is failed"), default_value=2, )), ], )), ("states_default", MonitoringState( title=_("Monitoring state for any other service state"), default_value=2, )), ("ignored", ListOf( RegExp( title=_("Pattern (Regex)"), size=40, mode=RegExp.infix, ), title=_("Exclude services matching provided regex patterns"), help= _('<p>You can optionally define one or multiple regular expressions ' 'where a matching case will result in the exclusion of the concerning service(s). ' 'This allows to ignore services which are known to fail beforehand. </p>' ), add_label=_("Add pattern"), )), ("activating_levels", Tuple( title=_( "Define a tolerating time period for activating services"), help= _("Choose time levels (in seconds) for which a service is allowed to be in an 'activating' state" ), elements=[ Integer(title=_("Warning at"), unit=_("seconds"), default_value=30), Integer(title=_("Critical at"), unit=_("seconds"), default_value=60), ])), ("reloading_levels", Tuple( title=_("Define a tolerating time period for reloading services"), help= _("Choose time levels (in seconds) for which a service is allowed to be in a 'reloading' state" ), elements=[ Integer(title=_("Warning at"), unit=_("seconds"), default_value=30), Integer(title=_("Critical at"), unit=_("seconds"), default_value=60), ])), ], help=_( "This ruleset only applies to the Summary Systemd service and not the individual " "Systemd services."))
def liveproxyd_connection_params_elements(cls): defaults = ConfigDomainLiveproxy.connection_params_defaults() return [ ( "channels", Integer( title=_("Number of channels to keep open"), minvalue=2, maxvalue=50, default_value=defaults["channels"], ), ), ( "heartbeat", Tuple( title=_("Regular heartbeat"), orientation="float", elements=[ Integer( label=_("One heartbeat every"), unit=_("sec"), minvalue=1, default_value=defaults["heartbeat"][0], ), Float( label=_("with a timeout of"), unit=_("sec"), minvalue=0.1, default_value=defaults["heartbeat"][1], display_format="%.1f", ), ], ), ), ( "channel_timeout", Float( title=_("Timeout waiting for a free channel"), minvalue=0.1, default_value=defaults["channel_timeout"], unit=_("sec"), ), ), ( "query_timeout", Float( title=_("Total query timeout"), minvalue=0.1, unit=_("sec"), default_value=defaults["query_timeout"], ), ), ( "connect_retry", Float( title=_("Cooling period after failed connect/heartbeat"), minvalue=0.1, unit=_("sec"), default_value=defaults["connect_retry"], ), ), ( "cache", Checkbox( title=_("Enable Caching"), label=_("Cache several non-status queries"), help= _("This option will enable the caching of several queries that " "need no current data. This reduces the number of Livestatus " "queries to sites and cuts down the response time of remote " "sites with large latencies."), default_value=defaults["cache"], ), ), ]
def _parameter_valuespec_brocade_fcport(): return Dictionary(elements=[ ( "bw", Alternative( title=_("Throughput levels"), help= _("Please note: in a few cases the automatic detection of the link speed " "does not work. In these cases you have to set the link speed manually " "below if you want to monitor percentage values"), elements=[ Tuple( title=_( "Used bandwidth of port relative to the link speed" ), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], ), Tuple( title=_("Used Bandwidth of port in megabyte/s"), elements=[ Integer(title=_("Warning at"), unit=_("MByte/s")), Integer(title=_("Critical at"), unit=_("MByte/s")), ], ), ], ), ), ( "assumed_speed", Float( title=_("Assumed link speed"), help=_("If the automatic detection of the link speed does " "not work you can set the link speed here."), unit=_("GByte/s"), ), ), ( "rxcrcs", Tuple( title=_("CRC errors rate"), elements=[ Percentage(title=_("Warning at"), unit=_("percent"), display_format="%.2f"), Percentage(title=_("Critical at"), unit=_("percent"), display_format="%.2f"), ], ), ), ( "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( valuespec=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( valuespec=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( valuespec=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"), ), ), ], )
def parameter_valuespec(self): return Dictionary( help=_( "This ruleset can be used to change MTR's (Matt's traceroute) warning and crit levels for packet loss, average " "roundtrip and standard deviation."), elements=[ ("avg", Tuple( title=_("Average roundtrip time in ms"), elements=[ Integer(title=_("Warning at"), default_value=150, unit=_("ms"), min_value=0), Integer(title=_("Critical at"), default_value=250, unit=_("ms"), min_value=0), ], help= _("The maximum average roundtrip time in ms before this service goes into warning/critical. " "This alarm only applies to the target host, not the hops in between." ), )), ("stddev", Tuple( title=_("Standard deviation of roundtrip times in ms"), elements=[ Integer(title=_("Warning at"), default_value=150, unit=_("ms"), min_value=0), Integer(title=_("Critical at"), default_value=250, unit=_("ms"), min_value=0), ], help= _("The maximum standard deviation on the roundtrip time in ms before this service goes into" "warning/critical. This alarm only applies to the target host, not the hops in between." ), )), ("loss", Tuple( title=_("Packet loss in percentage"), elements=[ Integer(title=_("Warning at"), default_value=10, unit=_("%"), min_value=0), Integer(title=_("Critical at"), default_value=25, unit=_("%"), min_value=0), ], help=_( "The maximum allowed percentage of packet loss to the destination before this service " "goes into warning/critical."), )), ], optional_keys=False, )
def _parameter_valuespec_rabbitmq_vhosts(): return Dictionary(elements=[ ("msg_upper", Tuple( title=_("Upper level for total number of messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], )), ("msg_lower", Tuple( title=_("Lower level for total number of messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], )), ("msg_ready_upper", Tuple( title=_("Upper level for total number of ready messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], )), ("msg_ready_lower", Tuple( title=_("Lower level for total number of ready messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], )), ("msg_unack_upper", Tuple( title=_( "Upper level for total number of unacknowledged messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], )), ("msg_unack_lower", Tuple( title=_( "Lower level for total number of unacknowledged messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], )), ("msg_publish_upper", Tuple( title=_("Upper level for total number of published messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], )), ("msg_publish_lower", Tuple( title=_("Lower level for total number of published messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], )), ("msg_publish_rate_upper", Tuple( title=_("Upper level for published message rate"), elements=[ Float(title=_("Warning at"), unit="1/s"), Float(title=_("Critical at"), unit="1/s"), ], )), ("msg_publish_rate_lower", Tuple( title=_("Lower level for published message rate"), elements=[ Float(title=_("Warning below"), unit="1/s"), Float(title=_("Critical below"), unit="1/s"), ], )), ("msg_deliver_upper", Tuple( title=_("Upper level for total number of delivered messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], )), ("msg_deliver_lower", Tuple( title=_("Lower level for total number of delivered messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], )), ("msg_deliver_rate_upper", Tuple( title=_("Upper level for delivered message rate"), elements=[ Float(title=_("Warning at"), unit="1/s"), Float(title=_("Critical at"), unit="1/s"), ], )), ("msg_deliver_rate_lower", Tuple( title=_("Lower level for delivered message rate"), elements=[ Float(title=_("Warning below"), unit="1/s"), Float(title=_("Critical below"), unit="1/s"), ], )), ], )
def _parameter_valuespec_ups_out_load(): return Tuple(elements=[ Integer(title=_("warning at"), unit=u"%", default_value=85), Integer(title=_("critical at"), unit=u"%", default_value=90), ],)
def _parameter_valuespec_fileinfo_groups(): return Dictionary( elements=[ ("minage_oldest", Tuple( title=_("Minimal age of oldest file"), elements=[ Age(title=_("Warning if younger than")), Age(title=_("Critical if younger than")), ], )), ("maxage_oldest", Tuple( title=_("Maximal age of oldest file"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ("minage_newest", Tuple( title=_("Minimal age of newest file"), elements=[ Age(title=_("Warning if younger than")), Age(title=_("Critical if younger than")), ], )), ("maxage_newest", Tuple( title=_("Maximal age of newest file"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ("minsize_smallest", Tuple( title=_("Minimal size of smallest file"), elements=[ Filesize(title=_("Warning if below")), Filesize(title=_("Critical if below")), ], )), ("maxsize_smallest", Tuple( title=_("Maximal size of smallest file"), elements=[ Filesize(title=_("Warning if above")), Filesize(title=_("Critical if above")), ], )), ("minsize_largest", Tuple( title=_("Minimal size of largest file"), elements=[ Filesize(title=_("Warning if below")), Filesize(title=_("Critical if below")), ], )), ("maxsize_largest", Tuple( title=_("Maximal size of largest file"), elements=[ Filesize(title=_("Warning if above")), Filesize(title=_("Critical if above")), ], )), ("minsize", Tuple( title=_("Minimal size"), elements=[ Filesize(title=_("Warning if below")), Filesize(title=_("Critical if below")), ], )), ("maxsize", Tuple( title=_("Maximal size"), elements=[ Filesize(title=_("Warning if above")), Filesize(title=_("Critical if above")), ], )), ("mincount", Tuple( title=_("Minimal file count"), elements=[ Integer(title=_("Warning if below")), Integer(title=_("Critical if below")), ], )), ("maxcount", Tuple( title=_("Maximal file count"), elements=[ Integer(title=_("Warning if above")), Integer(title=_("Critical if above")), ], )), ("timeofday", ListOfTimeRanges( title=_("Only check during the following times of the day"), help=_("Outside these ranges the check will always be OK"), )), ("conjunctions", ListOf( Tuple(elements=[ MonitoringState(title=_("Monitoring state"), default_value=2), ListOf( CascadingDropdown( orientation="horizontal", choices=[ ("count", _("File count at"), Integer()), ("count_lower", _("File count below"), Integer()), ("size", _("File size at"), Filesize()), ("size_lower", _("File size below"), Filesize()), ("largest_size", _("Largest file size at"), Filesize()), ("largest_size_lower", _("Largest file size below"), Filesize()), ("smallest_size", _("Smallest file size at"), Filesize()), ("smallest_size_lower", _("Smallest file size below"), Filesize()), ("oldest_age", _("Oldest file age at"), Age()), ("oldest_age_lower", _("Oldest file age below"), Age()), ("newest_age", _("Newest file age at"), Age()), ("newest_age_lower", _("Newest file age below"), Age()), ], ), magic="@#@#", ) ], ), title=_("Level conjunctions"), help= _("In order to check dependent file group statistics you can configure " "conjunctions of single levels now. A conjunction consists of a monitoring state " "and any number of upper or lower levels. If all of the configured levels within " "a conjunction are reached then the related state is reported." ), )), (additional_rules(maxage_name='maxage', minage_name='minage', maxsize_name='maxsize', minsize_name='minsize')), ], ignored_keys=["precompiled_patterns", "group_patterns"], )
def _parameter_valuespec_temperature(): return Transform( valuespec=Dictionary( elements=[ ( "levels", Transform( valuespec=Tuple( title=_("Upper Temperature Levels"), elements=[ Float(title=_("Warning at"), unit="°C", default_value=26), Float(title=_("Critical at"), unit="°C", default_value=30), ], ), forth=lambda elems: (float(elems[0]), float(elems[1])), ), ), ( "levels_lower", Transform( valuespec=Tuple( title=_("Lower Temperature Levels"), elements=[ Float(title=_("Warning below"), unit="°C", default_value=0), Float(title=_("Critical below"), unit="°C", default_value=-10), ], ), forth=lambda elems: (float(elems[0]), float(elems[1])), ), ), ( "output_unit", DropdownChoice( title=_("Display values in "), choices=[ ("c", _("Celsius")), ("f", _("Fahrenheit")), ("k", _("Kelvin")), ], ), ), ( "input_unit", DropdownChoice( title=_("Override unit of sensor"), help= _("In some rare cases the unit that is signalled by the sensor " "is wrong and e.g. the sensor sends values in Fahrenheit while " "they are misinterpreted as Celsius. With this setting you can " "force the reading of the sensor to be interpreted as customized. " ), choices=[ ("c", _("Celsius")), ("f", _("Fahrenheit")), ("k", _("Kelvin")), ], ), ), ( "device_levels_handling", DropdownChoice( title= _("Interpretation of the device's own temperature status" ), choices=[ ("usr", _("Ignore device's own levels")), ("dev", _("Only use device's levels, ignore yours")), ("best", _("Use least critical of your and device's levels" )), ("worst", _("Use most critical of your and device's levels") ), ("devdefault", _("Use device's levels if present, otherwise yours" )), ( "usrdefault", _("Use your own levels if present, otherwise the device's" ), ), ], default_value="usrdefault", ), ), ( "trend_compute", Dictionary( title=_("Trend computation"), elements=[ ( "period", Integer( title= _("Observation period for temperature trend computation" ), default_value=30, minvalue=5, unit=_("minutes"), ), ), ( "trend_levels", Tuple( title= _("Levels on temperature increase per period" ), elements=[ Integer( title=_("Warning at"), unit="°C / " + _("period"), default_value=5, ), Integer( title=_("Critical at"), unit="°C / " + _("period"), default_value=10, ), ], ), ), ( "trend_levels_lower", Tuple( title= _("Levels on temperature decrease per period" ), elements=[ Integer( title=_("Warning at"), unit="°C / " + _("period"), default_value=5, ), Integer( title=_("Critical at"), unit="°C / " + _("period"), default_value=10, ), ], ), ), ( "trend_timeleft", Tuple( title= _("Levels on the time left until a critical temperature (upper or lower) is reached" ), elements=[ Integer( title=_("Warning if below"), unit=_("minutes"), default_value=240, ), Integer( title=_("Critical if below"), unit=_("minutes"), default_value=120, ), ], ), ), ], optional_keys=[ "trend_levels", "trend_levels_lower", "trend_timeleft" ], ), ), ], ignored_keys=["_item_key"], ), forth=lambda v: isinstance(v, tuple) and {"levels": v} or v, )
def _parameter_valuespec_memory(): return Transform( Dictionary( elements=[ ( "levels", Alternative( title=_("Levels for memory"), show_alternative_title=True, default_value=(150.0, 200.0), match=match_dual_level_type, help= _("The used and free levels for the memory on UNIX systems take into account the " "currently used memory (RAM or Swap) by all processes and sets this in relation " "to the total RAM of the system. This means that the memory usage can exceed 100%. " "A usage of 200% means that the total size of all processes is twice as large as " "the main memory, so <b>at least</b> half of it is currently swapped out. For systems " "without Swap space you should choose levels below 100%." ), elements=[ Alternative( title=_("Levels for used memory"), style="dropdown", elements=[ Tuple( title= _("Specify levels in percentage of total RAM" ), elements=[ Percentage(title=_( "Warning at a usage of"), maxvalue=None), Percentage(title=_( "Critical at a usage of"), maxvalue=None) ], ), Tuple( title=_( "Specify levels in absolute values" ), elements=[ Integer(title=_("Warning at"), unit=_("MB")), Integer(title=_("Critical at"), unit=_("MB")) ], ), ], ), Transform( Alternative( style="dropdown", elements=[ Tuple( title= _("Specify levels in percentage of total RAM" ), elements=[ Percentage( title=_( "Warning if less than" ), maxvalue=None, ), Percentage( title=_( "Critical if less than" ), maxvalue=None, ) ], ), Tuple( title= _("Specify levels in absolute values" ), elements=[ Integer(title=_( "Warning if below"), unit=_("MB")), Integer(title=_( "Critical if below"), unit=_("MB")) ], ), ], ), title=_("Levels for free memory"), help= _("Keep in mind that if you have 1GB RAM and 1GB Swap you need to " "specify 120% or 1200MB to get an alert if there is only 20% free RAM available. " "The free memory levels do not work with the fortigate check, because it does " "not provide total memory data."), forth=lambda val: tuple(-x for x in val), back=lambda val: tuple(-x for x in val), ) ], ), ), ("average", Integer( title=_("Averaging"), help= _("If this parameter is set, all measured values will be averaged " "over the specified time interval before levels are being applied. Per " "default, averaging is turned off."), unit=_("minutes"), minvalue=1, default_value=60, )), ], optional_keys=["average"], ), forth=lambda t: isinstance(t, tuple) and {"levels": t} or t, )
def _parameter_valuespec_graylog_sidecars(): return Dictionary(elements=[ ("active_state", MonitoringState(title=_("State when active state is not OK"), default_value=2)), ("last_seen", Tuple( title=_("Time since the sidecar was last seen by graylog"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")) ], )), ("running_lower", Tuple( title=_("Total number of collectors in state running lower " "level"), elements=[ Integer(title=_("Warning if less then"), unit="collectors", default_value=1), Integer(title=_("Critical if less then"), unit="collectors", default_value=0) ], )), ("running_upper", Tuple( title=_("Total number of collectors in state running upper " "level"), elements=[ Integer(title=_("Warning at"), unit="collectors"), Integer(title=_("Critical at"), unit="collectors") ], )), ("stopped_lower", Tuple( title=_("Total number of collectors in state stopped lower " "level"), elements=[ Integer(title=_("Warning if less then"), unit="collectors"), Integer(title=_("Critical if less then"), unit="collectors") ], )), ("stopped_upper", Tuple( title=_("Total number of collectors in state stopped upper " "level"), elements=[ Integer(title=_("Warning at"), unit="collectors", default_value=1), Integer(title=_("Critical at"), unit="collectors", default_value=1) ], )), ("failing_lower", Tuple( title=_("Total number of collectors in state failing lower " "level"), elements=[ Integer(title=_("Warning if less then"), unit="collectors"), Integer(title=_("Critical if less then"), unit="collectors") ], )), ("failing_upper", Tuple( title=_("Total number of collectors in state failing upper " "level"), elements=[ Integer(title=_("Warning at"), unit="collectors", default_value=1), Integer(title=_("Critical at"), unit="collectors", default_value=1) ], )), ("running", MonitoringState(title=_("State when collector is in state running"), default_value=0)), ("stopped", MonitoringState(title=_("State when collector is in state stopped"), default_value=1)), ("failing", MonitoringState(title=_("State when collector is in state failing"), default_value=2)), ("no_ping", MonitoringState(title=_("State when no ping signal from sidecar"), default_value=2)), ], )
def valuespec(self): return Dictionary( title=_("Automatic disk space cleanup"), help= _("You can configure your monitoring site to free disk space based on the ages " "of files or free space of the volume the site is placed on.<br>" "The monitoring site is executing the program <tt>diskspace</tt> 5 past " "every full hour as cron job. Details about the execution are logged to the file " "<tt>var/log/diskspace.log</tt>. You can always execut this program manually " "(add the <tt>-v</tt> option to see details about the actions taken)." ), elements=[ ( "max_file_age", Age( minvalue=1, # 1 sec default_value=31536000, # 1 year title=_("Delete files older than"), help= _("The historic events (state changes, downtimes etc.) of your hosts and services " "is stored in the monitoring " "history as plain text log files. One history log file contains the monitoring " "history of a given time period of all hosts and services. The files which are " "older than the configured time will be removed on the next execution of the " "disk space cleanup.<br>" "The historic metrics are stored in files for each host and service " "individually. When a host or service is removed from the monitoring, it's " "metric files remain untouched on your disk until the files last update " "(modification time) is longer ago than the configure age." ))), ( "min_free_bytes", Tuple( elements=[ Filesize( title=_("Cleanup when disk space is below"), minvalue=1, # min 1 byte default_value=0, ), Age( title=_("Never remove files newer than"), minvalue=1, # minimum 1 sec default_value=2592000, # 1 month help=_( "With this option you can prevent cleanup of files which have been updated " "within this time range."), ), ], title=_( "Delete additional files when disk space is below" ), help= _("When the disk space cleanup by file age was not able to gain enough " "free disk space, then the cleanup mechanism starts cleaning up additional " "files. The files are deleted by age, the oldest first, until the files are " "newer than the configured minimum file age."))), ( "cleanup_abandoned_host_files", Age( title=_("Cleanup abandoned host files older than"), minvalue=3600, # 1 hour default_value=2592000, # 1 month help= _("During monitoring there are several dedicated files created for each host. " "There are, for example, the discovered services, performance data and " "different temporary files created. During deletion of a host, these files " "are normally deleted. But there are cases, where the files are left on " "the disk until manual deletion, for example if you move a host from one " "site to another or deleting a host manually from the configuration.<br>" "The performance data (RRDs) and HW/SW inventory archive are never deleted " "during host deletion. They are only deleted automatically when you enable " "this option and after the configured period."))), ], default_keys=["cleanup_abandoned_host_files"], empty_text=_("Disk space cleanup is disabled"), )
def _parameter_valuespec_tcp_conn_stats(): return Dictionary(elements=[ ( "ESTABLISHED", Tuple( title=_("ESTABLISHED"), help=_("connection up and passing data"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "SYN_SENT", Tuple( title=_("SYN_SENT"), help= _("session has been requested by us; waiting for reply from remote endpoint" ), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "SYN_RECV", Tuple( title=_("SYN_RECV"), help=_("session has been requested by a remote endpoint " "for a socket on which we were listening"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "LAST_ACK", Tuple( title=_("LAST_ACK"), help=_( "our socket is closed; remote endpoint has also shut down; " " we are waiting for a final acknowledgement"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "CLOSE_WAIT", Tuple( title=_("CLOSE_WAIT"), help=_("remote endpoint has shut down; the kernel is waiting " "for the application to close the socket"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "TIME_WAIT", Tuple( title=_("TIME_WAIT"), help= _("socket is waiting after closing for any packets left on the network" ), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "CLOSED", Tuple( title=_("CLOSED"), help=_("socket is not being used"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "CLOSING", Tuple( title=_("CLOSING"), help=_( "our socket is shut down; remote endpoint is shut down; " "not all data has been sent"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "FIN_WAIT1", Tuple( title=_("FIN_WAIT1"), help=_("our socket has closed; we are in the process of " "tearing down the connection"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "FIN_WAIT2", Tuple( title=_("FIN_WAIT2"), help=_("the connection has been closed; our socket is waiting " "for the remote endpoint to shutdown"), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "LISTEN", Tuple( title=_("LISTEN"), help= _("represents waiting for a connection request from any remote TCP and port" ), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "BOUND", Tuple( title=_("BOUND"), help=_("the socket has been created and an address assigned " "to with bind(). The TCP stack is not active yet. " "This state is only reported on Solaris."), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ( "IDLE", Tuple( title=_("IDLE"), help=_( "a TCP session that is active but that has no data being " "transmitted by either device for a prolonged period of time" ), elements=[ Integer(title=_("Warning at"), label=_("connections")), Integer(title=_("Critical at"), label=_("connections")), ], ), ), ], )