def _item_spec_tcp_connections(): return TextInput( title=_("Connection name"), help=_("Specify an arbitrary name of this connection here"), allow_empty=False, )
def _item_spec_raid_disk(): return TextInput( title=_("Number or ID of the disk"), help=_("How the disks are named depends on the type of hardware being " "used. Please look at already discovered checks for examples."), )
(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, ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="windows_printer_queues", group=RulespecGroupCheckParametersPrinters, item_spec=lambda: TextInput(title=_("Printer Name"), allow_empty=True), parameter_valuespec=_parameter_valuespec_windows_printer_queues, title=lambda: _("Windows printers: number of open jobs"), ) )
) def _parameter_valuespec_enterasys_powersupply(): return Dictionary( elements=[ ("redundancy_ok_states", ListChoice( title=_("States treated as OK"), choices=[ (1, 'redundant'), (2, 'notRedundant'), (3, 'notSupported'), ], default_value=[1], )), ], optional_keys=False, ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="enterasys_powersupply", group=RulespecGroupCheckParametersNetworking, item_spec=lambda: TextInput(title=_("Number of Powersupply"), ), match_type="dict", parameter_valuespec=_parameter_valuespec_enterasys_powersupply, title=lambda: _("Enterasys Power Supply Settings"), ))
elements=[ Float(title="warn", ), Float(title="crit", ), ], ), ), ], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="couchbase_ops", group=RulespecGroupCheckParametersApplications, match_type="dict", item_spec=lambda: TextInput(title=_("Node or bucket name")), parameter_valuespec=_parameter_valuespec_couchbase_operations, title=lambda: _("Couchbase Operations"), )) rulespec_registry.register( CheckParameterRulespecWithoutItem( check_group_name="couchbase_ops_nodes", group=RulespecGroupCheckParametersApplications, match_type="dict", parameter_valuespec=_parameter_valuespec_couchbase_operations, title=lambda: _("Couchbase Total Node Operations"), )) rulespec_registry.register( CheckParameterRulespecWithoutItem(
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, ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="temperature", group=RulespecGroupCheckParametersEnvironment, item_spec=lambda: TextInput( title=_("Sensor ID"), help=_("The identifier of the thermal sensor.")), match_type="dict", parameter_valuespec=_parameter_valuespec_temperature, title=lambda: _("Temperature"), ))
( "levels", Tuple( title=_("Levels for used configured reserve"), elements=[ Percentage(title=_("Warning at or above"), unit="%", default_value=85.0), Percentage(title=_("Critical at or above"), unit="%", default_value=90.0), ], ), ), ( "state_noreserve", MonitoringState(title=_("State if no reserve is configured"), ), ), ], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="netapp_snapshots", group=RulespecGroupCheckParametersStorage, item_spec=lambda: TextInput(title=_("Volume name")), match_type="dict", parameter_valuespec=_parameter_valuespec_netapp_snapshots, title=lambda: _("NetApp Snapshot Reserve"), ))
def _item_spec_sap_hana_license(): return TextInput(title=_("The instance name"))
def _parameter_valuespec_uptime(): return Dictionary(elements=[ ("min", Tuple( title=_("Minimum required uptime"), elements=[ Age(title=_("Warning if below")), Age(title=_("Critical if below")), ], )), ("max", Tuple( title=_("Maximum allowed uptime"), elements=[ Age(title=_("Warning at")), Age(title=_("Critical at")), ], )), ],) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="uptime_multiitem", group=RulespecGroupCheckParametersOperatingSystem, item_spec=lambda: TextInput(title=_("Module name"), allow_empty=False), match_type="dict", parameter_valuespec=_parameter_valuespec_uptime, title=lambda: _("Uptime since last reboot of devices with modules"), ))
Tuple(elements=[ Percentage(title=_("Warning at a memory usage of"), default_value=80.0, maxvalue=None), Percentage(title=_("Critical at a memory usage of"), default_value=90.0, maxvalue=None) ], )), ("abs_free", _("Absolute levels for free memory"), Tuple(elements=[ Filesize(title=_("Warning below")), Filesize(title=_("Critical below")) ], )), ("ignore", _("Do not impose levels")), ], )), ], optional_keys=[], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="sap_hana_memory", group=RulespecGroupCheckParametersApplications, item_spec=lambda: TextInput(title=_("The instance name")), match_type="dict", parameter_valuespec=_parameter_valuespec_sap_hana_memory, title=lambda: _("SAP HANA Memory"), ))
def _item_spec_sap_hana_backup(): return TextInput(title=_("The instance name and backup type"))
def valuespec(self) -> ValueSpec: return TextInput(title="title")
maxvalue=None, ), ], ), Tuple( title=_("Specify levels in absolute usage values"), elements=[ Integer(title=_("Warning at"), unit=_("MB")), Integer(title=_("Critical at"), unit=_("MB")), ], ), ], ), ), ] return Transform( Dictionary(elements=elements + size_trend_elements), forth=_transform_wrapper, ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="cisco_mem", group=RulespecGroupCheckParametersOperatingSystem, item_spec=lambda: TextInput(title=_("Memory Pool Name"), allow_empty=False), parameter_valuespec=_parameter_valuespec_cisco_mem, title=lambda: _("Cisco Memory Usage"), ))
from cmk.gui.i18n import _ from cmk.gui.plugins.wato import ( CheckParameterRulespecWithItem, ManualCheckParameterRulespec, rulespec_registry, RulespecGroupCheckParametersApplications, RulespecGroupEnforcedServicesApplications, ) from cmk.gui.valuespec import Dictionary, DropdownChoice, TextInput, Transform rulespec_registry.register( ManualCheckParameterRulespec( check_group_name="local", group=RulespecGroupEnforcedServicesApplications, item_spec=lambda: TextInput(title=_("Name of local item")), parameter_valuespec=lambda: Transform(Dictionary(elements=[]), forth=lambda p: {}), title=lambda: _("Local checks"), )) # We only need the above, there are no "true" parameters to this check plugin. def _deprecation_message() -> str: return _('This ruleset is deprecated. Please use the ruleset <i>"%s"</i> instead.') % _( "Aggregation options for clustered services") def _parameter_valuespec_local(): return Dictionary(elements=[ ("outcome_on_cluster",
"If you happen to define the same exit code multiple times the first entry will be used." ), allow_empty=False, ), ), ( "outcome_on_cluster", DropdownChoice( title="%s - %s" % ( _("Clusters: Preferred check result of local checks"), _deprecation_message(), ), choices=[], deprecated_choices=("worst", "best"), invalid_choice_title=_( 'Old setting: "%s". Choose that in the new ruleset.'), ), ), ], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="job", group=RulespecGroupCheckParametersApplications, item_spec=lambda: TextInput(title=_("Job name"), ), match_type="dict", parameter_valuespec=_parameter_valuespec_job, title=lambda: _("mk-job job age"), ))
def _item_spec_cooling_cap(): return TextInput( title=_("Cooling device"), help=_("This name corresponds to the cooling device to be monitored."), allow_empty=True)
help=_( "Here you can specify levels for different policies which overrule the levels " "from the <i>Default levels</i> parameter. This setting only works in NetApp Clustermode setups." ), allow_empty=False, ), ), ], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="snapvault", group=RulespecGroupCheckParametersStorage, item_spec=lambda: TextInput(title=_("Source Path"), allow_empty=False), match_type="dict", parameter_valuespec=_parameter_valuespec_snapvault, title=lambda: _("NetApp Snapvaults / Snapmirror Lag Time"), ) ) def _discovery_valuespec_snapvault(): return Dictionary( elements=[ ( "exclude_destination_vserver", Checkbox( title=_("Exclude destination vserver"), help=_(
def _valuespec_special_agents_kubernetes(): return Transform( valuespec=Dictionary( elements=[ ( "api-server-endpoint", CascadingDropdown( choices=[ ( "hostname", _("Hostname"), Dictionary( elements=_kubernetes_connection_elements( )), ), ( "ipaddress", _("IP address"), Dictionary( elements=_kubernetes_connection_elements( )), ), ( "url_custom", _("Custom URL"), TextInput( allow_empty=False, size=80, ), ), ], orientation="horizontal", title=_("API server endpoint"), help= _('The URL that will be contacted for Kubernetes API calls. If the "Hostname" ' 'or the "IP Address" options are selected, the DNS hostname or IP address and ' "a secure protocol (HTTPS) are used."), ), ), ( "token", IndividualOrStoredPassword( title=_("Token"), allow_empty=False, ), ), ( "no-cert-check", Alternative( title=_("SSL certificate verification"), elements=[ FixedValue(value=False, title=_("Verify the certificate"), totext=""), FixedValue( value=True, title=_( "Ignore certificate errors (unsecure)"), totext="", ), ], default_value=False, ), ), ( "namespaces", Alternative( title=_("Namespace prefix for hosts"), elements=[ FixedValue(value=False, title=_("Don't use a namespace prefix"), totext=""), FixedValue(value=True, title=_("Use a namespace prefix"), totext=""), ], help= _("If a cluster uses multiple namespaces you need to activate this option. " "Hosts for namespaced Kubernetes objects will then be prefixed with the " "name of their namespace. This makes Kubernetes resources in different " "namespaces that have the same name distinguishable, but results in " "longer hostnames."), default_value=False, ), ), ( "infos", ListChoice( choices=[ ("nodes", _("Nodes")), ("services", _("Services")), ("ingresses", _("Ingresses")), ("deployments", _("Deployments")), ("pods", _("Pods")), ("endpoints", _("Endpoints")), ("daemon_sets", _("Daemon sets")), ("stateful_sets", _("Stateful sets")), ("jobs", _("Job")), ], default_value=[ "nodes", "endpoints", "ingresses", ], allow_empty=False, title=_("Retrieve information about..."), ), ), filter_kubernetes_namespace_element(), ], optional_keys=[ "port", "url-prefix", "path-prefix", "namespace_include_patterns" ], title=_("Kubernetes (deprecated)"), help=_( "This special agent is deprecated and will be removed in " 'Checkmk version 2.2.0. Please use the "Kubernetes" ruleset to ' "configure the new special agent for Kubernetes."), ), forth=special_agents_kubernetes_transform, )
def _item_spec_msx_queues(): return TextInput( title=_("Explicit Queue Names"), help=_("Specify queue names that the rule should apply to"), )
def _item_spec_adva_ifs(): return TextInput( title=_("Interface"), allow_empty=False, )
def _item_spec_netapp_systemtime(): return TextInput( title=_("Name of the node"), allow_empty=False, )
rulespec_registry, RulespecGroupCheckParametersEnvironment, ) from cmk.gui.valuespec import Dictionary, Percentage, TextInput, Tuple def _parameter_valuespec_hw_psu(): return Dictionary(elements=[ ( "levels", Tuple( title=_("PSU Capacity Levels"), elements=[ Percentage(title=_("Warning at"), default_value=80.0), Percentage(title=_("Critical at"), default_value=90.0), ], ), ), ], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="hw_psu", group=RulespecGroupCheckParametersEnvironment, item_spec=lambda: TextInput(title=_("PSU (Chassis/Bay)")), match_type="dict", parameter_valuespec=_parameter_valuespec_hw_psu, title=lambda: _("Power Supply Unit"), ))
def _item_spec_acme_certificates(): return TextInput( title=_("Name of certificate"), allow_empty=False, )
from cmk.gui.valuespec import Dictionary, Percentage, TextInput, Tuple def _parameter_valuespec_printer_input(): return Dictionary( elements=[ ( "capacity_levels", Tuple( title=_("Capacity remaining"), elements=[ Percentage(title=_("Warning at"), default_value=0.0), Percentage(title=_("Critical at"), default_value=0.0), ], ), ), ], default_keys=["capacity_levels"], ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="printer_input", group=RulespecGroupCheckParametersPrinters, item_spec=lambda: TextInput(title=_("Unit Name"), allow_empty=True), match_type="dict", parameter_valuespec=_parameter_valuespec_printer_input, title=lambda: _("Printer Input Units"), ))
def _vs_mandatory_elements(self) -> list[DictionaryEntry]: ident_attr: List = [] if self._new: ident_attr = [ ( "ident", ID( title=_("Unique ID"), help=_( "The ID must be a unique text. It will be used as an internal key " "when objects refer to this object."), default_value=self._default_id, allow_empty=False, size=80, ), ), ] else: ident_attr = [ ( "ident", FixedValue( value=self._ident, title=_("Unique ID"), ), ), ] if self._mode_type.is_site_specific(): site_attr = [ ("site", self._mode_type.site_valuespec()), ] else: site_attr = [] if self._mode_type.can_be_disabled(): disable_attr = [ ( "disabled", Checkbox( title=_("Activation"), help= _("Disabled %s are kept in the configuration but are not active." ) % self._mode_type.name_singular(), label=_("do not activate this %s") % self._mode_type.name_singular(), ), ), ] else: disable_attr = [] elements = (ident_attr + [ ( "title", TextInput( title=_("Title"), help=_( "The title of the %s. It will be used as display name." ) % (self._mode_type.name_singular()), allow_empty=False, size=80, ), ), ("comment", RuleComment()), ("docu_url", DocumentationURL()), ] + disable_attr + site_attr) return elements
def _item_spec_jvm_memory() -> TextInput: return TextInput( title=_("Name of the virtual machine"), help=_("The name of the application server"), allow_empty=False, )
def _valuespec_special_agents_azure(): return Dictionary( title=_("Microsoft Azure"), help= _("To monitor Azure resources add this datasource to <b>one</b> host. " "The data will be transported using the piggyback mechanism, so make " "sure to create one host for every monitored resource group. You can " "learn about the discovered groups in the <i>Azure Agent Info</i> " "service of the host owning the datasource program."), # element names starting with "--" will be passed do cmd line w/o parsing! elements=[ ( "subscription", TextInput( title=_("Subscription ID"), allow_empty=False, size=45, ), ), ( "tenant", TextInput( title=_("Tenant ID / Directory ID"), allow_empty=False, size=45, ), ), ( "client", TextInput( title=_("Client ID / Application ID"), allow_empty=False, size=45, ), ), ( "secret", Password( title=_("Client Secret"), allow_empty=False, size=45, ), ), ( "config", Dictionary( title=_("Retrieve information about..."), # Since we introduced this, Microsoft has already reduced the number # of allowed API requests. At the time of this writing (11/2018) # you can find the number here: # https://docs.microsoft.com/de-de/azure/azure-resource-manager/resource-manager-request-limits help= _("By default, all resources associated to the configured tenant ID" " will be monitored.") + " " + _("However, since Microsoft limits API calls to %s per hour" " (%s per minute), you can restrict the monitoring to individual" " resource groups and resources.") % ("12000", "200"), elements=[ ("explicit", _special_agents_azure_azure_explicit_config()), ("tag_based", _special_agents_azure_azure_tag_based_config()), ], ), ), ( "piggyback_vms", DropdownChoice( title=_("Map data relating to VMs"), help= _("By default, data relating to a VM is sent to the group host" " corresponding to the resource group of the VM, the same way" " as for any other resource. If the VM is present in your " " monitoring as a separate host, you can choose to send the data" " to the VM itself."), choices=[ ("grouphost", _("Map data to group host")), ("self", _("Map data to the VM itself")), ], ), ), ( "sequential", DropdownChoice( title=_("Force agent to run in single thread"), help=_("Check this to turn off multiprocessing." " Recommended for debugging purposes only."), choices=[ (False, _("Run agent multithreaded")), (True, _("Run agent in single thread")), ], ), ), ], optional_keys=["subscription", "piggyback_vms", "sequential"], )
def dashlet_vs_general_settings(dashlet_type: Type[Dashlet], single_infos: List[str]): return Dictionary( title=_("General Settings"), render="form", optional_keys=["title", "title_url"], elements=[ ( "type", FixedValue( dashlet_type.type_name(), totext=dashlet_type.title(), title=_("Element type"), ), ), visuals.single_infos_spec(single_infos), ( "background", Checkbox( title=_("Colored background"), label=_("Render background"), help= _("Render gray background color behind the elements content." ), default_value=True, ), ), ( "show_title", DropdownChoice( title=_("Show title header"), help= _("Render the titlebar including title and link above the element." ), choices=[ (False, _("Don't show any header")), (True, _("Show header with highlighted background")), ("transparent", _("Show title without any background")), ], default_value=True, ), ), ( "title", TextInput( title=_("Custom title") + "<sup>*</sup>", placeholder=_( "This option is macro-capable, please check the inline help for more " "information."), help=" ".join(( _("Most elements have a hard coded static title and some are aware of their " "content and set the title dynamically, like the view snapin, which " "displays the title of the view. If you like to use any other title, set it " "here."), _title_help_text_for_macros(dashlet_type), )), size=75, ), ), ( "title_url", TextInput( title=_("Link of Title"), help= _("The URL of the target page the link of the element should link to." ), size=50, ), ), ], )
"are applied on the number of used processes in percentage of the configured limit." ), elements=[ ( "levels", Tuple( title=_("Levels for used processes"), elements=[ Percentage(title=_("Warning if more than"), default_value=70.0), Percentage(title=_("Critical if more than"), default_value=90.0), ], ), ), ], optional_keys=False, ) rulespec_registry.register( CheckParameterRulespecWithItem( check_group_name="oracle_processes", group=RulespecGroupCheckParametersApplications, item_spec=lambda: TextInput( title=_("Database SID"), size=12, allow_empty=False), match_type="dict", parameter_valuespec=_parameter_valuespec_oracle_processes, title=lambda: _("Oracle Processes"), ))
def parameters(cls, mode): def bookmark_config_to_vs(v): if v: return (v["title"], v["url"], v["icon"], v["topic"]) return v def bookmark_vs_to_config(v): return { "title": v[0], "url": v[1], "icon": v[2], "topic": v[3], } parameters = super().parameters(mode) parameters += [( _("Bookmarks"), [ # sort-index, key, valuespec ( 2.5, "default_topic", TextInput( title=_("Default Topic") + "<sup>*</sup>", size=50, allow_empty=False, ), ), ( 3.0, "bookmarks", ListOf( # For the editor we want a compact dialog. The tuple horizontal editin mechanism # is exactly the thing we want. But we want to store the data as dict. This is a # nasty hack to use the transform by default. Better would be to make Dict render # the same way the tuple is rendered. valuespec=Transform( valuespec=Tuple( elements=[ (TextInput( title=_("Title") + "<sup>*</sup>", size=30, allow_empty=False, )), (TextInput( title=_("URL"), size=50, allow_empty=False, validate=cls.validate_url, )), (IconSelector(title=_("Icon"), with_emblem=False)), (cls._vs_topic()), ], orientation="horizontal", title=_("Bookmarks"), ), forth=bookmark_config_to_vs, back=bookmark_vs_to_config, )), ), ], )] return parameters