def _parameter_valuespec_fileinfo_groups(): return Dictionary( elements=file_size_age_elements + [ ("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", ListOf( Tuple(elements=[ RegExpUnicode(title=_("Filename/- expression"), mode="case_sensitive"), Dictionary(elements=file_size_age_elements), ], ), title=_("Additional rules for files"), help= _("You can specify a filename or a regular expresion, and additional " "rules that are applied to the matching files. This means that the " "rules set for the whole file group are overwritten for those files. " "Note that the order in which you specify the rules matters: " "in case of multiple matching rules, the first matching rule is " "applied."), )), ], ignored_keys=["precompiled_patterns", "group_patterns"], )
def _parameter_valuespec_heartbeat_crm(): return Transform( valuespec=Dictionary( elements=[ ( "max_age", Integer( title=_("Maximum age"), help= _("Maximum accepted age of the reported data in seconds" ), unit=_("seconds"), default_value=60, ), ), ( "dc", TextInput( allow_empty=False, title=_("Expected DC"), help= _("The hostname of the expected distinguished controller of the cluster" ), ), ), ( "num_nodes", Integer( minvalue=0, default_value=2, title=_("Number of Nodes"), help=_("The expected number of nodes in the cluster"), ), ), ( "num_resources", Integer( minvalue=0, title=_("Number of Resources"), help=_( "The expected number of resources in the cluster"), ), ), ( "show_failed_actions", DropdownChoice( title=_('Show "Failed Actions"'), choices=[ ( False, _('Don\'t show or warn if "Failed Actions" are present (default)' ), ), (True, _('Show "Failed Actions" and warn if any is present' )), ], default_value=False, help=_( 'If activated, any "Failed Action" entry will be shown in the main check ' "and the check will go to the WARN state."), ), ), ], optional_keys=[ "dc", "num_nodes", "num_resources", "show_failed_actions" ], ), forth=_heartbeat_crm_transform_heartbeat_crm, )
def _parameter_valuespec_ibm_svc_host(): return Transform( valuespec=Dictionary(elements=[ ( "active_hosts", Tuple( title=_("Count of active hosts"), elements=[ Integer(title=_("Warning at or below"), minvalue=0, unit=_("active hosts")), Integer(title=_("Critical at or below"), minvalue=0, unit=_("active hosts")), ], ), ), ( "inactive_hosts", Tuple( title=_("Count of inactive hosts"), elements=[ Integer(title=_("Warning at or above"), minvalue=0, unit=_("inactive hosts")), Integer( title=_("Critical at or above"), minvalue=0, unit=_("inactive hosts"), ), ], ), ), ( "degraded_hosts", Tuple( title=_("Count of degraded hosts"), elements=[ Integer(title=_("Warning at or above"), minvalue=0, unit=_("degraded hosts")), Integer( title=_("Critical at or above"), minvalue=0, unit=_("degraded hosts"), ), ], ), ), ( "offline_hosts", Tuple( title=_("Count of offline hosts"), elements=[ Integer(title=_("Warning at or above"), minvalue=0, unit=_("offline hosts")), Integer(title=_("Critical at or above"), minvalue=0, unit=_("offline hosts")), ], ), ), ( "other_hosts", Tuple( title=_("Count of other hosts"), elements=[ Integer(title=_("Warning at or above"), minvalue=0, unit=_("other hosts")), Integer(title=_("Critical at or above"), minvalue=0, unit=_("other hosts")), ], ), ), ], ), forth=transform_ibm_svc_host, )
def process_level_elements(): cpu_rescale_max_choices: DropdownChoices = [ (True, _("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 " "\"Escape HTML codes in host output\" or \"Escape HTML codes in service output\" " "are created or the global setting \"Escape HTML codes in plugin output\" " "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." ), choices=[ (None, _("Disable")), ("text", _("Text output")), ("html", _("HTML output")), ], default_value=None, )), ('process_info_arguments', Integer( title=_("Include process arguments in long-output"), label=_("Include per-process arguments (security risk!)"), help= _("If non-zero, the the list of all the matching processes and their details" " in the long-output will include up to the first N arguments of each" " processes. Please note this may include sensitive data like credentials," " and is strongly discouraged."), default_value=0, )), ('icon', UserIconOrAction( title=_("Add custom icon or action"), help= _("You can assign icons or actions to the found services in the status GUI." ), )), ]
def _parameter_valuespec_fc_port(): return Dictionary( elements=[ ("bw", Alternative( title=_("Throughput levels"), help=_("Please note: in a few cases the automatic detection of the link speed " "does not work. In these cases you have to set the link speed manually " "below if you want to monitor percentage values"), elements=[ Tuple( title=_("Used bandwidth of port relative to the link speed"), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], ), Tuple( title=_("Used Bandwidth of port in megabyte/s"), elements=[ Integer(title=_("Warning at"), unit=_("MByte/s")), Integer(title=_("Critical at"), unit=_("MByte/s")), ], ) ], )), ("assumed_speed", Float(title=_("Assumed link speed"), help=_("If the automatic detection of the link speed does " "not work you can set the link speed here."), unit=_("Gbit/s"))), ("rxcrcs", Tuple( title=_("CRC errors rate"), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], )), ("rxencoutframes", Tuple( title=_("Enc-Out frames rate"), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], )), ("notxcredits", Tuple( title=_("No-TxCredits errors"), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], )), ("c3discards", Tuple( title=_("C3 discards"), elements=[ Percentage(title=_("Warning at"), unit=_("percent")), Percentage(title=_("Critical at"), unit=_("percent")), ], )), ("average", Integer( title=_("Averaging"), help=_("If this parameter is set, all throughputs will be averaged " "over the specified time interval before levels are being applied. Per " "default, averaging is turned off. "), unit=_("minutes"), minvalue=1, default_value=5, )), #("phystate", # Optional( # ListChoice( # title=_("Allowed states (otherwise check will be critical)"), # choices=[ # (1, _("unknown")), # (2, _("failed")), # (3, _("bypassed")), # (4, _("active")), # (5, _("loopback")), # (6, _("txfault")), # (7, _("nomedia")), # (8, _("linkdown")), # ],), # title=_("Physical state of port"), # negate=True, # label=_("ignore physical state"), # )), #("opstate", # Optional( # ListChoice( # title=_("Allowed states (otherwise check will be critical)"), # choices=[ # (1, _("unknown")), # (2, _("unused")), # (3, _("ready")), # (4, _("warning")), # (5, _("failure")), # (6, _("not participating")), # (7, _("initializing")), # (8, _("bypass")), # (9, _("ols")), # ],), # title=_("Operational state"), # negate=True, # label=_("ignore operational state"), # )), #("admstate", # Optional( # ListChoice( # title=_("Allowed states (otherwise check will be critical)"), # choices=[ # (1, _("unknown")), # (2, _("online")), # (3, _("offline")), # (4, _("bypassed")), # (5, _("diagnostics")), # ],), # title=_("Administrative state"), # negate=True, # label=_("ignore administrative state"), # )) ],)
def _parameter_valuespec_rabbitmq_queues(): 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"), ], ), ), ( "abs_memory", Tuple( title=_("Absolute levels for used memory"), elements=[ Filesize(title=_("Warning at")), Filesize(title=_("Critical at")), ], ), ), ], )
def _valuespec_active_checks_elasticsearch_query(): return Dictionary( required_keys=["svc_item", "pattern", "timerange"], title=_("Query elasticsearch logs"), help=_( "You can search indices for defined patterns in defined fieldnames." ), elements=[ ( "svc_item", TextInput( title=_("Item suffix"), help=_( "Here you can define what service description (item) is " "used for the created service. The resulting item " "is always prefixed with 'Elasticsearch Query'."), allow_empty=False, size=16, ), ), ( "hostname", TextInput( title=_("DNS hostname or IP address"), help=_( "You can specify a hostname or IP address different from the IP address " "of the host this check will be assigned to."), allow_empty=False, ), ), ("user", TextInput(title=_("Username"), size=32, allow_empty=True)), ( "password", PasswordFromStore( title=_("Password of the user"), allow_empty=False, ), ), ( "protocol", DropdownChoice( title=_("Protocol"), help= _("Here you can define which protocol to use, default is https." ), choices=[ ("http", "HTTP"), ("https", "HTTPS"), ], default_value="https", ), ), ( "port", Integer( title=_("Port"), help= _("Use this option to query a port which is different from standard port 9200." ), default_value=9200, ), ), ( "pattern", TextInput( title=_("Search pattern"), help= _("Here you can define what search pattern should be used. " "You can use Kibana query language as described " '<a href="https://www.elastic.co/guide/en/kibana/current/kuery-query.html"' 'target="_blank">here</a>. To optimize search speed, use defined indices and fields ' "otherwise all indices and fields will be searched."), allow_empty=False, size=32, ), ), ( "index", ListOfStrings( title=_("Indices to query"), help=_("Here you can define what index should be queried " "for the defined search. You can query one or " "multiple indices. Without this option all indices " "are queried. If you want to speed up your search, " "use definded indices."), orientation="horizontal", allow_empty=False, size=48, ), ), ( "fieldname", ListOfStrings( title=_("Fieldnames to query"), help= _("Here you can define fieldnames that should be used " "in the search. Regexp query is allowed as described " '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html"' 'target="_blank">here</a>. If you want to speed up your search, ' "use defined indices."), allow_empty=False, orientation="horizontal", size=32, ), ), ( "timerange", Age( title=_("Timerange"), help= _("Here you can define the timerange to query, eg. the last x minutes from now. " "The query will then check for the count of log messages in the defined range. " "Default is 1 minute."), display=["days", "hours", "minutes"], default_value=60, ), ), ( "count", Tuple( title=_("Thresholds on message count"), elements=[ Integer( title=_("Warning at or above"), unit=_("log messages"), ), Integer( title=_("Critical at or above"), unit=_("log messages"), ), ], ), ), ], )
def single_spec(self) -> List[Tuple[str, ValueSpec]]: return [ ('downtime_id', Integer(title=_('Downtime ID'), )), ]
def single_spec(self) -> List[Tuple[str, ValueSpec]]: return [ ('event_id', Integer(title=_('Event ID'), )), ]
def parameter_valuespec(self): 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=self._transform_apc_symmetra, )
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 TextAscii() and RegExp(). Also handle the negation in a different way valuespec=TextAscii(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 TextAscii() and RegExp(). Also handle the negation in a different way valuespec=TextAscii(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 vs_bulk_discovery(render_form=False, include_subfolders=True): if render_form: render = "form" else: render = None if include_subfolders: selection_elements = [ Checkbox(label=_("Include all subfolders"), default_value=True) ] else: selection_elements = [] selection_elements += [ Checkbox( label=_("Only include hosts that failed on previous discovery"), default_value=False), Checkbox(label=_("Only include hosts with a failed discovery check"), default_value=False), Checkbox(label=_("Exclude hosts where the agent is unreachable"), default_value=False), ] return Dictionary( title=_("Bulk discovery"), render=render, elements=[ ("mode", DropdownChoice( title=_("Mode"), default_value="new", choices=[ ("new", _("Add unmonitored services and new host labels")), ("remove", _("Remove vanished services")), ("fixall", _("Add unmonitored services and new host labels, remove vanished services" )), ("refresh", _("Refresh all services (tabula rasa), add new host labels" )), ], )), ("selection", Tuple(title=_("Selection"), elements=selection_elements)), ("performance", Tuple(title=_("Performance options"), elements=[ Checkbox(label=_("Use cached data if present"), default_value=True), Checkbox(label=_("Do full SNMP scan for SNMP devices"), default_value=True), Integer(label=_("Number of hosts to handle at once"), default_value=10), ])), ("error_handling", Checkbox(title=_("Error handling"), label=_("Ignore errors in single check plugins"), default_value=True)), ], optional_keys=[], )
def _count_tuple(self, 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(self): return Dictionary( elements=[ ( "memory", Alternative( title=_("Memory Levels"), style="dropdown", elements=[ Tuple( title=_("Memory usage in percent"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ], ), Transform( Tuple( title=_("Absolute free memory"), elements=[ Filesize(title=_("Warning if less than")), Filesize(title=_("Critical if less than")), ], ), # Note: Filesize values lesser 1MB will not work # -> need hide option in filesize valuespec back=lambda x: (x[0] // 1024 // 1024, x[1] // 1024 // 1024), forth=lambda x: (x[0] * 1024 * 1024, x[1] * 1024 * 1024)), PredictiveLevels(unit=_("GB"), default_difference=(0.5, 1.0)) ], default_value=(80.0, 90.0))), ( "pagefile", Alternative( title=_("Commit charge Levels"), style="dropdown", elements=[ Tuple( title=_("Commit charge in percent (relative to commit limit)"), elements=[ Percentage(title=_("Warning at")), Percentage(title=_("Critical at")), ], ), Transform( Tuple( title=_("Absolute commitable memory"), elements=[ Filesize(title=_("Warning if less than")), Filesize(title=_("Critical if less than")), ], ), # Note: Filesize values lesser 1MB will not work # -> need hide option in filesize valuespec back=lambda x: (x[0] // 1024 // 1024, x[1] // 1024 // 1024), forth=lambda x: (x[0] * 1024 * 1024, x[1] * 1024 * 1024)), PredictiveLevels(unit=_("GB"), default_difference=(0.5, 1.0)) ], default_value=(80.0, 90.0))), ("average", Integer( title=_("Averaging"), help=_("If this parameter is set, all measured values will be averaged " "over the specified time interval before levels are being applied. Per " "default, averaging is turned off. "), unit=_("minutes"), minvalue=1, default_value=60, )), ],)
def _parameter_valuespec_blank_tapes(): return Tuple(elements=[ Integer(title=_("Warning below"), default_value=5), Integer(title=_("Critical below"), default_value=1), ], )
def single_spec(self) -> List[Tuple[str, ValueSpec]]: return [ ('event_id', Integer(title=_('Event ID'), )), ('history_line', Integer(title=_('History Line Number'), )), ]
Age(title=_("Critical after "), default_value=15 * 60), ], help= _("A single thread fully utilizing a single core (potentially due to a bug) " "may go unnoticed when only monitoring the total utilization of the CPU. " "With this configuration, check_mk will alert if a single core is " "exceeding a utilization threshold over an extended period of time." "This is currently only supported on linux and windows agents " "as well as devices monitored through the host-resource mib"))), ("average", Integer( title=_("Averaging for total CPU utilization"), help= _("When this option is activated then the CPU utilization is being " "averaged <b>before</b> the levels on total CPU utilization are being applied." ), unit=_("minutes"), minvalue=1, default_value=15, label=_("Compute average over last "), )), ("util", Levels( title=_("Levels on total CPU utilization"), unit="%", default_levels=(90, 95), default_difference=(5, 8), default_value=None, help= _("The CPU utilization sums up the percentages of CPU time that is used " "for user processes, kernel routines (system), disk wait (sometimes also "
def valuespec(self): return Dictionary( title=_('Lotus Domino Task Discovery'), help=_("This rule controls the discovery of tasks on Lotus Domino systems. " "Any changes later on require a host re-discovery"), elements=[ ('descr', TextAscii( title=_('Service Description'), allow_empty=False, help= _('<p>The service description may contain one or more occurances of <tt>%s</tt>. In this ' 'case, the pattern must be a regular expression prefixed with ~. For each ' '<tt>%s</tt> in the description, the expression has to contain one "group". A group ' 'is a subexpression enclosed in brackets, for example <tt>(.*)</tt> or ' '<tt>([a-zA-Z]+)</tt> or <tt>(...)</tt>. When the inventory finds a task ' 'matching the pattern, it will substitute all such groups with the actual values when ' 'creating the check. In this way one rule can create several checks on a host.</p>' '<p>If the pattern contains more groups than occurrences of <tt>%s</tt> in the service ' 'description, only the first matching subexpressions are used for the service ' 'descriptions. The matched substrings corresponding to the remaining groups ' 'are nevertheless copied into the regular expression.</p>' '<p>As an alternative to <tt>%s</tt> you may also use <tt>%1</tt>, <tt>%2</tt>, etc. ' 'These expressions will be replaced by the first, second, ... matching group, allowing ' 'you to reorder things.</p>'), )), ( 'match', Alternative( title=_("Task Matching"), elements=[ TextAscii( title=_("Exact name of the task"), size=50, ), Transform( RegExp( size=50, mode=RegExp.prefix, ), title=_("Regular expression matching command line"), help=_("This regex must match the <i>beginning</i> of the task"), forth=lambda x: x[1:], # remove ~ back=lambda x: "~" + x, # prefix ~ ), FixedValue( None, totext="", title=_("Match all tasks"), ) ], match=lambda x: (not x and 2) or (x[0] == '~' and 1 or 0), default_value='foo')), ('levels', Tuple( title=_('Levels'), 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=1, ), Integer( title=_("Critical above"), unit=_("processes"), default_value=1, ), ], )), ], required_keys=['match', 'levels', 'descr'], )
def _vs_rules(self): return Dictionary( optional_keys=False, elements=[ ( "agent_port", Integer( minvalue=1, maxvalue=65535, default_value=6556, title=_('Checkmk Agent Port (<a href="%s">Rules</a>)') % watolib.folder_preserving_link( [("mode", "edit_ruleset"), ("varname", "agent_ports")]), help=_( "This variable allows to specify the TCP port to " "be used to connect to the agent on a per-host-basis." ), ), ), ( "tcp_connect_timeout", Float( minvalue=1.0, default_value=5.0, unit=_("sec"), display_format="%.0f", # show values consistent to size=2, # SNMP-Timeout title=_( 'TCP Connection Timeout (<a href="%s">Rules</a>)') % watolib.folder_preserving_link( [("mode", "edit_ruleset"), ("varname", "tcp_connect_timeouts")]), help= _("This variable allows to specify a timeout for the " "TCP connection to the Check_MK agent on a per-host-basis." "If the agent does not respond within this time, it is considered to be unreachable." ), ), ), ( "snmp_timeout", Integer( title=_('SNMP-Timeout (<a href="%s">Rules</a>)') % watolib.folder_preserving_link( [("mode", "edit_ruleset"), ("varname", "snmp_timing")]), help= _("After a request is sent to the remote SNMP agent we will wait up to this " "number of seconds until assuming the answer get lost and retrying." ), default_value=1, minvalue=1, maxvalue=60, unit=_("sec"), ), ), ( "snmp_retries", Integer( title=_('SNMP-Retries (<a href="%s">Rules</a>)') % watolib.folder_preserving_link( [("mode", "edit_ruleset"), ("varname", "snmp_timing")]), default_value=5, minvalue=0, maxvalue=50, ), ), ], )
def _parameter_valuespec_jenkins_jobs(): return Dictionary(elements=[ ("jenkins_job_score", Tuple( title=_("Job score"), elements=[ Integer(title=_("Warning below"), unit="%"), Integer(title=_("Critical below"), unit="%"), ], )), ("jenkins_last_build", Tuple( title=_("Time since last build"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ("jenkins_time_since", Tuple( title=_("Time since last successful build"), elements=[ Age(title=_("Warning if older than")), Age(title=_("Critical if older than")), ], )), ('jenkins_build_duration', Tuple( title=_("Duration of last build"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ("job_state", Dictionary( title=_('Override check state based on job state'), elements=[ ("aborted", MonitoringState( title=_("State when job is in state aborted"), default_value=0)), ("blue", MonitoringState( title=_("State when job is in state success"), default_value=0)), ("disabled", MonitoringState( title=_("State when job is in state disabled"), default_value=0)), ("notbuilt", MonitoringState( title=_("State when job is in state not built"), default_value=0)), ("red", MonitoringState(title=_("State when job is in state failed"), default_value=2)), ("yellow", MonitoringState( title=_("State when job is in state unstable"), default_value=1)), ], )), ("build_result", Dictionary( title=_('Override check state based on last build result'), elements=[ ("success", MonitoringState( title=_("State when last build result is: success"), default_value=0)), ("unstable", MonitoringState( title=_("State when last build result is: unstable"), default_value=1)), ("failure", MonitoringState( title=_("State when last build result is: failed"), default_value=2)), ("aborted", MonitoringState( title=_("State when last build result is: aborted"), default_value=0)), ("null", MonitoringState(title=_( "State when last build result is: module not built"), default_value=1)), ("none", MonitoringState( title=_("State when build result is: running"), default_value=0)), ], )), ], )
def _valuespec_special_agents_rabbitmq(): return Dictionary( title=_("RabbitMQ"), help=_("Requests data from a RabbitMQ instance."), elements=[ ( "instance", TextInput( title=_("RabbitMQ instance to query"), help=_( "Use this option to set which instance should be " "checked by the special agent. Please add the " "hostname here, eg. my_rabbitmq.com. If not set, the " "assigned host is used as instance." ), size=32, allow_empty=False, ), ), ( "user", TextInput( title=_("Username"), help=_("The username that should be used for accessing the " "RabbitMQ API."), size=32, allow_empty=False, ), ), ( "password", PasswordFromStore( title=_("Password of the user"), allow_empty=False, ), ), ( "protocol", DropdownChoice( title=_("Protocol"), choices=[ ("http", "HTTP"), ("https", "HTTPS"), ], default_value="https", ), ), ( "port", Integer( title=_("Port"), default_value=15672, help=_("The port that is used for the api call."), ), ), ( "sections", ListChoice( title=_("Informations to query"), help=_( "Defines what information to query. You can choose " "between the cluster, nodes, vhosts and queues." ), choices=[ ("cluster", _("Clusterwide")), ("nodes", _("Nodes")), ("vhosts", _("Vhosts")), ("queues", _("Queues")), ], default_value=["cluster", "nodes", "vhosts", "queues"], allow_empty=False, ), ), ], optional_keys=[ "instance", "port", ], )
def _network_scan_elements(self): elements = [ ("ip_ranges", ListOf( self._vs_ip_range(), title=_("IP ranges to scan"), add_label=_("Add new IP range"), text_if_empty=_("No IP range configured"), )), ("exclude_ranges", ListOf( self._vs_ip_range(), title=_("IP ranges to exclude"), add_label=_("Add new IP range"), text_if_empty=_("No exclude range configured"), )), ( "scan_interval", Age( title=_("Scan interval"), display=["days", "hours"], default_value=60 * 60 * 24, minvalue=3600, # 1 hour )), ("time_allowed", Transform( ListOf( TimeofdayRange(allow_empty=False, ), title=_("Time allowed"), help=_( "Limit the execution of the scan to this time range." ), allow_empty=False, style=ListOf.Style.FLOATING, movable=False, default_value=[((0, 0), (24, 0))], ), forth=lambda x: [x] if isinstance(x, tuple) else x, back=sorted, )), ("set_ipaddress", Checkbox( title=_("Set IPv4 address"), help=_( "Whether or not to configure the found IP address as the IPv4 " "address of the found hosts."), default_value=True, )), ] elements += self._optional_tag_criticality_element() elements += [ ("max_parallel_pings", Integer( title=_("Parallel pings to send"), help=_( "Set the maximum number of concurrent pings sent to target IP " "addresses."), minvalue=1, maxvalue=200, default_value=100, )), ("run_as", DropdownChoice( title=_("Run as"), help= _("Execute the network scan in the Check_MK user context of the " "choosen user. This user needs the permission to add new hosts " "to this folder."), choices=self._get_all_user_ids, default_value=lambda: config.user.id, )), ("translate_names", HostnameTranslation(title=_("Translate Hostnames"), )), ] return elements
def _parameter_valuespec_rabbitmq_cluster_messages(): return Dictionary(elements=[ ( "messages_upper", Tuple( title=_("Upper level for total number of queued messages"), elements=[ Integer(title=_("Warning at"), unit="messages"), Integer(title=_("Critical at"), unit="messages"), ], ), ), ( "messages_lower", Tuple( title=_("Lower level for total number of queued messages"), elements=[ Integer(title=_("Warning below"), unit="messages"), Integer(title=_("Critical below"), unit="messages"), ], ), ), ( "message_rate_upper", Tuple( title=_("Upper level for message rate"), elements=[ Float(title=_("Warning at"), unit="1/s"), Float(title=_("Critical at"), unit="1/s"), ], ), ), ( "message_rate_lower", Tuple( title=_("Lower level for message rate"), elements=[ Float(title=_("Warning below"), unit="1/s"), Float(title=_("Critical below"), unit="1/s"), ], ), ), ( "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 db_levels_common(): return [ ("levels", Alternative( title=_("Levels for the Tablespace usage"), default_value=(10.0, 5.0), elements=[ Tuple(title=_("Percentage free space"), elements=[ Percentage(title=_("Warning if below"), unit=_("% free")), Percentage(title=_("Critical if below"), unit=_("% free")), ]), Tuple(title=_("Absolute free space"), elements=[ Integer(title=_("Warning if below"), unit=_("MB"), default_value=1000), Integer(title=_("Critical if below"), unit=_("MB"), default_value=500), ]), ListOf( Tuple( orientation="horizontal", elements=[ Filesize(title=_("Tablespace larger than")), Alternative( title=_("Levels for the Tablespace size"), elements=[ Tuple( title=_("Percentage free space"), elements=[ Percentage( title=_("Warning if below"), unit=_("% free")), Percentage( title=_("Critical if below"), unit=_("% free")), ]), Tuple( title=_("Absolute free space"), elements=[ Integer( title=_("Warning if below"), unit=_("MB")), Integer( title=_("Critical if below"), unit=_("MB")), ]), ]), ], ), title=_('Dynamic levels'), ), ])), ("magic", Float(title=_( "Magic factor (automatic level adaptation for large tablespaces)" ), help=_("This is only be used in case of percentual levels"), minvalue=0.1, maxvalue=1.0, default_value=0.9)), ("magic_normsize", Integer(title=_("Reference size for magic factor"), minvalue=1, default_value=1000, unit=_("MB"))), ("magic_maxlevels", Tuple( title=_("Maximum levels if using magic factor"), help=_( "The tablespace levels will never be raise above these values, when using " "the magic factor and the tablespace is very small."), elements=[ Percentage(title=_("Maximum warning level"), unit=_("% free"), allow_int=True, default_value=60.0), Percentage(title=_("Maximum critical level"), unit=_("% free"), allow_int=True, default_value=50.0), ])), ]
def _parameter_valuespec_mtr(): 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"), minvalue=0), Integer(title=_("Critical at"), default_value=250, unit=_("ms"), minvalue=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"), minvalue=0), Integer(title=_("Critical at"), default_value=250, unit=_("ms"), minvalue=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=_("%"), minvalue=0), Integer(title=_("Critical at"), default_value=25, unit=_("%"), minvalue=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_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"), 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=_("MiB")), Integer(title=_("Critical at"), unit=_("MiB")) ], ), ], ), Transform( Alternative(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=_("MiB")), Integer( title=_("Critical if below"), unit=_("MiB")) ], ), ], ), 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(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_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, )
def _parameter_valuespec_phion_firewall(): return Dictionary(elements=[ ( 'sessions', Alternative( title=_("Levels for concurrent sessions"), elements=[ FixedValue( None, title=_("No Levels"), totext=_("Do not impose levels, always be OK"), ), Tuple( title=_("Fixed Levels"), elements=[ Integer(title=_('Warning at'), ), Integer(title=_('Critical at'), ), ], ), ], ), ), ( 'packages', Alternative( title=_("Levels for rate of packets"), elements=[ FixedValue( None, title=_("No Levels"), totext=_("Do not impose levels, always be OK"), ), Tuple( title=_("Fixed Levels"), elements=[ Integer( unit='packets / second', title=_('Warning at'), ), Integer( unit='packets / second', title=_('Critical at'), ), ], ), ], ), ), ( 'traffic', Alternative( title=_("Levels for traffic"), elements=[ FixedValue( None, title=_("No Levels"), totext=_("Do not impose levels, always be OK"), ), Tuple( title=_("Fixed Levels"), elements=[ Integer( unit='bits / second', title=_('Warning at'), ), Integer( unit='bits / second', title=_('Critical at'), ), ], ), ], ), ), ])
def _werk_table_option_entries(): translator = cmk.utils.werks.WerkTranslator() return [ ("classes", "double", ListChoice( title=_("Classes"), choices=sorted(translator.classes()), ), ["feature", "fix", "security"]), ("levels", "double", ListChoice( title=_("Levels"), choices=sorted(translator.levels()), ), [1, 2, 3]), ("date", "double", Timerange(title=_("Date")), ('date', (1383149313, int(time.time())))), ("id", "single", TextInput( title=_("Werk ID"), label="#", regex="^[0-9]{1,5}$", size=7, ), ""), ("compatibility", "single", DropdownChoice(title=_("Compatibility"), choices=[ (["compat", "incomp_ack", "incomp_unack"], _("Compatible and incompatible Werks")), (["compat"], _("Compatible Werks")), (["incomp_ack", "incomp_unack"], _("Incompatible Werks")), (["incomp_unack"], _("Unacknowledged incompatible Werks")), (["incomp_ack"], _("Acknowledged incompatible Werks")), ]), ["compat", "incomp_ack", "incomp_unack"]), ("component", "single", DropdownChoice( title=_("Component"), choices=[ (None, _("All components")), ] + sorted(translator.components()), ), None), ("edition", "single", DropdownChoice( title=_("Edition"), choices=[ (None, _("All editions")), ("cme", _("Werks only concerning the Managed Services Edition")), ("cee", _("Werks only concerning the Enterprise Edition")), ("cre", _("Werks also concerning the Raw Edition")), ], ), None), ("werk_content", "single", TextInput( title=_("Werk title or content"), size=41, ), ""), ("version", "single", Tuple(title=_("Checkmk Version"), orientation="float", elements=[ TextInput(label=_("from:"), size=12), TextInput(label=_("to:"), size=12), ]), ("", "")), ("grouping", "single", DropdownChoice( title=_("Group Werks by"), choices=[ ("version", _("Checkmk Version")), ("day", _("Day of creation")), ("week", _("Week of creation")), (None, _("Do not group")), ], ), "version"), ("group_limit", "single", Integer( title=_("Show number of groups"), unit=_("groups"), minvalue=1, ), 20), ]
def _valuespec_active_checks_by_ssh(): return Tuple( title=_("Check via SSH service"), help=_("Checks via SSH. "), elements=[ TextInput( title=_("Command"), help=_("Command to execute on remote host."), allow_empty=False, size=50, ), Dictionary( title=_("Optional parameters"), elements=[ ( "description", TextInput( title=_("Service Description"), help= _("Must be unique for every host. Defaults to command that is executed." ), size=50, ), ), ( "hostname", TextInput( title=_("DNS Hostname or IP address"), default_value="$HOSTADDRESS$", allow_empty=False, help= _("You can specify a hostname or IP address different from IP address " "of the host as configured in your host properties." ), ), ), ( "port", Integer( title=_("SSH Port"), help=_("Default is 22."), minvalue=1, maxvalue=65535, default_value=22, ), ), ( "ip_version", Alternative( title=_("IP-Version"), elements=[ FixedValue(value="ipv4", totext="", title=_("IPv4")), FixedValue(value="ipv6", totext="", title=_("IPv6")), ], ), ), ( "timeout", Integer( title=_("Seconds before connection times out"), unit=_("sec"), default_value=10, ), ), ( "logname", TextInput(title=_("Username"), help=_("SSH user name on remote host"), size=30), ), ( "identity", TextInput(title=_("Keyfile"), help=_("Identity of an authorized key"), size=50), ), ( "accept_new_host_keys", FixedValue( value=True, title=_("Enable automatic host key acceptance"), help= _("This will automatically accept hitherto-unseen keys" "but will refuse connections for changed or invalid hostkeys" ), totext= _("Automatically stores the host key with no manual input requirement" ), ), ), ], ), ], )