_DEFAULT_DATADOG_AND_CHECKMK_STATES ], rows=len(_DEFAULT_DATADOG_AND_CHECKMK_STATES) + 2, size=50, ), ), ], title=_("Discovery of Datadog monitors"), optional_keys=False, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="datadog_monitors_discovery", valuespec=_valuespec_datadog_monitors_discovery, ), ) def _item_spec_datadog_monitors(): return TextInput( title=_("Datadog monitor"), help=_("The name of the Datadog monitor."), ) def _parameter_valuespec_datadog_monitors() -> Dictionary: return Dictionary(elements=[ ( "state_mapping",
), title=_("File Grouping Patterns"), help=_get_fileinfo_groups_help(), add_label=_("Add pattern group"), ), ), ], ), forth=_transform_fileinfo_groups, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersStorage, match_type="dict", name="fileinfo_groups", valuespec=_valuespec_fileinfo_groups, )) def _item_spec_fileinfo_groups(): return TextInput( title=_("File Group Name"), help= _("This name must match the name of the group defined " 'in the <a href="wato.py?mode=edit_ruleset&varname=fileinfo_groups">%s</a> ruleset.' ) % (_("File Grouping Patterns")), allow_empty=True, )
("single", "Discover one service for every peer"), ("both", "Discover both of the above"), ("neither", "Discover neither of the above"), ], title=_("Single peers or summary"), ), ) ], ) ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="merged", name="ntp_discovery", valuespec=_valuespec_ntp_rules, ) ) def _ntp_params(): return Tuple( title=_("Thresholds for quality of time"), elements=[ Integer( title=_("Critical at stratum"), default_value=10, help=_( 'The stratum ("distance" to the reference clock) at which the check gets critical.' ),
_("Delete all messages identified as being related to this " "check. This is disabled by default, which will make " "your mailbox grow when you do not clean it up on your own." ), ), ), ], ), forth=transform_check_mail_loop_params, ) rulespec_registry.register( HostRulespec( group=RulespecGroupActiveChecks, match_type="all", name="active_checks:mail_loop", valuespec=_valuespec_active_checks_mail_loop, )) def transform_check_mail_params(params): """Transforms rule sets from 2.0 and below format to current (2.1 and up) >>> transformed = transform_check_mail_params({ # v2.0.0 / IMAP ... 'service_description': 'SD', ... 'fetch': ('IMAP', { ... 'server': 'srv', ... 'ssl': (False, 143), ... 'auth': ('usr', ('password', 'pw')), ... }), ... 'connect_timeout': 12, ... 'forward': {'match_subject': 'test'},
from cmk.gui.i18n import _ from cmk.gui.plugins.wato.special_agents.common import RulespecGroupDatasourceProgramsHardware from cmk.gui.plugins.wato.utils import HostRulespec, rulespec_registry from cmk.gui.valuespec import Dictionary, Password, TextInput def _factory_default_special_agents_vnx_quotas(): # No default, do not use setting if no rule matches return watolib.Rulespec.FACTORY_DEFAULT_UNUSED def _valuespec_special_agents_vnx_quotas(): return Dictionary( title=_("VNX quotas and filesystems"), elements=[ ("user", TextInput(title=_("NAS DB user name"))), ("password", Password(title=_("Password"))), ("nas_db", TextInput(title=_("NAS DB path"))), ], optional_keys=[], ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_vnx_quotas(), group=RulespecGroupDatasourceProgramsHardware, name="special_agents:vnx_quotas", valuespec=_valuespec_special_agents_vnx_quotas, ))
), ), ( "remote_version", TextInput( title=_("Version of Server"), help=_( "Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)" ), ), ), ( "remote_protocol", TextInput( title=_("Protocol of Server"), help=_("Warn if protocol doesn't match expected protocol version (ex: 2.0)"), ), ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupIntegrateOtherServices, match_type="all", name="active_checks:ssh", valuespec=_valuespec_active_checks_ssh, ) )
choices=[ ("http", "HTTP"), ("https", "HTTPS"), ], ), ), ("use_piggyback", Checkbox(title=_("Use Piggyback"), label=_("Enable"))), ( "basicauth", Tuple( title=_("BasicAuth settings (optional)"), elements=[TextInput(title=_("Username")), Password(title=_("Password"))], ), ), ], optional_keys=["basicauth"], ), title=_("Apache ActiveMQ queues"), forth=_special_agents_activemq_transform_activemq, ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_activemq(), group=RulespecGroupDatasourceProgramsApps, name="special_agents:activemq", valuespec=_valuespec_special_agents_activemq, ) )
True, title=_("Create a summary service for all alert rules"), totext="", ), ), ], optional_keys=["summary_service"], default_keys=["summary_service"], ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="discovery_alertmanager", valuespec=_discovery_parameters_valuespec_alertmanager, title=lambda: _("Alertmanager discovery"), ) ) def valuespec_alert_remapping(): return ListOf( Dictionary( elements=[ ( "rule_names", ListOfStrings( title=_("Alert rule names"), help=_("A list of rule names as defined in Alertmanager."),
"patterns", ListOfStrings( title=_("File patterns"), size=80, help= _("<p>Here you can specify a list of filename patterns to be sent by the " "agent in the section <tt>fileinfo</tt>. UNC paths with globbing patterns " "are used here, e.g. <tt>\\\\hostname\\share name\\*\\foo\\*.log</tt>. " "Wildcards are not allowed in host or share names. " "Per default each found file will be monitored for size and age. " "By building groups you can alternatively monitor a collection " "of files as an entity and monitor the count, total size, the largest, " "smallest oldest or newest file. Note: if you specify more than one matching rule, then " "<b>all</b> matching rules will be used for defining pattern - not just the " " first one.</p>"), valuespec=TextInput(size=80), ), ), ], optional_keys=["hostname", "ip_address", "authentication"], title=_("SMB Share fileinfo"), ) rulespec_registry.register( HostRulespec( group=RulespecGroupDatasourceProgramsApps, name="special_agents:smb_share", valuespec=_valuespec_special_agents_smb_share, ))
"It doesn't however allow discovery of the device type relayed this way. " "To allow interpretation of the data you need to pick the device manually." ), label=_("Select device type"), choices=[ (None, _("None selected")), ("oxyreduct", _("Wagner OxyReduct")), ], default_value=None, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, name="ewon_discovery_rules", valuespec=_valuespec_ewon_discovery_rules, ) ) def _item_spec_ewon(): return TextInput( title=_("Item name"), help=_( "The item name. The meaning of this depends on the proxied device: " "- Wagner OxyReduct: Name of the room/protection zone" ), )
def _valuespec_discovery_netapp_api_ports_ignored(): return Dictionary( title=_("Netapp port discovery"), elements=[ ( "ignored_ports", ListChoice( title=_("Ignore port types during discovery"), help=_( "Specify which port types should not be discovered"), choices=[ ("physical", _("Physical")), ("vlan", _("Vlan")), ("trunk", _("Trunk")), ], ), ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="discovery_netapp_api_ports_ignored", valuespec=_valuespec_discovery_netapp_api_ports_ignored, ))
choices=[ ("http", "HTTP"), ("https", "HTTPS"), ], ), ), ] def _factory_default_special_agents_jolokia(): # No default, do not use setting if no rule matches return Rulespec.FACTORY_DEFAULT_UNUSED def _valuespec_special_agents_jolokia(): return Dictionary( title=_("Jolokia"), help=_("This rule allows querying the Jolokia web API."), elements=_special_agents_jolokia_mk_jolokia_elements(), ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_jolokia(), group=RulespecGroupDatasourceProgramsApps, name="special_agents:jolokia", valuespec=_valuespec_special_agents_jolokia, ) )
title=_("Partitions (XEN)"), totext= "Create a separate check for each partition (XEN)", ), ), ], default_keys=["summary"], ), forth=transform_diskstat, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, name="diskstat_inventory", valuespec=_valuespec_diskstat_inventory, )) def _item_spec_diskstat(): return TextInput( title=_("Device"), help= _("For a summarized throughput of all disks, specify <tt>SUMMARY</tt>, " "a per-disk IO is specified by the drive letter, a colon and a slash on Windows " "(e.g. <tt>C:/</tt>) or by the device name on Linux/UNIX (e.g. <tt>/dev/sda</tt>)." ), )
"The check will report CRITICAL when another holds the resource during later checks." ), ), ), ], help= _("This rule can be used to control the discovery for Heartbeat CRM checks." ), optional_keys=[], ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="inventory_heartbeat_crm_rules", valuespec=_valuespec_inventory_heartbeat_crm_rules, )) def _heartbeat_crm_transform_heartbeat_crm(params): if isinstance(params, dict): _params = params.copy() _params.setdefault("show_failed_actions", False) return _params par_dict = {"max_age": params[0], "show_failed_actions": False} if params[1]: par_dict["dc"] = params[1] if params[2] > -1: par_dict["num_nodes"] = params[2] if params[3] > -1:
minvalue=1, default_value=60, ), Dictionary( title=_("Optional parameters"), elements=[ ( "num_per_contact", Tuple( title=_("Thresholds for Notifications per Contact"), elements=[ Integer(title=_("Warning if above"), default_value=20), Integer(title=_("Critical if above"), default_value=50), ], ), ), ], ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupIntegrateOtherServices, match_type="all", name="active_checks:notify_count", valuespec=_valuespec_active_checks_notify_count, ) )
"must match at least one description condition, one name condition and one state " "condition, if configured. To simply discover all systemd services, do not " "configure any restrictions. Note that independently of this ruleset, some systemd " "service units which are used by the Checkmk agent ('check-mk-agent@...') will " "never be discovered because they appear and disappear frequently." ), empty_text=_("No restrictions (discover all systemd service units)"), ), forth=_discovery_forth, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="all", name="discovery_systemd_units_services_rules", valuespec=_valuespec_discovery_systemd_units_services_rules, ) ) def _parameter_valuespec_systemd_services(): return Dictionary( elements=[ ( "states", Dictionary( title=_("Map systemd states to monitoring states"), elements=[ ( "active",
help=_( "Regardless of filesystem type, these mountpoints will always be discovered." "Regular expressions are supported."), ), ), ], validate=_validate_discovery_filesystem_params, ), forth=_transform_discovery_filesystem_params, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="inventory_df_rules", valuespec=_valuespec_inventory_df_rules, )) FILESYSTEM_GROUPS_WRAPPER_KEY = "groups" def _transform_filesystem_groups( params: Union[Sequence[Tuple], Sequence[Mapping[str, Any]], Dict[str, Any]] ) -> Dict[str, Any]: """ Old format: [(group_name, include_pattern), (group_name, include_pattern), ...] OR
Integer( title=_("Port"), default_value=8091, help=_("The port that is used for the api call."), ), ), ( "authentication", Tuple( title=_("Authentication"), help=_( "The credentials for api calls with authentication."), elements=[ TextInput(title=_("Username"), allow_empty=False), PasswordFromStore(title=_("Password of the user"), allow_empty=False), ], ), ), ], ) rulespec_registry.register( HostRulespec( factory_default=Rulespec.FACTORY_DEFAULT_UNUSED, group=RulespecGroupDatasourceProgramsApps, name="special_agents:couchbase", valuespec=_valuespec_special_agents_couchbase, ))
def _discovery_valuespec_snapvault(): return Dictionary( elements=[ ( "exclude_destination_vserver", Checkbox( title=_("Exclude destination vserver"), help= _("Only applicable to clustermode installations. " "The service description of snapvault services is composed of the " "destination vserver (SVM) and the destination volume by default. Check " "this box if you would like to use the destination volume as the " "service description on its own. " "Please be advised that this may lead to a service description that is " "not unique, resulting in some services, which are not shown!" ), ), ), ], title=_("NetApp snapvault discovery"), ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="list", name="discovery_snapvault", valuespec=_discovery_valuespec_snapvault, ))
from cmk.gui.plugins.wato.utils import HostRulespec, rulespec_registry from cmk.gui.valuespec import Dictionary, ListOfStrings def _valuespec_special_agents_salesforce(): return Dictionary( title=_("Salesforce"), help=_("This rule selects the special agent for Salesforce."), elements=[ ( "instances", ListOfStrings( title=_("Instances"), allow_empty=False, ), ), ], optional_keys=[], ) rulespec_registry.register( HostRulespec( group=RulespecGroupDatasourceProgramsApps, help_func=lambda: _( "This rule selects the special agent for Salesforce."), name="special_agents:salesforce", title=lambda: _("Salesforce"), valuespec=_valuespec_special_agents_salesforce, ))
return Dictionary( title=_("HPE StoreOnce"), help= _("This rule set selects the special agent for HPE StoreOnce Applainces " "instead of the normal Check_MK agent and allows monitoring via Web API. " ), optional_keys=["cert"], elements=[ ("user", TextInput(title=_("Username"), allow_empty=False)), ("password", Password(title=_("Password"), allow_empty=False)), ( "cert", DropdownChoice( title=_("SSL certificate verification"), choices=[ (True, _("Activate")), (False, _("Deactivate")), ], ), ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupDatasourceProgramsHardware, name="special_agents:storeonce", valuespec=_valuespec_special_agents_storeonce, ))
choices=[ ("license_state", _("Licence state")), ("license_usage", _("Licence usage")), ("system_msg", _("System messages")), ("jobs", _("Jobs")), ("health", _("Health")), ("alerts", _("Alerts")), ], default_value=[ "license_state", "license_usage", "system_msg", "jobs", "health", "alerts", ], allow_empty=False, ), ), ], ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_splunk(), group=RulespecGroupDatasourceProgramsApps, name="special_agents:splunk", valuespec=_valuespec_special_agents_splunk, ))
help=_( "This rule selects the Fritz!Box agent, which uses UPNP to gather information " "about configuration and connection status information."), elements=[ ( "timeout", Integer( title=_("Connect Timeout"), help= _("The network timeout in seconds when communicating via UPNP. " "The default is 10 seconds. Please note that this " "is not a total timeout, instead it is applied to each API call." ), default_value=10, minvalue=1, unit=_("seconds"), ), ), ], optional_keys=["timeout"], ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_fritzbox(), group=RulespecGroupDatasourceProgramsHardware, name="special_agents:fritzbox", valuespec=_valuespec_special_agents_fritzbox, ))
help= _("By default, Checkmk does not import annotations. If " "this option is enabled, Checkmk will import any " "annotation that is a valid Kubernetes label. These " "imported annotations are added as host labels to their " "respective piggyback host using the syntax " "'cmk/kubernetes/annotation/{key}:{value}'. You can " "further restrict the imported annotations by specifying " "a pattern which Checkmk searches for in the key of the " "annotation."), ), ), ], optional_keys=[ "namespaces", "cluster-collector", "cluster-resource-aggregation", "import-annotations", ], default_keys=["cluster-collector"], title=_("Kubernetes"), ) rulespec_registry.register( HostRulespec( group=RulespecGroupVMCloudContainer, name="special_agents:kube", valuespec=_valuespec_special_agents_kube, ))
"By defining grouping patterns you can switch to the check <tt>logwatch.groups</tt>. " "If the pattern begins with a tilde then this pattern is interpreted as a regular " "expression instead of as a filename globbing pattern and <tt>*</tt> and <tt>?</tt> " "are treated differently. " "That check monitors a list of logfiles at once. This is useful if you have " "e.g. a folder with rotated logfiles where the name of the current logfile" "also changes with each rotation"), ), forth=lambda p: p if isinstance(p, dict) else {"grouping_patterns": p}, ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersApplications, match_type="all", name="logwatch_groups", valuespec=_valuespec_logwatch_groups, )) def _parameter_valuespec_logwatch_ec(): return Alternative( title=_("Forwarding"), help= _("Instead of using the regular logwatch check all lines received by logwatch can " "be forwarded to a Check_MK event console daemon to be processed. The target event " "console can be configured for each host in a separate rule."), elements=[ FixedValue( "", totext=_("Messages are handled by logwatch."),
"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, ) rulespec_registry.register( HostRulespec( group=RulespecGroupVMCloudContainer, name="special_agents:kubernetes", valuespec=_valuespec_special_agents_kubernetes, is_deprecated=True, ))
def _valuespec_discovery_cmciii(): return Dictionary( title=_("Rittal CMC III discovery"), elements=[ ( "use_sensor_description", DropdownChoice( title=_("Service description"), help= _("Since the sensor description is a user defined text, multiple sensors " "may have the same description. To ensure that items are unique, they " "are prefixed with X-Y where X is the device number and Y the index " "of the sensor."), choices=[ (False, _("Use device and sensor name")), (True, _("Use sensor description")), ], ), ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="discovery_cmciii", valuespec=_valuespec_discovery_cmciii, ))
return Dictionary( title=_("ALLNET IP Sensoric Devices"), help=_("This rule selects the ALLNET IP Sensoric agent, which fetches " "/xml/sensordata.xml from the device by HTTP and extracts the " "needed monitoring information from this file."), elements=[ ( "timeout", Integer( title=_("Connect Timeout"), help=_( "The network timeout in seconds when communicating via HTTP. " "The default is 10 seconds."), default_value=10, minvalue=1, unit=_("seconds"), ), ), ], optional_keys=["timeout"], ) rulespec_registry.register( HostRulespec( factory_default=_factory_default_special_agents_allnet_ip_sensoric(), group=RulespecGroupDatasourceProgramsHardware, name="special_agents:allnet_ip_sensoric", valuespec=_valuespec_special_agents_allnet_ip_sensoric, ))
def _valuespec_ping_levels(): return Dictionary( title=_("PING and host check parameters"), help= _("This rule sets the parameters for the host checks (via <tt>check_icmp</tt>) " "and also for PING checks on ping-only-hosts. For the host checks only the " "critical state is relevant, the warning levels are ignored."), elements=check_icmp_params(), ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersNetworking, match_type="dict", name="ping_levels", valuespec=_valuespec_ping_levels, )) # . # .--Inventory-----------------------------------------------------------. # | ___ _ | # | |_ _|_ ____ _____ _ __ | |_ ___ _ __ _ _ | # | | || '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | | | # | | || | | \ V / __/ | | | || (_) | | | |_| | | # | |___|_| |_|\_/ \___|_| |_|\__\___/|_| \__, | | # | |___/ | # '----------------------------------------------------------------------' def _valuespec_inventory_sap_values():
def _valuespec_discovery_netapp_api_fan_rules(): return Dictionary( title=_("Netapp fan discovery"), elements=[ ( "mode", CascadingDropdown( title=_("Specify discovery mode"), help= _("Option which allows to specify whether all fan units will be grouped into one service (summary) or each unit gets allocated to one individual service (single)." ), orientation="vertical", choices=[ ("summarize", _("Summary")), ("single", _("Single")), ], ), ), ], ) rulespec_registry.register( HostRulespec( group=RulespecGroupCheckParametersDiscovery, match_type="dict", name="discovery_netapp_api_fan_rules", valuespec=_valuespec_discovery_netapp_api_fan_rules, ))