2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
31 import cmk
.utils
.paths
34 import cmk
.gui
.sites
as sites
35 import cmk
.gui
.config
as config
36 import cmk
.gui
.watolib
as watolib
37 import cmk
.gui
.userdb
as userdb
38 import cmk
.gui
.utils
as utils
39 from cmk
.gui
.exceptions
import MKUserError
40 from cmk
.gui
.i18n
import _
42 from cmk
.gui
.valuespec
import (
72 from cmk
.gui
.plugins
.wato
import (
73 config_variable_group_registry
,
75 config_variable_registry
,
79 ConfigDomainCACertificates
,
85 BinaryServiceRulespec
,
86 rulespec_group_registry
,
94 ServiceDescriptionTranslation
,
95 ContactGroupSelection
,
97 ServiceGroupSelection
,
103 from cmk
.gui
.plugins
.wato
.omd_configuration
import ConfigVariableGroupSiteManagement
104 from cmk
.gui
.plugins
.views
.icons
import icon_and_action_registry
105 from cmk
.gui
.watolib
.bulk_discovery
import vs_bulk_discovery
106 from cmk
.gui
.watolib
.groups
import load_contact_group_information
108 # .--Global Settings-----------------------------------------------------.
109 # | ____ _ _ _ ____ _ _ _ |
110 # | / ___| | ___ | |__ __ _| | / ___| ___| |_| |_(_)_ __ __ _ ___ |
111 # || | _| |/ _ \| '_ \ / _` | | \___ \ / _ \ __| __| | '_ \ / _` / __| |
112 # || |_| | | (_) | |_) | (_| | | ___) | __/ |_| |_| | | | | (_| \__ \ |
113 # | \____|_|\___/|_.__/ \__,_|_| |____/ \___|\__|\__|_|_| |_|\__, |___/ |
115 # +----------------------------------------------------------------------+
116 # | Global configuration settings for main.mk and multisite.mk |
117 # '----------------------------------------------------------------------'
120 @config_variable_group_registry.register
121 class ConfigVariableGroupUserInterface(ConfigVariableGroup
):
123 return _("User Interface")
125 def sort_index(self
):
129 @config_variable_registry.register
130 class ConfigVariableUITheme(ConfigVariable
):
132 return ConfigVariableGroupUserInterface
135 return ConfigDomainGUI
141 return DropdownChoice(
142 title
=_("User interface theme"),
143 help=_("Change the default user interface theme of your Check_MK installation"),
144 choices
=config
.theme_choices(),
148 @config_variable_registry.register
149 class ConfigVariableBulkDiscoveryDefaultSettings(ConfigVariable
):
151 return ConfigVariableGroupUserInterface
154 return ConfigDomainGUI
157 return "bulk_discovery_default_settings"
160 return vs_bulk_discovery()
163 @config_variable_registry.register
164 class ConfigVariableLogLevels(ConfigVariable
):
166 return ConfigVariableGroupUserInterface
169 return ConfigDomainGUI
177 help=_("This setting decides which types of messages to log into "
178 "the web log <tt>%s</tt>.") %
179 site_neutral_path(cmk
.utils
.paths
.log_dir
+ "/web.log"),
180 elements
=self
._web
_log
_level
_elements
(),
184 def _web_log_level_elements(self
):
186 for level_id
, title
, help_text
in [
187 ("cmk.web", _("Web"),
188 _("The log level for all log entries not assigned to the other "
189 "log categories on this page.")),
190 ("cmk.web.auth", _("Authentication"),
191 _("The log level for user authentication related log entries.")),
192 ("cmk.web.ldap", _("LDAP"), _("The log level for LDAP related log entries.")),
193 ("cmk.web.bi.compilation", _("BI compilation"),
194 _("If this option is enabled, Check_MK BI will create a log with details "
195 "about compiling BI aggregations. This includes statistics and "
196 "details for each executed compilation.")),
197 ("cmk.web.automations", _("Automation calls"),
198 _("Communication between different components of Check_MK (e.g. GUI and check engine) "
199 "will be logged in this log level."))
201 elements
.append((level_id
,
205 default_value
=logging
.WARNING
,
211 @config_variable_registry.register
212 class ConfigVariableDebug(ConfigVariable
):
214 return ConfigVariableGroupUserInterface
217 return ConfigDomainGUI
224 title
=_("Debug mode"),
225 label
=_("enable debug mode"),
226 help=_("When Multisite is running in debug mode, internal Python error messages "
227 "are being displayed and various debug information in other places is "
232 @config_variable_registry.register
233 class ConfigVariableGUIProfile(ConfigVariable
):
235 return ConfigVariableGroupUserInterface
238 return ConfigDomainGUI
244 return DropdownChoice(
245 title
=_("Profile requests"),
246 help=_("It is possible to profile the rendering process of Multisite pages. This "
247 "Is done using the Python module cProfile. When profiling is performed "
248 "two files are created <tt>%s</tt> and <tt>%s</tt>. By executing the later "
249 "file you can get runtime statistics about the last processed page. When "
250 "enabled by request the profiling mode is enabled by providing the HTTP "
251 "variable <tt>_profile</tt>.") %
252 (site_neutral_path(cmk
.utils
.paths
.var_dir
+ "/multisite.profile"),
253 site_neutral_path(cmk
.utils
.paths
.var_dir
+ "/multisite.profile.py")),
255 (False, _("Disable profiling")),
256 ("enable_by_var", _("Enable profiling by request")),
257 (True, _("Enable profiling for all requests")),
262 @config_variable_registry.register
263 class ConfigVariableDebugLivestatusQueries(ConfigVariable
):
265 return ConfigVariableGroupUserInterface
268 return ConfigDomainGUI
271 return "debug_livestatus_queries"
275 title
=_("Debug Livestatus queries"),
276 label
=_("enable debug of Livestatus queries"),
277 help=_("With this option turned on all Livestatus queries made by Multisite "
278 "in order to render views are being displayed."),
282 @config_variable_registry.register
283 class ConfigVariableSelectionLivetime(ConfigVariable
):
285 return ConfigVariableGroupUserInterface
288 return ConfigDomainGUI
291 return "selection_livetime"
295 title
=_('Checkbox Selection Livetime'),
297 _('This option defines the maximum age of unmodified checkbox selections stored for users. '
298 'If a user modifies the selection in a view, these selections are persisted for the currently '
299 'open view. When a view is re-opened a new selection is used. The old one remains on the '
300 'server until the livetime is exceeded.'),
305 @config_variable_registry.register
306 class ConfigVariableShowLivestatusErrors(ConfigVariable
):
308 return ConfigVariableGroupUserInterface
311 return ConfigDomainGUI
314 return "show_livestatus_errors"
318 title
=_("Show MK Livestatus error messages"),
319 label
=_("show errors"),
321 _("This option controls whether error messages from unreachable sites are shown in the output of "
322 "views. Those error messages shall alert you that not all data from all sites has been shown. "
323 "Other people - however - find those messages distracting. "),
327 @config_variable_registry.register
328 class ConfigVariableEnableSounds(ConfigVariable
):
330 return ConfigVariableGroupUserInterface
333 return ConfigDomainGUI
336 return "enable_sounds"
340 title
=_("Enable sounds in views"),
341 label
=_("enable sounds"),
342 help=_("If sounds are enabled then the user will be alarmed by problems shown "
343 "in a Multisite status view if that view has been configured for sounds. "
344 "From the views shipped in with Multisite all problem views have sounds "
349 @config_variable_registry.register
350 class ConfigVariableContextButtonsToShow(ConfigVariable
):
352 return ConfigVariableGroupUserInterface
355 return ConfigDomainGUI
358 return "context_buttons_to_show"
369 title
=_("Number of context buttons to show"),
370 label
=_("Show only most frequently used buttons"),
371 help=_("If this option is enabled, then Multisite only show the most "
372 "used context buttons and hides the rest. Which buttons are used "
373 "how often is computed separately per user."),
377 @config_variable_registry.register
378 class ConfigVariableSoftQueryLimit(ConfigVariable
):
380 return ConfigVariableGroupUserInterface
383 return ConfigDomainGUI
386 return "soft_query_limit"
390 title
=_("Soft query limit"),
391 help=_("Whenever the number of returned datasets of a view would exceed this "
392 "limit, a warning is being displayed and no further data is being shown. "
393 "A normal user can override this limit with one mouse click."),
398 @config_variable_registry.register
399 class ConfigVariableHardQueryLimit(ConfigVariable
):
401 return ConfigVariableGroupUserInterface
404 return ConfigDomainGUI
407 return "hard_query_limit"
411 title
=_("Hard query limit"),
412 help=_("Whenever the number of returned datasets of a view would exceed this "
413 "limit, an error message is shown. The normal user cannot override "
414 "the hard limit. The purpose of the hard limit is to secure the server "
415 "against useless queries with huge result sets."),
420 @config_variable_registry.register
421 class ConfigVariableQuicksearchDropdownLimit(ConfigVariable
):
423 return ConfigVariableGroupUserInterface
426 return ConfigDomainGUI
429 return "quicksearch_dropdown_limit"
433 title
=_("Number of elements to show in Quicksearch"),
434 help=_("When typing a texts in the Quicksearch snapin, a dropdown will "
435 "appear listing all matching host names containing that text. "
436 "That list is limited in size so that the dropdown will not get "
437 "too large when you have a huge number of lists. "),
442 @config_variable_registry.register
443 class ConfigVariableQuicksearchSearchOrder(ConfigVariable
):
445 return ConfigVariableGroupUserInterface
448 return ConfigDomainGUI
451 return "quicksearch_search_order"
458 title
=_("Search filter"),
460 ("h", _("Hostname")),
461 ("al", _("Hostalias")),
462 ("ad", _("Hostaddress")),
463 ("tg", _("Hosttag")),
464 ("hg", _("Hostgroup")),
465 ("sg", _("Servicegroup")),
466 ("s", _("Service Description")),
470 title
=_("Match behaviour"),
472 ("continue", _("Continue search")),
474 _("Search finished: Also show all results of previous filters")),
475 ("finished_distinct",
476 _("Search finished: Only show results of this filter")),
480 title
=_("Quicksearch search order"),
481 add_label
=_("Add search filter"),
485 @config_variable_registry.register
486 class ConfigVariableTableRowLimit(ConfigVariable
):
488 return ConfigVariableGroupUserInterface
491 return ConfigDomainGUI
494 return "table_row_limit"
498 title
=_("Limit the number of rows shown in tables"),
499 help=_("Several pages which use tables to show data in rows, like the "
500 "\"Users\" configuration page, can be configured to show "
501 "only a limited number of rows when accessing the pages."),
507 @config_variable_registry.register
508 class ConfigVariableStartURL(ConfigVariable
):
510 return ConfigVariableGroupUserInterface
513 return ConfigDomainGUI
520 title
=_("Start URL to display in main frame"),
521 help=_("When you point your browser to the Check_MK GUI, usually the dashboard "
522 "is shown in the main (right) frame. You can replace this with any other "
523 "URL you like here."),
526 validate
=utils
.validate_start_url
,
530 @config_variable_registry.register
531 class ConfigVariablePageHeading(ConfigVariable
):
533 return ConfigVariableGroupUserInterface
536 return ConfigDomainGUI
539 return "page_heading"
543 title
=_("Page title"),
544 help=_("This title will be displayed in your browser's title bar or tab. You can use "
545 "a <tt>%s</tt> to insert the alias of your monitoring site to the title."),
550 @config_variable_registry.register
551 class ConfigVariablePagetitleDateFormat(ConfigVariable
):
553 return ConfigVariableGroupUserInterface
556 return ConfigDomainGUI
559 return "pagetitle_date_format"
562 return DropdownChoice(
563 title
=_("Date format for page titles"),
564 help=_("When enabled, the headline of each page also displays "
565 "the date in addition the time."),
567 (None, _("Do not display a date")),
568 ('yyyy-mm-dd', _("YYYY-MM-DD")),
569 ('dd.mm.yyyy', _("DD.MM.YYYY")),
574 @config_variable_registry.register
575 class ConfigVariableEscapePluginOutput(ConfigVariable
):
577 return ConfigVariableGroupUserInterface
580 return ConfigDomainGUI
583 return "escape_plugin_output"
587 title
=_("Escape HTML codes in plugin output"),
588 help=_("By default, for security reasons, the GUI does not interpret any HTML "
589 "code received from external sources, like plugin output or log messages. "
590 "If you are really sure what you are doing and need to have HTML codes, like "
591 "links rendered, disable this option. Be aware, you might open the way "
592 "for several injection attacks.") + _(
593 "This setting can either be set globally or individually for selected hosts "
594 "or services using the host or service rulesets."),
595 label
=_("Prevent loading HTML from plugin output or log messages"),
599 @config_variable_registry.register
600 class ConfigVariableCrashReportTarget(ConfigVariable
):
602 return ConfigVariableGroupUserInterface
605 return ConfigDomainGUI
608 return "crash_report_target"
612 title
=_("Fallback mail address for crash reports"),
613 help=_("By default crash reports will be sent to our crash reporting server. In case "
614 "this fails for some reason, the crash reports can be sent by mail to the "
615 "address configured here."),
621 @config_variable_registry.register
622 class ConfigVariableDrawRuleIcon(ConfigVariable
):
624 return ConfigVariableGroupUserInterface
627 return ConfigDomainGUI
630 return "multisite_draw_ruleicon"
634 title
=_("Show icon linking to WATO parameter editor for services"),
635 label
=_("Show WATO icon"),
636 help=_("When enabled a rule editor icon is displayed for each "
637 "service in the multisite views. It is only displayed if the user "
638 "does have the permission to edit rules."),
642 def transform_virtual_host_trees(trees
):
643 def id_from_title(title
):
644 return re
.sub("[^-a-zA-Z0-9_]+", "", title
.lower())
646 for index
, tree
in enumerate(trees
):
647 if isinstance(tree
, tuple):
649 "id": id_from_title(tree
[0]),
651 "tree_spec": tree
[1],
654 # Transform existing dicts with old key "tag_groups"
655 if "tag_groups" in tree
:
656 tree
["tree_spec"] = tree
.pop("tag_groups")
658 return sorted(trees
, key
=lambda x
: x
["title"])
661 @config_variable_registry.register
662 class ConfigVariableVirtualHostTrees(ConfigVariable
):
664 return ConfigVariableGroupUserInterface
667 return ConfigDomainGUI
670 return "virtual_host_trees"
681 ("title", TextUnicode(
682 title
=_("Title of the tree"),
685 ("exclude_empty_tag_choices",
687 title
=_("Exclude empty tag choices"),
692 DropdownChoice(choices
=self
._virtual
_host
_tree
_choices
,),
693 title
=_("Tree levels"),
700 add_label
=_("Create new virtual host tree configuration"),
701 title
=_("Virtual Host Trees"),
703 _("Here you can define tree configurations for the snapin <i>Virtual Host-Trees</i>. "
704 "These trees organize your hosts based on their values in certain host tag groups. "
705 "Each host tag group you select will create one level in the tree."),
706 validate
=self
._validate
_virtual
_host
_trees
,
709 forth
=transform_virtual_host_trees
,
712 def _virtual_host_tree_choices(self
):
713 return self
._wato
_host
_tag
_group
_choices
() + [("foldertree:", _("WATO folder tree"))] + [
714 ("folder:%d" % l
, _("WATO folder level %d") % l
) for l
in range(1, 7)
717 def _wato_host_tag_group_choices(self
):
718 # We add to the choices:
719 # 1. All host tag groups with their id
720 # 2. All *topics* that:
721 # - consist only of checkbox tags
722 # - contain at least two entries
725 for tag_group
in config
.tags
.tag_groups
:
726 choices
.append((tag_group
.id, tag_group
.title
))
727 by_topic
.setdefault(tag_group
.topic
, []).append(tag_group
)
729 # Now search for checkbox-only-topics
730 for topic
, tag_groups
in by_topic
.items():
731 for tag_group
in tag_groups
:
732 if len(tag_group
.tags
) != 1:
735 if len(tag_groups
) > 1:
738 _("Topic") + ": " + topic
,
743 def _validate_virtual_host_trees(self
, value
, varprefix
):
746 if tree
["id"] in tree_ids
:
747 raise MKUserError(varprefix
, _("The ID needs to be unique."))
748 tree_ids
.add(tree
["id"])
750 # Validate that each element is selected once
752 for element
in tree
["tree_spec"]:
756 _("Found '%s' a second time in tree '%s'. Each element can only be "
757 "choosen once.") % (element
, tree
["id"]))
762 @config_variable_registry.register
763 class ConfigVariableRescheduleTimeout(ConfigVariable
):
765 return ConfigVariableGroupUserInterface
768 return ConfigDomainGUI
771 return "reschedule_timeout"
775 title
=_("Timeout for rescheduling checks in Multisite"),
776 help=_("When you reschedule a check by clicking on the "arrow"-icon "
777 "then Multisite will use this number of seconds as a timeout. If the "
778 "monitoring core has not executed the check within this time, an error "
779 "will be displayed and the page not reloaded."),
782 display_format
="%.1f",
786 @config_variable_registry.register
787 class ConfigVariableSidebarShowVersionInSidebar(ConfigVariable
):
789 return ConfigVariableGroupUserInterface
792 return ConfigDomainGUI
795 return "sidebar_show_version_in_sidebar"
799 title
=_("Show Check_MK edition & version in sidebar"),
800 label
=_("Show the edition ad version"),
801 help=_("Use this option to hide the Check_MK edition and version information from "
802 "the header of the sidebar."),
806 @config_variable_registry.register
807 class ConfigVariableSidebarUpdateInterval(ConfigVariable
):
809 return ConfigVariableGroupUserInterface
812 return ConfigDomainGUI
815 return "sidebar_update_interval"
819 title
=_("Interval of sidebar status updates"),
820 help=_("The information provided by the sidebar snapins is refreshed in a regular "
821 "interval. You can change the refresh interval to fit your needs here. This "
822 "value means that all snapnis which request a regular refresh are updated "
823 "in this interval."),
826 display_format
="%.1f",
830 @config_variable_registry.register
831 class ConfigVariableSidebarNotifyInterval(ConfigVariable
):
833 return ConfigVariableGroupUserInterface
836 return ConfigDomainGUI
839 return "sidebar_notify_interval"
846 display_format
="%.1f",
848 title
=_("Interval of sidebar popup notification updates"),
850 "The sidebar can be configured to regularly check for pending popup notififcations. "
851 "This is disabled by default."),
852 none_label
=_('(disabled)'),
856 @config_variable_registry.register
857 class ConfigVariableiAdHocDowntime(ConfigVariable
):
859 return ConfigVariableGroupUserInterface
862 return ConfigDomainGUI
865 return "adhoc_downtime"
875 help=_("The duration in minutes of the adhoc downtime."),
882 title
=_("Adhoc comment"),
883 help=_("The comment which is automatically sent with an adhoc downtime"),
890 title
=_("Adhoc downtime"),
891 label
=_("Enable adhoc downtime"),
892 help=_("This setting allows to set an adhoc downtime comment and its duration. "
893 "When enabled a new button <i>Adhoc downtime for __ minutes</i> will "
894 "be available in the command form."),
898 @config_variable_registry.register
899 class ConfigVariableAuthByHTTPHeader(ConfigVariable
):
901 return ConfigVariableGroupUserInterface
904 return ConfigDomainGUI
907 return "auth_by_http_header"
912 label
=_("HTTP Header Variable"),
913 help=_("Configure the name of the environment variable to read "
914 "from the incoming HTTP requests"),
915 default_value
='REMOTE_USER',
918 title
=_("Authenticate users by incoming HTTP requests"),
919 label
=_("Activate HTTP header authentication (Warning: Only activate "
920 "in trusted environments, see help for details)"),
921 help=_("If this option is enabled, multisite reads the configured HTTP header "
922 "variable from the incoming HTTP request and simply takes the string "
923 "in this variable as name of the authenticated user. "
924 "Be warned: Only allow access from trusted ip addresses "
925 "(Apache <tt>Allow from</tt>), like proxy "
926 "servers, to this webpage. A user with access to this page could simply fake "
927 "the authentication information. This option can be useful to "
928 " realize authentication in reverse proxy environments."),
930 none_label
=_("Don't use HTTP header authentication"),
935 @config_variable_registry.register
936 class ConfigVariableStalenessThreshold(ConfigVariable
):
938 return ConfigVariableGroupUserInterface
941 return ConfigDomainGUI
944 return "staleness_threshold"
948 title
=_('Staleness value to mark hosts / services stale'),
950 'The staleness value of a host / service is calculated by measuring the '
951 'configured check intervals a check result is old. A value of 1.5 means the '
952 'current check result has been gathered one and a half check intervals of an object. '
953 'This would mean 90 seconds in case of a check which is checked each 60 seconds.'),
958 @config_variable_registry.register
959 class ConfigVariableLoginScreen(ConfigVariable
):
961 return ConfigVariableGroupUserInterface
964 return ConfigDomainGUI
967 return "login_screen"
971 title
=_("Customize login screen"),
976 title
=_("Hide Check_MK version"),
977 totext
=_("Hide the Check_MK version from the login box"),
981 title
=_("Show a login message"),
983 _("You may use this option to give your users an informational text before logging in."
991 TextUnicode(title
=_("Title"),),
999 ("_blank", _("Load in a new window / tab")),
1000 ("_top", _("Load in current window / tab")),
1004 orientation
="horizontal",
1006 totext
=_("%d links"),
1007 title
=_("Custom footer links"),
1014 @config_variable_registry.register
1015 class ConfigVariableUserLocalizations(ConfigVariable
):
1017 return ConfigVariableGroupUserInterface
1020 return ConfigDomainGUI
1023 return "user_localizations"
1025 def valuespec(self
):
1030 TextUnicode(title
=_("Original Text"), size
=40),
1032 title
=_("Translations"),
1033 elements
=lambda: [(l
or "en", TextUnicode(title
=a
, size
=32))
1034 for (l
, a
) in cmk
.gui
.i18n
.get_languages()],
1038 title
=_("Custom localizations"),
1040 totext
=_("%d translations"),
1042 forth
=lambda d
: sorted(d
.items()),
1047 @config_variable_registry.register
1048 class ConfigVariableUserIconsAndActions(ConfigVariable
):
1050 return ConfigVariableGroupUserInterface
1053 return ConfigDomainGUI
1056 return "user_icons_and_actions"
1058 def valuespec(self
):
1066 ('icon', IconSelector(
1070 ('title', TextUnicode(title
=_('Title'),)),
1079 _('This URL is opened when clicking on the action / icon. You '
1080 'can use some macros within the URL which are dynamically '
1081 'replaced for each object. These are:<br>'
1083 '<li>$HOSTNAME$: Contains the name of the host</li>'
1084 '<li>$HOSTNAME_URL_ENCODED$: Same as above but URL encoded</li>'
1085 '<li>$SERVICEDESC$: Contains the service description '
1086 '(in case this is a service)</li>'
1087 '<li>$SERVICEDESC_URL_ENCODED$: Same as above but URL encoded</li>'
1088 '<li>$HOSTADDRESS$: Contains the network address of the host</li>'
1089 '<li>$HOSTADDRESS_URL_ENCODED$: Same as above but URL encoded</li>'
1090 '<li>$USER_ID$: The user ID of the currently active user</li>'
1097 ("_blank", _("Load in a new window / tab")),
1099 _("Load in current content area (keep sidebar)"
1101 ("_top", _("Load as new page (hide sidebar)")),
1106 forth
=lambda x
: not isinstance(x
, tuple) and (x
, "_self") or x
,
1111 title
=_('Show in column'),
1112 totext
=_('Directly show the action icon in the column'),
1113 help=_('Makes the icon appear in the column instead '
1114 'of the dropdown menu.'),
1118 title
=_('Sort index'),
1120 _('You can use the sort index to control the order of the '
1121 'elements in the column and the menu. The elements are sorted '
1122 'from smaller to higher numbers. The action menu icon '
1123 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1124 'of <tt>20</tt>. All other default icons have a sort index of '
1125 '<tt>30</tt> configured.'),
1130 optional_keys
=['title', 'url', 'toplevel', 'sort_index'],
1133 title
=_("Custom icons and actions"),
1135 totext
=_("%d icons and actions"),
1137 forth
=lambda d
: sorted(d
.items()),
1142 @config_variable_registry.register
1143 class ConfigVariableCustomServiceAttributes(ConfigVariable
):
1145 return ConfigVariableGroupUserInterface
1148 return ConfigDomainGUI
1151 return "custom_service_attributes"
1153 def valuespec(self
):
1161 help=_("The ID will be used as internal identifier and the custom "
1162 "service attribute will be computed based on the ID. The "
1163 "custom service attribute will be named <tt>_[ID]</tt> in "
1164 "the core configuration and can be gathered using the "
1165 "Livestatus column <tt>custom_variables</tt> using the "
1166 "<tt>[ID]</tt>. The custom service attributes are available "
1167 "to notification scripts as environment variable named "
1168 "<tt>SERVICE_[ID]</tt>."),
1169 validate
=self
._validate
_id
,
1170 regex
=re
.compile('^[A-Z_][-A-Z0-9_]*$'),
1172 "An identifier must only consist of letters, digits, dash and "
1173 "underscore and it must start with a letter or underscore.") + " "
1174 + _("Only upper case letters are allowed"))),
1175 ('title', TextUnicode(title
=_('Title'),)),
1178 title
=_("Data type"),
1180 ('TextAscii', _('Simple Text')),
1186 title
=_("Custom service attributes"),
1187 help=_("These custom service attributes can be assigned to services "
1188 "using the ruleset <a href=\"%s\">%s</a>.") %
1189 ("wato.py?mode=edit_ruleset&varname=custom_service_attributes",
1190 _("Custom service attributes")),
1192 totext
=_("%d custom service attributes"),
1194 # Unique IDs are ensured by the transform below. The Transform is executed
1195 # before the validation function has the chance to validate it and print a
1196 # custom error message.
1197 validate
=self
._validate
_unique
_entries
,
1199 forth
=lambda v
: v
.values(),
1200 back
=lambda v
: {p
["ident"]: p
for p
in v
},
1203 def _validate_id(self
, value
, varprefix
):
1205 "ESCAPE_PLUGIN_OUTPUT",
1211 if value
.upper() in internal_ids
:
1212 raise MKUserError(varprefix
, _("This ID can not be used as custom attribute"))
1214 def _validate_unique_entries(self
, value
, varprefix
):
1217 if entry
["title"] in seen_titles
:
1218 raise MKUserError(varprefix
,
1219 _("Found multiple entries using the title '%s'") % entry
["title"])
1220 seen_titles
.append(entry
["title"])
1223 @rulespec_registry.register
1224 class RulespecCustomServiceAttributes(ServiceRulespec
):
1227 return RulespecGroupMonitoringConfigurationServiceChecks
1231 return "custom_service_attributes"
1234 def match_type(self
):
1238 def item_type(self
):
1242 def valuespec(self
):
1245 choices
=self
._custom
_service
_attribute
_choices
(),
1246 orientation
="horizontal",
1248 title
=_("Custom service attributes"),
1249 help=_("Use this ruleset to assign <a href=\"%s\">%s</a> to services.") %
1250 ("wato.py?mode=edit_configvar&varname=custom_service_attributes",
1251 _("Custom service attributes")),
1253 validate
=self
._validate
_unique
_entries
,
1256 def _custom_service_attribute_choices(self
):
1259 for ident
, attr_spec
in config
.custom_service_attributes
.items():
1260 if attr_spec
["type"] == "TextAscii":
1263 raise NotImplementedError()
1264 choices
.append((ident
, attr_spec
["title"], vs
))
1266 return sorted(choices
, key
=lambda x
: x
[1])
1268 def _validate_unique_entries(self
, value
, varprefix
):
1271 if entry
[0] in seen_ids
:
1272 raise MKUserError(varprefix
, _("Found multiple entries using for '%s'") % entry
[0])
1273 seen_ids
.append(entry
[0])
1276 @rulespec_registry.register
1277 class RulespecServiceTags(ServiceRulespec
):
1280 return RulespecGroupMonitoringConfigurationServiceChecks
1284 return "service_tag_rules"
1287 def match_type(self
):
1291 def item_type(self
):
1295 def valuespec(self
):
1298 choices
=self
._tag
_group
_choices
(),
1299 orientation
="horizontal",
1301 title
=_("Service tags"),
1302 help=_("Use this ruleset to assign <a href=\"%s\">%s</a> to services.") %
1303 ("wato.py?mode=tags", _("Tags")),
1305 validate
=self
._validate
_unique
_entries
,
1308 def _tag_group_choices(self
):
1311 for tag_group
in config
.tags
.tag_groups
:
1312 choices
.append((tag_group
.id, tag_group
.title
,
1313 DropdownChoice(choices
=tag_group
.get_tag_choices(),)))
1315 return sorted(choices
, key
=lambda x
: x
[1])
1317 def _validate_unique_entries(self
, value
, varprefix
):
1320 if entry
[0] in seen_ids
:
1321 raise MKUserError(varprefix
, _("Found multiple entries using for '%s'") % entry
[0])
1322 seen_ids
.append(entry
[0])
1325 @rulespec_registry.register
1326 class RulespecServiceLabels(ServiceRulespec
):
1329 return RulespecGroupMonitoringConfigurationServiceChecks
1333 return "service_label_rules"
1336 def match_type(self
):
1340 def item_type(self
):
1344 def valuespec(self
):
1346 world
=Labels
.World
.CONFIG
,
1347 label_source
=Labels
.Source
.RULESET
,
1348 title
=_("Service labels"),
1349 help=_("Use this ruleset to assign labels to service of your choice."),
1353 @rulespec_registry.register
1354 class RulespecHostLabels(HostRulespec
):
1357 return RulespecGroupMonitoringConfigurationHostChecks
1361 return "host_label_rules"
1364 def match_type(self
):
1368 def valuespec(self
):
1370 world
=Labels
.World
.CONFIG
,
1371 label_source
=Labels
.Source
.RULESET
,
1372 title
=_("Host labels"),
1373 help=_("Use this ruleset to assign labels to hosts of your choice."),
1377 @config_variable_registry.register
1378 class ConfigVariableUserDowntimeTimeranges(ConfigVariable
):
1380 return ConfigVariableGroupUserInterface
1383 return ConfigDomainGUI
1386 return "user_downtime_timeranges"
1388 def valuespec(self
):
1391 elements
=[('title', TextUnicode(title
=_('Title'),)),
1397 title
=_("Duration"),
1398 display
=["minutes", "hours", "days"],
1403 ('next_day', _("Start of next day")),
1404 ('next_week', _("Start of next week")),
1405 ('next_month', _("Start of next month")),
1406 ('next_year', _("Start of next year")),
1408 default_value
="next_day",
1412 default_value
=24 * 60 * 60,
1416 title
=_("Custom Downtime Timeranges"),
1418 totext
=_("%d timeranges"),
1422 @config_variable_registry.register
1423 class ConfigVariableBuiltinIconVisibility(ConfigVariable
):
1425 return ConfigVariableGroupUserInterface
1428 return ConfigDomainGUI
1431 return "builtin_icon_visibility"
1433 def valuespec(self
):
1440 choices
=self
._get
_builtin
_icons
,
1447 title
=_('Show in column'),
1448 label
=_('Directly show the action icon in the column'),
1449 help=_('Makes the icon appear in the column instead '
1450 'of the dropdown menu.'),
1455 title
=_('Sort index'),
1457 _('You can use the sort index to control the order of the '
1458 'elements in the column and the menu. The elements are sorted '
1459 'from smaller to higher numbers. The action menu icon '
1460 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1461 'of <tt>20</tt>. All other default icons have a sort index of '
1462 '<tt>30</tt> configured.'),
1466 optional_keys
=['toplevel', 'sort_index'],
1469 title
=_("Builtin icon visibility"),
1471 totext
=_("%d icons customized"),
1472 help=_("You can use this option to change the default visibility "
1473 "options of the builtin icons. You can change whether or not "
1474 "the icons are shown in the popup menu or on top level and "
1475 "change the sorting of the icons."),
1477 forth
=lambda d
: sorted(d
.items()),
1481 def _get_builtin_icons(self
):
1482 return [(id_
, id_
) for id_
in icon_and_action_registry
.keys()]
1485 @config_variable_registry.register
1486 class ConfigVariableServiceViewGrouping(ConfigVariable
):
1488 return ConfigVariableGroupUserInterface
1491 return ConfigDomainGUI
1494 return "service_view_grouping"
1496 def valuespec(self
):
1500 ('title', TextUnicode(title
=_('Title to show for the group'),)),
1503 title
=_('Grouping expression'),
1504 help=_('This regular expression is used to match the services to be put '
1505 'into this group. This is a prefix match regular expression.'),
1506 mode
=RegExpUnicode
.prefix
,
1510 title
=_('Minimum number of items to create a group'),
1511 help=_('When less than these items are found for a group, the services '
1512 'are not shown grouped together.'),
1519 title
=_("Grouping of services in table views"),
1521 "You can use this option to make the service table views fold services matching "
1522 "the given patterns into groups. Only services in state <i>OK</i> will be folded "
1523 "together. Groups of only one service will not be rendered. If multiple patterns "
1524 "match a service, the service will be added to the first matching group."),
1525 add_label
=_("Add new grouping definition"),
1529 @config_variable_registry.register
1530 class ConfigVariableTopologyDefaultFilterGroup(ConfigVariable
):
1532 return ConfigVariableGroupUserInterface
1535 return ConfigDomainGUI
1538 return "topology_default_filter_group"
1540 def valuespec(self
):
1543 choices
=lambda: sites
.all_groups("host"),
1546 title
=_("Network Topology: Default Filter Group"),
1548 "By default the network topology view shows you the parent / child relations "
1549 "of all hosts within your local site. The list can be filtered based on hostgroup "
1550 "memberships by the users. You can define a default group to use for filtering "
1551 "which is used when a user opens the network topology view."),
1552 none_label
=_("Show all hosts when opening the network topology view"),
1556 @config_variable_registry.register
1557 class ConfigVariableViewActionDefaults(ConfigVariable
):
1559 return ConfigVariableGroupUserInterface
1562 return ConfigDomainGUI
1565 return "view_action_defaults"
1567 def valuespec(self
):
1569 title
=_("View action defaults"),
1571 ("ack_sticky", Checkbox(
1578 title
=_("Send notification"),
1584 title
=_("Persistent comment"),
1586 default_value
=False,
1590 title
=_("Expire acknowledgement after"),
1591 display
=["days", "hours", "minutes"],
1599 @config_variable_registry.register
1600 class ConfigVariableTrustedCertificateAuthorities(ConfigVariable
):
1602 return ConfigVariableGroupSiteManagement
1605 return ConfigDomainCACertificates
1608 return "trusted_certificate_authorities"
1610 def valuespec(self
):
1612 title
=_("Trusted certificate authorities for SSL"),
1613 help=_("Whenever a server component of Check_MK opens a SSL connection it uses the "
1614 "certificate authorities configured here for verifying the SSL certificate of "
1615 "the destination server. This is used for example when performing WATO "
1616 "replication to slave sites or when special agents are communicating via HTTPS. "
1617 "The CA certificates configured here will be written to the CA bundle %s.") %
1618 site_neutral_path(ConfigDomainCACertificates
.trusted_cas_file
),
1620 ("use_system_wide_cas",
1622 title
=_("Use system wide CAs"),
1623 help=_("All supported linux distributions provide a mechanism of managing "
1624 "trusted CAs. Depending on your linux distributions the paths where "
1625 "these CAs are stored and the commands to manage the CAs differ. "
1626 "Please checko out the documentation of your linux distribution "
1627 "in case you want to customize trusted CAs system wide. You can "
1628 "choose here to trust the system wide CAs here. Check_MK will search "
1629 "these directories for system wide CAs: %s") % ", ".join(
1630 ConfigDomainCACertificates
.system_wide_trusted_ca_search_paths
),
1631 label
=_("Trust system wide configured CAs"),
1633 ("trusted_cas", ListOfCAs(
1634 title
=_("Check_MK specific"),
1638 optional_keys
=False,
1643 # .--WATO----------------------------------------------------------------.
1644 # | __ ___ _____ ___ |
1645 # | \ \ / / \|_ _/ _ \ |
1646 # | \ \ /\ / / _ \ | || | | | |
1647 # | \ V V / ___ \| || |_| | |
1648 # | \_/\_/_/ \_\_| \___/ |
1650 # +----------------------------------------------------------------------+
1651 # | Global Configuration for WATO |
1652 # '----------------------------------------------------------------------'
1655 @config_variable_group_registry.register
1656 class ConfigVariableGroupWATO(ConfigVariableGroup
):
1658 return _("Administration Tool (WATO)")
1660 def sort_index(self
):
1664 @config_variable_registry.register
1665 class ConfigVariableWATOMaxSnapshots(ConfigVariable
):
1667 return ConfigVariableGroupWATO
1670 return ConfigDomainGUI
1673 return "wato_max_snapshots"
1675 def valuespec(self
):
1677 title
=_("Number of configuration snapshots to keep"),
1678 help=_("Whenever you successfully activate changes a snapshot of the configuration "
1679 "will be created. You can also create snapshots manually. WATO will delete old "
1680 "snapshots when the maximum number of snapshots is reached."),
1685 @config_variable_registry.register
1686 class ConfigVariableWATOActivationMethod(ConfigVariable
):
1688 return ConfigVariableGroupWATO
1691 return ConfigDomainGUI
1694 return "wato_activation_method"
1696 def valuespec(self
):
1697 return DropdownChoice(
1698 title
=_("WATO restart mode for Nagios"),
1699 help=_("Should WATO restart or reload Nagios when activating changes"),
1701 ('restart', _("Restart")),
1702 ('reload', _("Reload")),
1707 @config_variable_registry.register
1708 class ConfigVariableWATOLegacyEval(ConfigVariable
):
1710 return ConfigVariableGroupWATO
1713 return ConfigDomainGUI
1716 return "wato_legacy_eval"
1718 def valuespec(self
):
1720 title
=_("Use unsafe legacy encoding for distributed WATO"),
1722 _("The current implementation of WATO uses a Python module called <tt>ast</tt> for the "
1723 "communication between sites. Previous versions of Check_MK used an insecure encoding "
1724 "named <tt>pickle</tt>. Even in the current version WATO falls back to <tt>pickle</tt> "
1725 "if your Python version is not recent enough. This is at least the case for RedHat/CentOS 5.X "
1726 "and Debian 5.0. In a mixed environment you can force using the legacy <tt>pickle</tt> format "
1727 "in order to create compatibility."),
1731 @config_variable_registry.register
1732 class ConfigVariableWATOHideFilenames(ConfigVariable
):
1734 return ConfigVariableGroupWATO
1737 return ConfigDomainGUI
1740 return "wato_hide_filenames"
1742 def valuespec(self
):
1744 title
=_("Hide internal folder names in WATO"),
1745 label
=_("hide folder names"),
1746 help=_("When enabled, then the internal names of WATO folder in the filesystem "
1747 "are not shown. They will automatically be derived from the name of the folder "
1748 "when a new folder is being created. Disable this option if you want to see and "
1749 "set the filenames manually."),
1753 @config_variable_registry.register
1754 class ConfigVariableWATOUploadInsecureSnapshots(ConfigVariable
):
1756 return ConfigVariableGroupWATO
1759 return ConfigDomainGUI
1762 return "wato_upload_insecure_snapshots"
1764 def valuespec(self
):
1766 title
=_("Allow upload of insecure WATO snapshots"),
1767 label
=_("upload insecure snapshots"),
1769 _("When enabled, insecure snapshots are allowed. Please keep in mind that the upload "
1770 "of unverified snapshots represents a security risk, since the content of a snapshot is executed "
1771 "during runtime. Any manipulations in the content - either willingly or unwillingly (XSS attack) "
1772 "- pose a serious security risk."),
1776 @config_variable_registry.register
1777 class ConfigVariableWATOHideHosttags(ConfigVariable
):
1779 return ConfigVariableGroupWATO
1782 return ConfigDomainGUI
1785 return "wato_hide_hosttags"
1787 def valuespec(self
):
1789 title
=_("Hide hosttags in WATO folder view"),
1790 label
=_("hide hosttags"),
1791 help=_("When enabled, hosttags are no longer shown within the WATO folder view"),
1795 @config_variable_registry.register
1796 class ConfigVariableWATOHideVarnames(ConfigVariable
):
1798 return ConfigVariableGroupWATO
1801 return ConfigDomainGUI
1804 return "wato_hide_varnames"
1806 def valuespec(self
):
1808 title
=_("Hide names of configuration variables"),
1809 label
=_("hide variable names"),
1810 help=_("When enabled, internal configuration variable names of Check_MK are hidden "
1811 "from the user (for example in the rule editor)"),
1815 @config_variable_registry.register
1816 class ConfigVariableHideHelpInLists(ConfigVariable
):
1818 return ConfigVariableGroupWATO
1821 return ConfigDomainGUI
1824 return "wato_hide_help_in_lists"
1826 def valuespec(self
):
1828 title
=_("Hide help text of rules in list views"),
1829 label
=_("hide help text"),
1830 help=_("When disabled, WATO shows the help texts of rules also in the list views."),
1834 @config_variable_registry.register
1835 class ConfigVariableWATOUseGit(ConfigVariable
):
1837 return ConfigVariableGroupWATO
1840 return ConfigDomainGUI
1843 return "wato_use_git"
1845 def valuespec(self
):
1847 title
=_("Use GIT version control for WATO"),
1848 label
=_("enable GIT version control"),
1850 "When enabled, all changes of configuration files are tracked with the "
1851 "version control system GIT. You need to make sure that git is installed "
1852 "on your monitoring server. The version history currently cannot be viewed "
1853 "via the web GUI. Please use git command line tools within your Check_MK "
1854 "configuration directory. If you want easier tracking of configuration file changes "
1855 "simply enable the global settings option <tt>Pretty print configuration files</tt>"
1860 @config_variable_registry.register
1861 class ConfigVariableWATOPrettyPrintConfig(ConfigVariable
):
1863 return ConfigVariableGroupWATO
1866 return ConfigDomainGUI
1869 return "wato_pprint_config"
1871 def valuespec(self
):
1873 title
=_("Pretty-Print configuration files"),
1874 label
=_("pretty-print configuration files"),
1876 _("When enabled, most of the configuration files are pretty printed and easier to read. "
1877 "On the downside, however, pretty printing bigger configurations can be quite slow - "
1878 "so the overall WATO GUI performance will decrease."),
1882 @config_variable_registry.register
1883 class ConfigVariableWATOHideFoldersWithoutReadPermissions(ConfigVariable
):
1885 return ConfigVariableGroupWATO
1888 return ConfigDomainGUI
1891 return "wato_hide_folders_without_read_permissions"
1893 def valuespec(self
):
1895 title
=_("Hide folders without read permissions"),
1896 label
=_("hide folders without read permissions"),
1898 "When enabled, a subfolder is not shown, when the user does not have sufficient "
1899 "permissions to this folder and all of its subfolders. However, the subfolder is "
1900 "shown if the user has permissions to any of its subfolder."),
1904 @config_variable_registry.register
1905 class ConfigVariableWATOIconCategories(ConfigVariable
):
1907 return ConfigVariableGroupWATO
1910 return ConfigDomainGUI
1913 return "wato_icon_categories"
1915 def valuespec(self
):
1920 TextUnicode(title
=_("Title"),),
1922 orientation
="horizontal",
1924 title
=_("Icon categories"),
1925 help=_("You can customize the list of icon categories to be able to assign "
1926 "your <a href=\"?mode=icons\">custom icons</a> to these categories. "
1927 "They will then be shown under this category in the icon selector."),
1932 # .--User Management-----------------------------------------------------.
1934 # | | | | |___ ___ _ __ | \/ | __ _ _ __ ___ | |_ |
1935 # | | | | / __|/ _ \ '__| | |\/| |/ _` | '_ ` _ \| __| |
1936 # | | |_| \__ \ __/ | | | | | (_| | | | | | | |_ |
1937 # | \___/|___/\___|_| |_| |_|\__, |_| |_| |_|\__| |
1939 # +----------------------------------------------------------------------+
1940 # | Global settings for users and LDAP connector. |
1941 # '----------------------------------------------------------------------'
1944 @config_variable_group_registry.register
1945 class ConfigVariableGroupUserManagement(ConfigVariableGroup
):
1947 return _("User Management")
1949 def sort_index(self
):
1953 @config_variable_registry.register
1954 class ConfigVariableLockOnLogonFailures(ConfigVariable
):
1956 return ConfigVariableGroupUserManagement
1959 return ConfigDomainGUI
1962 return "lock_on_logon_failures"
1964 def valuespec(self
):
1967 label
=_("Number of logon failures to lock the account"),
1972 title
=_("Lock user accounts after N logon failures"),
1973 label
=_("Activate automatic locking of user accounts"),
1974 help=_("This options enables automatic locking of user accounts after "
1975 "the configured number of consecutive invalid login attempts. "
1976 "Once the account is locked only an admin user can unlock it. "
1977 "Beware: Also the admin users will be locked that way. You need "
1978 "to manually edit <tt>etc/htpasswd</tt> and remove the <tt>!</tt> "
1979 "in case you are locked out completely."),
1983 @config_variable_registry.register
1984 class ConfigVariablePasswordPolicy(ConfigVariable
):
1986 return ConfigVariableGroupUserManagement
1989 return ConfigDomainGUI
1992 return "password_policy"
1994 def valuespec(self
):
1996 title
=_('Password policy for local accounts'),
1998 'You can define some rules to which each user password ahers. By default '
1999 'all passwords are accepted, even ones which are made of only a single character, '
2000 'which is obviously a bad idea. Using this option you can enforce your users '
2001 'to choose more secure passwords.'),
2003 ('min_length', Integer(
2004 title
=_("Minimum password length"),
2009 title
=_("Number of character groups to use"),
2013 "Force the user to choose a password that contains characters from at least "
2014 "this number of different character groups. "
2015 "Character groups are: <ul>"
2016 "<li>lowercase letters</li>"
2017 "<li>uppercase letters</li>"
2019 "<li>special characters such as an underscore or dash</li>"
2024 title
=_("Maximum age of passwords"),
2027 default_value
=365 * 86400,
2033 @config_variable_registry.register
2034 class ConfigVariableUserIdleTimeout(ConfigVariable
):
2036 return ConfigVariableGroupUserManagement
2039 return ConfigDomainGUI
2042 return "user_idle_timeout"
2044 def valuespec(self
):
2048 display
=["minutes", "hours", "days"],
2052 title
=_("Login session idle timeout"),
2053 label
=_("Enable a login session idle timeout"),
2054 help=_("Normally a user login session is valid until the password is changed or "
2055 "the user is locked. By enabling this option, you can apply a time limit "
2056 "to login sessions which is applied when the user stops interacting with "
2057 "the GUI for a given amount of time. When a user is exceeding the configured "
2058 "maximum idle time, the user will be logged out and redirected to the login "
2059 "screen to renew the login session. This setting can be overriden for each "
2060 "user individually in the profile of the users."),
2064 @config_variable_registry.register
2065 class ConfigVariableSingleUserSession(ConfigVariable
):
2067 return ConfigVariableGroupUserManagement
2070 return ConfigDomainGUI
2073 return "single_user_session"
2075 def valuespec(self
):
2079 display
=["minutes", "hours"],
2080 label
=_("Session timeout:"),
2084 title
=_("Limit login to single session at a time"),
2085 label
=_("Users can only login from one client at a time"),
2086 help=_("Normally a user can login to the GUI from unlimited number of clients at "
2087 "the same time. If you want to enforce your users to be able to login only once "
2088 " (from one client which means device and browser), you can enable this option. "
2089 "When the user logs out or is inactive for the configured amount of time, the "
2090 "session is invalidated automatically and the user has to log in again from the "
2091 "current or another device."),
2095 @config_variable_registry.register
2096 class ConfigVariableDefaultUserProfile(ConfigVariable
):
2098 return ConfigVariableGroupUserManagement
2101 return ConfigDomainGUI
2104 return "default_user_profile"
2106 def valuespec(self
):
2108 title
=_("Default user profile"),
2110 "With this option you can specify the attributes a user which is created during "
2111 "its initial login gets added. For example, the default is to add the role \"user\" "
2112 "to all automatically created users."),
2113 elements
=self
._default
_user
_profile
_elements
,
2117 def _default_user_profile_elements(self
):
2120 if cmk
.is_managed_edition():
2121 import cmk
.gui
.cme
.managed
as managed
2122 elements
+= managed
.customer_choice_element()
2127 title
=_('User roles'),
2128 help=_('Specify the initial roles of an automatically created user.'),
2129 default_value
=['user'],
2130 choices
=self
._list
_roles
,
2134 title
=_('Contact groups'),
2135 help=_('Specify the initial contact groups of an automatically created user.'),
2137 choices
=self
._list
_contactgroups
,
2141 title
=_("Visibility of Hosts/Services"),
2142 label
=_("Only show hosts and services the user is a contact for"),
2143 help=_("Specifiy the initial setting for an automatically created user."),
2144 default_value
=False,
2148 def _list_roles(self
):
2149 roles
= userdb
.load_roles()
2150 return [(i
, r
["alias"]) for i
, r
in roles
.items()]
2152 def _list_contactgroups(self
):
2153 contact_groups
= load_contact_group_information()
2154 entries
= [(c
, g
['alias']) for c
, g
in contact_groups
.items()]
2155 return sorted(entries
)
2158 @config_variable_registry.register
2159 class ConfigVariableSaveUserAccessTimes(ConfigVariable
):
2161 return ConfigVariableGroupUserManagement
2164 return ConfigDomainGUI
2167 return "save_user_access_times"
2169 def valuespec(self
):
2171 title
=_("Save last access times of users"),
2172 label
=_("Save the time of the latest user activity"),
2173 help=_("When enabled, the time of the last access is stored for each user. The last "
2174 "activity is shown on the users page."),
2179 # .--Check_MK------------------------------------------------------------.
2180 # | ____ _ _ __ __ _ __ |
2181 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
2182 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
2183 # | | |___| | | | __/ (__| < | | | | . \ |
2184 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
2186 # +----------------------------------------------------------------------+
2187 # | Operation mode of Check_MK |
2188 # '----------------------------------------------------------------------'
2191 @config_variable_group_registry.register
2192 class ConfigVariableGroupCheckExecution(ConfigVariableGroup
):
2194 return _("Execution of checks")
2196 def sort_index(self
):
2200 @config_variable_registry.register
2201 class ConfigVariableUseNewDescriptionsFor(ConfigVariable
):
2203 return ConfigVariableGroupCheckExecution
2206 return ConfigDomainCore
2209 return "use_new_descriptions_for"
2211 def valuespec(self
):
2213 title
=_("Use new service descriptions"),
2215 "In order to make Check_MK more consistent, "
2216 "the descriptions of several services have been renamed in newer "
2217 "Check_MK versions. One example is the filesystem services that have "
2218 "been renamed from <tt>fs_</tt> into <tt>Filesystem</tt>. But since renaming "
2219 "of existing services has many implications - including existing rules, performance "
2220 "data and availability history - these renamings are disabled per default for "
2221 "existing installations. Here you can switch to the new descriptions for "
2222 "selected check types"),
2224 ("df", _("Used space in filesystems")),
2225 ("df_netapp", _("NetApp Filers: Used Space in Filesystems")),
2226 ("df_netapp32", _("NetApp Filers: Used space in Filesystem Using 32-Bit Counters")),
2227 ("esx_vsphere_datastores", _("VMWare ESX host systems: Used space")),
2228 ("hr_fs", _("Used space in filesystems via SNMP")),
2229 ("vms_diskstat.df", _("Disk space on OpenVMS")),
2230 ("zfsget", _("Used space in ZFS pools and filesystems")),
2231 ("ps", _("State and Count of Processes")),
2232 ("ps.perf", _("State and Count of Processes (with additional performance data)")),
2233 ("wmic_process", _("Resource consumption of windows processes")),
2234 ("services", _("Windows Services")),
2235 ("logwatch", _("Check logfiles for relevant new messages")),
2236 ("logwatch.groups", _("Check logfile groups")),
2237 ("cmk-inventory", _("Monitor hosts for unchecked services (Check_MK Discovery)")),
2238 ("hyperv_vms", _("Hyper-V Server: State of VMs")),
2239 ("ibm_svc_mdiskgrp",
2240 _("IBM SVC / Storwize V3700 / V7000: Status and Usage of MDisksGrps")),
2241 ("ibm_svc_system", _("IBM SVC / V7000: System Info")),
2242 ("ibm_svc_systemstats.diskio",
2243 _("IBM SVC / V7000: Disk Throughput for Drives/MDisks/VDisks in Total")),
2244 ("ibm_svc_systemstats.iops",
2245 _("IBM SVC / V7000: IO operations/sec for Drives/MDisks/VDisks in Total")),
2246 ("ibm_svc_systemstats.disk_latency",
2247 _("IBM SVC / V7000: Latency for Drives/MDisks/VDisks in Total")),
2248 ("ibm_svc_systemstats.cache", _("IBM SVC / V7000: Cache Usage in Total")),
2249 ("casa_cpu_temp", _("Casa module: CPU temperature")),
2250 ("cmciii.temp", _("Rittal CMC-III Units: Temperatures")),
2251 ("cmciii.psm_current", _("Rittal CMC-III Units: Current")),
2252 ("cmciii_lcp_airin", _("Rittal CMC-III LCP: Air In and Temperature")),
2253 ("cmciii_lcp_airout", _("Rittal CMC-III LCP: Air Out Temperature")),
2254 ("cmciii_lcp_water", _("Rittal CMC-III LCP: Water In/Out Temperature")),
2255 ("etherbox.temp", _("Etherbox / MessPC: Sensor Temperature")),
2256 ("liebert_bat_temp", _("Liebert UPS Device: Temperature sensor")),
2257 ("nvidia.temp", _("Temperatures of NVIDIA graphics card")),
2258 ("ups_bat_temp", _("Generic UPS Device: Temperature sensor")),
2259 ("innovaphone_temp", _("Innovaphone Gateway: Current Temperature")),
2260 ("enterasys_temp", _("Enterasys Switch: Temperature")),
2261 ("raritan_emx", _("Raritan EMX Rack: Temperature")),
2262 ("raritan_pdu_inlet", _("Raritan PDU: Input Phases")),
2263 ("mknotifyd", _("Notification Spooler")),
2264 ("mknotifyd.connection", _("Notification Spooler Connection")),
2265 ("postfix_mailq", _("Postfix: Mail Queue")),
2266 ("nullmailer_mailq", _("Nullmailer: Mail Queue")),
2267 ("barracuda_mailqueues", _("Barracuda: Mail Queue")),
2268 ("qmail_stats", _("Qmail: Mail Queue")),
2269 ("http", _("Check HTTP: Use HTTPS instead of HTTP for SSL/TLS connections")),
2270 ("mssql_backup", _("MSSQL Backup")),
2271 ("mssql_counters.cache_hits", _("MSSQL Cache Hits")),
2272 ("mssql_counters.transactions", _("MSSQL Transactions")),
2273 ("mssql_counters.locks", _("MSSQL Locks")),
2274 ("mssql_counters.sqlstats", _("MSSQL SQL Stats")),
2275 ("mssql_counters.pageactivity", _("MSSQL Page Activity")),
2276 ("mssql_counters.locks_per_batch", _("MSSQL Locks per Batch")),
2277 ("mssql_counters.file_sizes", _("MSSQL File Sizes")),
2278 ("mssql_databases", _("MSSQL Database")),
2279 ("mssql_datafiles", _("MSSQL Datafile")),
2280 ("mssql_tablespaces", _("MSSQL Tablespace")),
2281 ("mssql_transactionlogs", _("MSSQL Transactionlog")),
2282 ("mssql_versions", _("MSSQL Version")),
2283 ("mssql_blocked_sessions", _("MSSQL Blocked Sessions")),
2285 render_orientation
="vertical",
2289 @config_variable_registry.register
2290 class ConfigVariableTCPConnectTimeout(ConfigVariable
):
2292 return ConfigVariableGroupCheckExecution
2295 return ConfigDomainCore
2298 return "tcp_connect_timeout"
2300 def valuespec(self
):
2302 title
=_("Agent TCP connect timeout"),
2304 "Timeout for TCP connect to agent in seconds. If the connection "
2305 "to the agent cannot be established within this time, it is considered to be unreachable. "
2306 "Note: This does <b>not</b> limit the time the agent needs to "
2307 "generate its output."),
2313 @config_variable_registry.register
2314 class ConfigVariableSimulationMode(ConfigVariable
):
2316 return ConfigVariableGroupCheckExecution
2319 return ConfigDomainCore
2322 return "simulation_mode"
2324 def valuespec(self
):
2326 title
=_("Simulation mode"),
2327 label
=_("Run in simulation mode"),
2328 help=_("This boolean variable allows you to bring check_mk into a dry run mode. "
2329 "No hosts will be contacted, no DNS lookups will take place and data is read "
2330 "from cache files that have been created during normal operation or have "
2331 "been copied here from another monitoring site."),
2335 @config_variable_registry.register
2336 class ConfigVariableRestartLocking(ConfigVariable
):
2338 return ConfigVariableGroupCheckExecution
2341 return ConfigDomainCore
2344 return "restart_locking"
2346 def valuespec(self
):
2347 return DropdownChoice(
2348 title
=_("Simultanous activation of changes"),
2349 help=_("When two users simultanously try to activate the changes then "
2350 "you can decide to abort with an error (default) or have the requests "
2351 "serialized. It is also possible - but not recommended - to turn "
2352 "off locking altogether."),
2354 ('abort', _("Abort with an error")),
2355 ('wait', _("Wait until the other has finished")),
2356 (None, _("Disable locking")),
2361 @config_variable_registry.register
2362 class ConfigVariableAgentSimulator(ConfigVariable
):
2364 return ConfigVariableGroupCheckExecution
2367 return ConfigDomainCore
2370 return "agent_simulator"
2372 def valuespec(self
):
2374 title
=_("SNMP Agent Simulator"),
2375 label
=_("Process stored SNMP walks with agent simulator"),
2376 help=_("When using stored SNMP walks you can place inline code generating "
2377 "dynamic simulation data. This feature can be activated here. There "
2378 "is a big chance that you will never need this feature..."),
2382 @config_variable_registry.register
2383 class ConfigVariableDelayPrecompile(ConfigVariable
):
2385 return ConfigVariableGroupCheckExecution
2388 return ConfigDomainCore
2391 return "delay_precompile"
2393 def valuespec(self
):
2395 title
=_("Delay precompiling of host checks"),
2396 label
=_("delay precompiling"),
2398 "If you enable this option, then Check_MK will not directly Python-bytecompile "
2399 "all host checks when activating the configuration and restarting Nagios. "
2400 "Instead it will delay this to the first "
2401 "time the host is actually checked being by Nagios.<p>This reduces the time needed "
2402 "for the operation, but on the other hand will lead to a slightly higher load "
2403 "of Nagios for the first couple of minutes after the restart. "),
2407 @config_variable_registry.register
2408 class ConfigVariableClusterMaxCachefileAge(ConfigVariable
):
2410 return ConfigVariableGroupCheckExecution
2413 return ConfigDomainCore
2416 return "cluster_max_cachefile_age"
2418 def valuespec(self
):
2420 title
=_("Maximum cache file age for clusters"),
2422 help=_("The number of seconds a cache file may be old if check_mk should "
2423 "use it instead of getting information from the target hosts while "
2424 "checking a cluster. Per default this is enabled and set to 90 seconds. "
2425 "If your check cycle is set to a larger value than one minute then "
2426 "you should increase this accordingly."),
2430 @config_variable_registry.register
2431 class ConfigVariablePiggybackMaxCachefileAge(ConfigVariable
):
2433 return ConfigVariableGroupCheckExecution
2436 return ConfigDomainCore
2439 return "piggyback_max_cachefile_age"
2441 def valuespec(self
):
2443 title
=_("Maximum age for piggyback files"),
2445 "The maximum age for piggy back data from another host to be valid for monitoring. "
2446 "Older files are deleted before processing them. Please make sure that this age is "
2447 "at least as large as you normal check interval for piggy hosts."),
2451 @config_variable_registry.register
2452 class ConfigVariableCheckMKPerfdataWithTimes(ConfigVariable
):
2454 return ConfigVariableGroupCheckExecution
2457 return ConfigDomainCore
2460 return "check_mk_perfdata_with_times"
2462 def valuespec(self
):
2464 title
=_("Check_MK with times performance data"),
2465 label
=_("Return process times within performance data"),
2466 help=_("Enabling this option results in additional performance data "
2467 "for the Check_MK output, giving information regarding the process times. "
2468 "It provides the following fields: user_time, system_time, children_user_time "
2469 "and children_system_time"),
2473 @config_variable_registry.register
2474 class ConfigVariableUseDNSCache(ConfigVariable
):
2476 return ConfigVariableGroupCheckExecution
2479 return ConfigDomainCore
2482 return "use_dns_cache"
2484 def valuespec(self
):
2486 title
=_("Use DNS lookup cache"),
2487 label
=_("Prevent DNS lookups by use of a cache file"),
2489 "When this option is enabled (which is the default), then Check_MK tries to "
2490 "prevent IP address lookups during the configuration generation. This can speed "
2491 "up this process greatly when you have a larger number of hosts. The cache is stored "
2492 "in a simple file. Note: when the cache is enabled then changes of the IP address "
2493 "of a host in your name server will not be detected immediately. If you need an "
2494 "immediate update then simply disable the cache once, activate the changes and "
2495 "enabled it again. OMD based installations automatically update the cache once "
2500 @config_variable_registry.register
2501 class ConfigVariableUseInlineSNMP(ConfigVariable
):
2503 return ConfigVariableGroupCheckExecution
2506 return ConfigDomainCore
2509 return "use_inline_snmp"
2511 def valuespec(self
):
2513 title
=_("Use Inline SNMP"),
2514 label
=_("Enable inline SNMP (directly use net-snmp libraries)"),
2516 "By default Check_MK uses command line calls of Net-SNMP tools like snmpget or "
2517 "snmpwalk to gather SNMP information. For each request a new command line "
2518 "program is being executed. It is now possible to use the inline SNMP implementation "
2519 "which calls the net-snmp libraries directly via its python bindings. This "
2520 "should increase the performance of SNMP checks in a significant way. The inline "
2521 "SNMP mode is a feature which improves the performance for large installations and "
2522 "only available via our subscription."),
2526 @config_variable_registry.register
2527 class ConfigVariableRecordInlineSNMPStats(ConfigVariable
):
2529 return ConfigVariableGroupCheckExecution
2532 return ConfigDomainCore
2535 return "record_inline_snmp_stats"
2537 def valuespec(self
):
2539 title
=_("Record statistics of Inline SNMP"),
2540 label
=_("Enable recording of Inline SNMP statistics"),
2542 "When you have enabled Inline SNMP, you can use this flag to enable recording of "
2543 "some performance related values. The recorded values are stored in a single file "
2544 "at <tt>var/check_mk/snmp.stats</tt>.<br><br>"
2545 "<i>Please note:</i> Only enable this for a short period, because it will "
2546 "decrease the performance of your monitoring."),
2550 @config_variable_registry.register
2551 class ConfigVariableHTTPProxies(ConfigVariable
):
2553 return ConfigVariableGroupCheckExecution
2556 return ConfigDomainCore
2559 return "http_proxies"
2561 def valuespec(self
):
2565 title
=_("HTTP proxy"),
2569 title
=_("Unique ID"),
2571 "The ID must be a unique text. It will be used as an internal key "
2572 "when objects refer to this object."),
2578 help=_("The title of the %s. It will be used as display name.") %
2583 ("proxy_url", HTTPProxyInput()),
2587 title
=_("HTTP proxies"),
2589 totext
=_("%d HTTP proxy servers configured"),
2590 help=_("Use this option to configure one or several proxy servers that can then be "
2591 "used in different places to establish connections to services using these "
2593 validate
=self
._validate
_proxies
,
2595 forth
=lambda v
: v
.values(),
2596 back
=lambda v
: {p
["ident"]: p
for p
in v
},
2599 def _validate_proxies(self
, value
, varprefix
):
2600 seen_idents
, seen_titles
= [], []
2601 for http_proxy
in value
:
2602 if http_proxy
["ident"] in seen_idents
:
2605 _("Found multiple proxies using the ID '%s'") % http_proxy
["ident"])
2606 seen_idents
.append(http_proxy
["ident"])
2608 if http_proxy
["title"] in seen_titles
:
2611 _("Found multiple proxies using the title '%s'") % http_proxy
["title"])
2612 seen_titles
.append(http_proxy
["title"])
2615 @config_variable_group_registry.register
2616 class ConfigVariableGroupServiceDiscovery(ConfigVariableGroup
):
2618 return _("Service discovery")
2620 def sort_index(self
):
2624 @config_variable_registry.register
2625 class ConfigVariableInventoryCheckInterval(ConfigVariable
):
2627 return ConfigVariableGroupServiceDiscovery
2630 return ConfigDomainCore
2633 return "inventory_check_interval"
2635 def valuespec(self
):
2638 title
=_("Perform service discovery check every"),
2642 title
=_("Enable regular service discovery checks (deprecated)"),
2643 help=_("If enabled, Check_MK will create one additional service per host "
2644 "that does a regular check, if the service discovery would find new services "
2645 "currently un-monitored. <b>Note:</b> This option is deprecated and has been "
2646 "replaced by the rule set <a href='%s'>Periodic Service Discovery</a>, "
2647 "which allows a per-host configuration and additional features such as "
2648 "automatic rediscovery. Rules in that rule set will override the global "
2649 "settings done here.") % "wato.py?mode=edit_ruleset&varname=periodic_discovery",
2653 @config_variable_registry.register
2654 class ConfigVariableInventoryCheckSeverity(ConfigVariable
):
2656 return ConfigVariableGroupServiceDiscovery
2659 return ConfigDomainCore
2662 return "inventory_check_severity"
2664 def valuespec(self
):
2665 return DropdownChoice(
2666 title
=_("Severity of failed service discovery check"),
2667 help=_("Please select which alarm state the service discovery check services "
2668 "shall assume in case that un-monitored services are found."),
2670 (0, _("OK - do not alert, just display")),
2678 @config_variable_registry.register
2679 class ConfigVariableInventoryCheckDoScan(ConfigVariable
):
2681 return ConfigVariableGroupServiceDiscovery
2684 return ConfigDomainCore
2687 return "inventory_check_do_scan"
2689 def valuespec(self
):
2690 return DropdownChoice(
2691 title
=_("Service discovery check for SNMP devices"),
2693 (True, _("Perform full SNMP scan always, detect new check types")),
2694 (False, _("Just rely on existing check files, detect new items only")),
2699 @config_variable_registry.register
2700 class ConfigVariableInventoryCheckAutotrigger(ConfigVariable
):
2702 return ConfigVariableGroupServiceDiscovery
2705 return ConfigDomainCore
2708 return "inventory_check_autotrigger"
2710 def valuespec(self
):
2712 title
=_("Service discovery triggers service discovery check"),
2714 "Automatically schedule service discovery check after service configuration changes"
2716 help=_("When this option is enabled then after each change of the service "
2717 "configuration of a host via WATO - may it be via manual changes or a bulk "
2718 "discovery - the service discovery check is automatically rescheduled in order "
2719 "to reflect the new service state correctly immediately."),
2724 # .--Rulesets------------------------------------------------------------.
2726 # | | _ \ _ _| | ___ ___ ___| |_ ___ |
2727 # | | |_) | | | | |/ _ \/ __|/ _ \ __/ __| |
2728 # | | _ <| |_| | | __/\__ \ __/ |_\__ \ |
2729 # | |_| \_\\__,_|_|\___||___/\___|\__|___/ |
2731 # +----------------------------------------------------------------------+
2732 # | Rulesets for hosts and services except check parameter rules. |
2733 # '----------------------------------------------------------------------'
2736 @rulespec_group_registry.register
2737 class RulespecGroupGrouping(RulespecGroup
):
2744 return _("Grouping")
2748 return _("Assignment of host & services to host, service and contacts groups.")
2751 @rulespec_registry.register
2752 class RulespecHostGroups(HostRulespec
):
2755 return RulespecGroupGrouping
2759 return "host_groups"
2762 def match_type(self
):
2766 def valuespec(self
):
2767 return HostGroupSelection(
2768 title
=_("Assignment of hosts to host groups"),
2769 help=_("Hosts can be grouped together into host groups. The most common use case "
2770 "is to put hosts which belong together in a host group to make it possible "
2771 "to get them listed together in the status GUI."),
2775 @rulespec_registry.register
2776 class RulespecServiceGroups(ServiceRulespec
):
2779 return RulespecGroupGrouping
2783 return "service_groups"
2786 def match_type(self
):
2790 def item_type(self
):
2794 def valuespec(self
):
2795 return ServiceGroupSelection(title
=_("Assignment of services to service groups"),)
2798 @rulespec_registry.register
2799 class RulespecHostContactgroups(HostRulespec
):
2802 return RulespecGroupGrouping
2806 return "host_contactgroups"
2809 def match_type(self
):
2813 def valuespec(self
):
2814 return ContactGroupSelection(title
=_("Assignment of hosts to contact groups"),)
2817 @rulespec_registry.register
2818 class RulespecServiceContactgroups(ServiceRulespec
):
2821 return RulespecGroupGrouping
2825 return "service_contactgroups"
2828 def match_type(self
):
2832 def item_type(self
):
2836 def valuespec(self
):
2837 return ContactGroupSelection(title
=_("Assignment of services to contact groups"),)
2840 @rulespec_group_registry.register
2841 class RulespecGroupMonitoringConfiguration(RulespecGroup
):
2848 return _("Monitoring Configuration")
2853 "Intervals for checking, retries, clustering, configuration for inventory and similar")
2856 @rulespec_group_registry.register
2857 class RulespecGroupMonitoringConfigurationServiceChecks(RulespecSubGroup
):
2859 def main_group(self
):
2860 return RulespecGroupMonitoringConfiguration
2863 def sub_group_name(self
):
2864 return "service_checks"
2868 return _("Service Checks")
2871 @rulespec_registry.register
2872 class RulespecExtraServiceConfMaxCheckAttempts(ServiceRulespec
):
2875 return RulespecGroupMonitoringConfigurationServiceChecks
2879 return "extra_service_conf:max_check_attempts"
2882 def item_type(self
):
2886 def valuespec(self
):
2888 title
=_("Maximum number of check attempts for service"),
2889 help=_("The maximum number of failed checks until a service problem state will "
2890 "be considered as <u>hard</u>. Only hard state trigger notifications. "),
2895 @rulespec_registry.register
2896 class RulespecExtraServiceConfCheckInterval(ServiceRulespec
):
2899 return RulespecGroupMonitoringConfigurationServiceChecks
2903 return "extra_service_conf:check_interval"
2906 def item_type(self
):
2910 def valuespec(self
):
2912 Age(minvalue
=1, default_value
=60),
2913 forth
=lambda v
: int(v
* 60),
2914 back
=lambda v
: float(v
) / 60.0,
2915 title
=_("Normal check interval for service checks"),
2916 help=_("Check_MK usually uses an interval of one minute for the active Check_MK "
2917 "check and for legacy checks. Here you can specify a larger interval. Please "
2918 "note, that this setting only applies to active checks (those with the "
2919 "reschedule button). If you want to change the check interval of "
2920 "the Check_MK service only, specify <tt><b>Check_MK$</b></tt> in the list "
2925 @rulespec_registry.register
2926 class RulespecExtraServiceConfRetryInterval(ServiceRulespec
):
2929 return RulespecGroupMonitoringConfigurationServiceChecks
2933 return "extra_service_conf:retry_interval"
2936 def item_type(self
):
2940 def valuespec(self
):
2942 Age(minvalue
=1, default_value
=60),
2943 forth
=lambda v
: int(v
* 60),
2944 back
=lambda v
: float(v
) / 60.0,
2945 title
=_("Retry check interval for service checks"),
2946 help=_("This setting is relevant if you have set the maximum number of check "
2947 "attempts to a number greater than one. In case a service check is not OK "
2948 "and the maximum number of check attempts is not yet reached, it will be "
2949 "rescheduled with this interval. The retry interval is usually set to a smaller "
2950 "value than the normal interval.<br><br>This setting only applies to "
2955 @rulespec_registry.register
2956 class RulespecExtraServiceConfCheckPeriod(ServiceRulespec
):
2959 return RulespecGroupMonitoringConfigurationServiceChecks
2963 return "extra_service_conf:check_period"
2966 def item_type(self
):
2970 def valuespec(self
):
2971 return TimeperiodSelection(
2972 title
=_("Check period for active services"),
2973 help=_("If you specify a notification period for a service then active checks "
2974 "of that service will only be done in that period. Please note, that the "
2975 "checks driven by Check_MK are passive checks and are not affected by this "
2976 "rule. You can use the rule for the active Check_MK check, however."),
2980 @rulespec_registry.register
2981 class RulespecCheckPeriods(ServiceRulespec
):
2984 return RulespecGroupMonitoringConfigurationServiceChecks
2988 return "check_periods"
2991 def item_type(self
):
2995 def valuespec(self
):
2996 return TimeperiodSelection(
2997 title
=_("Check period for passive Check_MK services"),
2998 help=_("If you specify a notification period for a Check_MK service then "
2999 "results will be processed only within this period."),
3003 @rulespec_registry.register
3004 class RulespecExtraServiceConfProcessPerfData(ServiceRulespec
):
3007 return RulespecGroupMonitoringConfigurationServiceChecks
3011 return "extra_service_conf:process_perf_data"
3014 def item_type(self
):
3018 def valuespec(self
):
3019 return DropdownChoice(
3020 title
=_("Enable/disable processing of perfdata for services"),
3021 help=_("This setting allows you to disable the processing of perfdata for a "
3022 "service completely."),
3023 choices
=[("1", _("Enable processing of perfdata")),
3024 ("0", _("Disable processing of perfdata"))],
3028 @rulespec_registry.register
3029 class RulespecExtraServiceConfPassiveChecksEnabled(ServiceRulespec
):
3032 return RulespecGroupMonitoringConfigurationServiceChecks
3036 return "extra_service_conf:passive_checks_enabled"
3039 def item_type(self
):
3043 def valuespec(self
):
3044 return DropdownChoice(
3045 title
=_("Enable/disable passive checks for services"),
3047 "This setting allows you to disable the processing of passiv check results for a "
3049 choices
=[("1", _("Enable processing of passive check results")),
3050 ("0", _("Disable processing of passive check results"))],
3054 @rulespec_registry.register
3055 class RulespecExtraServiceConfActiveChecksEnabled(ServiceRulespec
):
3058 return RulespecGroupMonitoringConfigurationServiceChecks
3062 return "extra_service_conf:active_checks_enabled"
3065 def item_type(self
):
3069 def valuespec(self
):
3070 return DropdownChoice(
3071 title
=_("Enable/disable active checks for services"),
3072 help=_("This setting allows you to disable or enable "
3073 "active checks for a service."),
3074 choices
=[("1", _("Enable active checks")), ("0", _("Disable active checks"))],
3078 @rulespec_group_registry.register
3079 class RulespecGroupMonitoringConfigurationHostChecks(RulespecSubGroup
):
3081 def main_group(self
):
3082 return RulespecGroupMonitoringConfiguration
3085 def sub_group_name(self
):
3086 return "host_checks"
3090 return _("Host Checks")
3093 @rulespec_registry.register
3094 class RulespecExtraHostConfMaxCheckAttempts(HostRulespec
):
3097 return RulespecGroupMonitoringConfigurationHostChecks
3101 return "extra_host_conf:max_check_attempts"
3104 def valuespec(self
):
3106 title
=_("Maximum number of check attempts for host"),
3107 help=_("The maximum number of failed host checks until the host will be considered "
3108 "in a hard down state"),
3113 @rulespec_registry.register
3114 class RulespecExtraHostConfCheckInterval(HostRulespec
):
3117 return RulespecGroupMonitoringConfigurationHostChecks
3121 return "extra_host_conf:check_interval"
3124 def valuespec(self
):
3126 Age(minvalue
=1, default_value
=60),
3127 forth
=lambda v
: int(v
* 60),
3128 back
=lambda v
: float(v
) / 60.0,
3129 title
=_("Normal check interval for host checks"),
3131 _("The default interval is set to 6 seconds for smart ping and one minute for all other. Here you can specify a larger "
3132 "interval. The host is contacted in this interval on a regular base. The host "
3133 "check is also being executed when a problematic service state is detected to check "
3134 "wether or not the service problem is resulting from a host problem."),
3138 @rulespec_registry.register
3139 class RulespecExtraHostConfRetryInterval(HostRulespec
):
3142 return RulespecGroupMonitoringConfigurationHostChecks
3146 return "extra_host_conf:retry_interval"
3149 def valuespec(self
):
3151 Age(minvalue
=1, default_value
=60),
3152 forth
=lambda v
: int(v
* 60),
3153 back
=lambda v
: float(v
) / 60.0,
3154 title
=_("Retry check interval for host checks"),
3156 "This setting is relevant if you have set the maximum number of check "
3157 "attempts to a number greater than one. In case a host check is not UP "
3158 "and the maximum number of check attempts is not yet reached, it will be "
3159 "rescheduled with this interval. The retry interval is usually set to a smaller "
3160 "value than the normal interval. The default is 6 seconds for smart ping and 60 seconds for all other."
3165 @rulespec_registry.register
3166 class RulespecExtraHostConfCheckPeriod(HostRulespec
):
3169 return RulespecGroupMonitoringConfigurationHostChecks
3173 return "extra_host_conf:check_period"
3176 def valuespec(self
):
3177 return TimeperiodSelection(
3178 title
=_("Check period for hosts"),
3179 help=_("If you specify a check period for a host then active checks of that "
3180 "host will only take place within that period. In the rest of the time "
3181 "the state of the host will stay at its last status."),
3185 @rulespec_registry.register
3186 class RulespecHostCheckCommands(HostRulespec
):
3189 return RulespecGroupMonitoringConfigurationHostChecks
3193 return "host_check_commands"
3196 def valuespec(self
):
3197 return CascadingDropdown(
3198 title
=_("Host Check Command"),
3200 "Usually Check_MK uses a series of PING (ICMP echo request) in order to determine "
3201 "whether a host is up. In some cases this is not possible, however. With this rule "
3202 "you can specify an alternative way of determining the host's state.") + _(
3203 "The option to use a custom command can only be configured with the permission "
3204 "\"Can add or modify executables\"."),
3205 choices
=self
._host
_check
_command
_choices
,
3206 default_value
="ping",
3207 orientation
="horizontal",
3210 def _host_check_command_choices(self
):
3211 if config
.user
.may('wato.add_or_modify_executables'):
3213 ("custom", _("Use a custom check plugin..."), PluginCommandLine()),
3219 ("ping", _("PING (active check with ICMP echo request)")),
3220 ("smart", _("Smart PING (only with Check_MK Micro Core)")),
3221 ("tcp", _("TCP Connect"),
3222 Integer(label
=_("to port:"), minvalue
=1, maxvalue
=65535, default_value
=80)),
3223 ("ok", _("Always assume host to be up")),
3224 ("agent", _("Use the status of the Check_MK Agent")),
3225 ("service", _("Use the status of the service..."),
3230 help=_("You can use the macro <tt>$HOSTNAME$</tt> here. It will be replaced "
3231 "with the name of the current host."),
3236 @rulespec_group_registry.register
3237 class RulespecGroupMonitoringConfigurationNotifications(RulespecSubGroup
):
3239 def main_group(self
):
3240 return RulespecGroupMonitoringConfiguration
3243 def sub_group_name(self
):
3244 return "notifications"
3248 return _("Notifications")
3251 @rulespec_registry.register
3252 class RulespecExtraHostConfNotificationsEnabled(HostRulespec
):
3255 return RulespecGroupMonitoringConfigurationNotifications
3259 return "extra_host_conf:notifications_enabled"
3262 def valuespec(self
):
3263 return DropdownChoice(
3264 title
=_("Enable/disable notifications for hosts"),
3265 help=_("This setting allows you to disable notifications about problems of a "
3266 "host completely. Per default all notifications are enabled. Sometimes "
3267 "it is more convenient to just disable notifications then to remove a "
3268 "host completely from the monitoring. Note: this setting has no effect "
3269 "on the notifications of service problems of a host."),
3271 ("1", _("Enable host notifications")),
3272 ("0", _("Disable host notifications")),
3277 @rulespec_registry.register
3278 class RulespecExtraServiceConfNotificationsEnabled(ServiceRulespec
):
3281 return RulespecGroupMonitoringConfigurationNotifications
3285 return "extra_service_conf:notifications_enabled"
3288 def item_type(self
):
3292 def valuespec(self
):
3293 return DropdownChoice(
3294 title
=_("Enable/disable notifications for services"),
3295 help=_("This setting allows you to disable notifications about problems of a "
3296 "service completely. Per default all notifications are enabled."),
3298 ("1", _("Enable service notifications")),
3299 ("0", _("Disable service notifications")),
3304 @rulespec_registry.register
3305 class RulespecExtraHostConfNotificationOptions(HostRulespec
):
3308 return RulespecGroupMonitoringConfigurationNotifications
3312 return "extra_host_conf:notification_options"
3315 def valuespec(self
):
3319 ("d", _("Host goes down")),
3320 ("u", _("Host gets unreachble")),
3321 ("r", _("Host goes up again")),
3322 ("f", _("Start or end of flapping state")),
3323 ("s", _("Start or end of a scheduled downtime")),
3325 default_value
=["d", "r", "f", "s"],
3327 title
=_("Notified events for hosts"),
3329 "This ruleset allows you to restrict notifications of host problems to certain "
3330 "states, e.g. only notify on DOWN, but not on UNREACHABLE. Please select the types "
3331 "of events that should initiate notifications. Please note that several other "
3332 "filters must also be passed in order for notifications to finally being sent out."
3334 "Please note: There is a difference between the Microcore and Nagios when you have "
3335 "a host that has no matching rule in this ruleset. In this case the Microcore will "
3336 "not send out UNREACHABLE notifications while the Nagios core would send out "
3337 "UNREACHABLE notifications. To align this behaviour, create a rule matching "
3338 "all your hosts and configure it to either send UNREACHABLE notifications or not."),
3339 forth
=lambda x
: x
!= 'n' and x
.split(",") or [],
3340 back
=lambda x
: ",".join(x
) or "n",
3344 @rulespec_registry.register
3345 class RulespecExtraServiceConfNotificationOptions(ServiceRulespec
):
3348 return RulespecGroupMonitoringConfigurationNotifications
3352 return "extra_service_conf:notification_options"
3355 def item_type(self
):
3359 def valuespec(self
):
3363 ("w", _("Service goes into warning state")),
3364 ("u", _("Service goes into unknown state")),
3365 ("c", _("Service goes into critical state")),
3366 ("r", _("Service recovers to OK")),
3367 ("f", _("Start or end of flapping state")),
3368 ("s", _("Start or end of a scheduled downtime")),
3370 default_value
=["w", "u", "c", "r", "f", "s"],
3372 title
=_("Notified events for services"),
3374 "This ruleset allows you to restrict notifications of service problems to certain "
3375 "states, e.g. only notify on CRIT, but not on WARN. Please select the types "
3376 "of events that should initiate notifications. Please note that several other "
3377 "filters must also be passed in order for notifications to finally being sent out."
3379 forth
=lambda x
: x
!= 'n' and x
.split(",") or [],
3380 back
=lambda x
: ",".join(x
) or "n",
3384 @rulespec_registry.register
3385 class RulespecExtraHostConfNotificationPeriod(HostRulespec
):
3388 return RulespecGroupMonitoringConfigurationNotifications
3392 return "extra_host_conf:notification_period"
3395 def valuespec(self
):
3396 return TimeperiodSelection(
3397 title
=_("Notification period for hosts"),
3398 help=_("If you specify a notification period for a host then notifications "
3399 "about problems of that host (not of its services!) will only be sent "
3400 "if those problems occur within the notification period. Also you can "
3401 "filter out problems in the problems views for objects not being in "
3402 "their notification period (you can think of the notification period "
3403 "as the 'service time')."),
3407 @rulespec_registry.register
3408 class RulespecExtraServiceConfNotificationPeriod(ServiceRulespec
):
3411 return RulespecGroupMonitoringConfigurationNotifications
3415 return "extra_service_conf:notification_period"
3418 def item_type(self
):
3422 def valuespec(self
):
3423 return TimeperiodSelection(
3424 title
=_("Notification period for services"),
3425 help=_("If you specify a notification period for a service then notifications "
3426 "about that service will only be sent "
3427 "if those problems occur within the notification period. Also you can "
3428 "filter out problems in the problems views for objects not being in "
3429 "their notification period (you can think of the notification period "
3430 "as the 'service time')."),
3434 def transform_float_minutes_to_age(float_minutes
):
3435 return int(float_minutes
* 60)
3438 def transform_age_to_float_minutes(age
):
3439 return float(age
) / 60.0
3442 @rulespec_registry.register
3443 class RulespecExtraHostConfFirstNotificationDelay(HostRulespec
):
3446 return RulespecGroupMonitoringConfigurationNotifications
3450 return "extra_host_conf:first_notification_delay"
3453 def factory_default(self
):
3457 def valuespec(self
):
3463 title
=_("Delay host notifications"),
3464 help=_("This setting delays notifications about host problems by the "
3465 "specified amount of time. If the host is up again within that "
3466 "time, no notification will be sent out."),
3468 forth
=transform_float_minutes_to_age
,
3469 back
=transform_age_to_float_minutes
,
3473 @rulespec_registry.register
3474 class RulespecExtraServiceConfFirstNotificationDelay(ServiceRulespec
):
3477 return RulespecGroupMonitoringConfigurationNotifications
3481 return "extra_service_conf:first_notification_delay"
3484 def item_type(self
):
3488 def factory_default(self
):
3492 def valuespec(self
):
3499 title
=_("Delay service notifications"),
3500 help=_("This setting delays notifications about service problems by the "
3501 "specified amount of time. If the service is OK again within that "
3502 "time, no notification will be sent out."),
3504 forth
=transform_float_minutes_to_age
,
3505 back
=transform_age_to_float_minutes
,
3509 @rulespec_registry.register
3510 class RulespecExtraHostConfNotificationInterval(HostRulespec
):
3513 return RulespecGroupMonitoringConfigurationNotifications
3517 return "extra_host_conf:notification_interval"
3520 def valuespec(self
):
3525 default_value
=120.0,
3526 label
=_("Interval:"),
3531 title
=_("Periodic notifications during host problems"),
3532 help=_("If you enable periodic notifications, then during a problem state "
3533 "of the host notifications will be sent out in regular intervals "
3534 "until the problem is acknowledged."),
3535 label
=_("Enable periodic notifications"),
3536 none_label
=_("disabled"),
3541 @rulespec_registry.register
3542 class RulespecExtraServiceConfNotificationInterval(ServiceRulespec
):
3545 return RulespecGroupMonitoringConfigurationNotifications
3549 return "extra_service_conf:notification_interval"
3552 def item_type(self
):
3556 def valuespec(self
):
3559 Float(minvalue
=0.05, default_value
=120.0, label
=_("Interval:"), unit
=_("minutes")),
3562 title
=_("Periodic notifications during service problems"),
3563 help=_("If you enable periodic notifications, then during a problem state "
3564 "of the service notifications will be sent out in regular intervals "
3565 "until the problem is acknowledged."),
3566 label
=_("Enable periodic notifications"),
3567 none_label
=_("disabled"),
3572 @rulespec_registry.register
3573 class RulespecExtraHostConfFlapDetectionEnabled(HostRulespec
):
3576 return RulespecGroupMonitoringConfigurationNotifications
3580 return "extra_host_conf:flap_detection_enabled"
3583 def valuespec(self
):
3584 return DropdownChoice(
3585 title
=_("Enable/disable flapping detection for hosts"),
3586 help=_("This setting allows you to disable the flapping detection for a "
3587 "host completely."),
3589 ("1", _("Enable flap detection")),
3590 ("0", _("Disable flap detection")),
3595 @rulespec_registry.register
3596 class RulespecExtraServiceConfFlapDetectionEnabled(ServiceRulespec
):
3599 return RulespecGroupMonitoringConfigurationNotifications
3603 return "extra_service_conf:flap_detection_enabled"
3606 def item_type(self
):
3610 def valuespec(self
):
3611 return DropdownChoice(
3612 title
=_("Enable/disable flapping detection for services"),
3613 help=_("This setting allows you to disable the flapping detection for a "
3614 "service completely."),
3616 ("1", _("Enable flap detection")),
3617 ("0", _("Disable flap detection")),
3622 @rulespec_registry.register
3623 class RulespecExtraServiceConfNotesUrl(ServiceRulespec
):
3626 return RulespecGroupMonitoringConfigurationNotifications
3630 return "extra_service_conf:notes_url"
3633 def item_type(self
):
3637 def valuespec(self
):
3640 title
=_("Notes URL for Services"),
3641 help=_("With this setting you can set links to documentations "
3642 "for each service"),
3648 @rulespec_registry.register
3649 class RulespecExtraHostConfNotesUrl(HostRulespec
):
3652 return RulespecGroupMonitoringConfigurationNotifications
3656 return "extra_host_conf:notes_url"
3659 def valuespec(self
):
3662 title
=_("Notes URL for Hosts"),
3663 help=_("With this setting you can set links to documentations "
3670 @rulespec_registry.register
3671 class RulespecExtraServiceConfDisplayName(ServiceRulespec
):
3674 return RulespecGroupMonitoringConfigurationNotifications
3678 return "extra_service_conf:display_name"
3681 def item_type(self
):
3685 def valuespec(self
):
3687 title
=_("Alternative display name for Services"),
3688 help=_("This rule set allows you to specify an alternative name "
3689 "to be displayed for certain services. This name is available as "
3690 "a column when creating new views or modifying existing ones. "
3691 "It is always visible in the details view of a service. In the "
3692 "availability reporting there is an option for using that name "
3693 "instead of the normal service description. It does <b>not</b> automatically "
3694 "replace the normal service name in all views.<br><br><b>Note</b>: The "
3695 "purpose of this rule set is to define unique names for several well-known "
3696 "services. It cannot rename services in general."),
3702 @rulespec_group_registry.register
3703 class RulespecGroupMonitoringConfigurationInventoryAndCMK(RulespecSubGroup
):
3705 def main_group(self
):
3706 return RulespecGroupMonitoringConfiguration
3709 def sub_group_name(self
):
3710 return "inventory_and_check_mk_settings"
3714 return _("Inventory and Check_MK settings")
3717 @rulespec_registry.register
3718 class RulespecOnlyHosts(BinaryHostRulespec
):
3721 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3729 return _("Hosts to be monitored")
3733 return _("By adding rules to this ruleset you can define a subset of your hosts "
3734 "to be actually monitored. As long as the rule set is empty "
3735 "all configured hosts will be monitored. As soon as you add at least one "
3736 "rule, only hosts with a matching rule will be monitored.")
3739 def is_optional(self
):
3743 @rulespec_registry.register
3744 class RulespecIgnoredServices(BinaryServiceRulespec
):
3747 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3751 return "ignored_services"
3755 return _("Disabled services")
3759 return _("Services that are declared as <u>disabled</u> by this rule set will not be added "
3760 "to a host during discovery (automatic service detection). Services that already "
3761 "exist will continued to be monitored but be marked as obsolete in the service "
3765 def item_type(self
):
3769 @rulespec_registry.register
3770 class RulespecIgnoredChecks(HostRulespec
):
3773 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3777 return "ignored_checks"
3780 def valuespec(self
):
3781 return CheckTypeSelection(
3782 title
=_("Disabled checks"),
3784 "This ruleset is similar to 'Disabled services', but selects checks to be disabled "
3785 "by their <b>type</b>. This allows you to disable certain technical implementations "
3786 "such as filesystem checks via SNMP on hosts that also have the Check_MK agent "
3791 @rulespec_registry.register
3792 class RulespecClusteredServices(BinaryServiceRulespec
):
3795 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3799 return "clustered_services"
3803 return _("Clustered services")
3807 return _("When you define HA clusters in WATO then you also have to specify which services "
3808 "of a node should be assigned to the cluster and which services to the physical "
3809 "node. This is done by this ruleset. Please note that the rule will be applied to "
3810 "the <i>nodes</i>, not to the cluster.<br><br>Please make sure that you re-"
3811 "inventorize the cluster and the physical nodes after changing this ruleset.")
3814 def item_type(self
):
3818 @rulespec_registry.register
3819 class RulespecPeriodicDiscovery(HostRulespec
):
3822 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3826 return "periodic_discovery"
3829 def valuespec(self
):
3831 title
=_("Periodic service discovery"),
3834 "check_interval": 2 * 60,
3835 "severity_unmonitored": 1,
3836 "severity_vanished": 0,
3837 "inventory_check_do_scan": True,
3842 title
=_("Do not perform periodic service discovery check"),
3843 totext
=_("no discovery check"),
3846 title
=_("Perform periodic service discovery check"),
3848 "If enabled, Check_MK will create one additional service per host "
3849 "that does a periodic check, if the service discovery would find new services "
3850 "that are currently not monitored."),
3854 Age(minvalue
=1, display
=["days", "hours", "minutes"]),
3855 forth
=lambda v
: int(v
* 60),
3856 back
=lambda v
: float(v
) / 60.0,
3857 title
=_("Perform service discovery every"),
3859 ("severity_unmonitored",
3861 title
=_("Severity of unmonitored services"),
3863 "Please select which alarm state the service discovery check services "
3864 "shall assume in case that un-monitored services are found."),
3866 (0, _("OK - do not alert, just display")),
3872 ("severity_vanished",
3874 title
=_("Severity of vanished services"),
3876 _("Please select which alarm state the service discovery check services "
3877 "shall assume in case that non-existing services are being monitored."
3880 (0, _("OK - do not alert, just display")),
3886 ("inventory_check_do_scan",
3888 title
=_("Service discovery check for SNMP devices"),
3890 (True, _("Perform full SNMP scan always, detect new check types")),
3892 _("Just rely on existing check files, detect new items only"))
3894 ("inventory_rediscovery",
3896 title
=_("Automatically update service configuration"),
3898 "If active the check will not only notify about un-monitored services, "
3899 "it will also automatically add/remove them as neccessary."),
3904 choices
=[(0, _("Add unmonitored services")),
3905 (1, _("Remove vanished services")),
3906 (2, _("Add unmonitored & remove vanished services")),
3907 (3, _("Refresh all services (tabula rasa)"))],
3908 orientation
="vertical",
3912 Age(title
=_("Group discovery and activation for up to"),
3914 "A delay can be configured here so that multiple "
3915 "discoveries can be activated in one go. This avoids frequent core "
3916 "restarts in situations with frequent services changes."),
3917 default_value
=15 * 60,
3918 display
=["hours", "minutes"])),
3922 _("Never do discovery or activate changes in the following time ranges"
3924 help=_("This avoids automatic changes during these times so "
3925 "that the automatic system doesn't interfere with "
3930 title
=_("Automatic activation"),
3932 (True, _("Automatically activate changes")),
3933 (False, _("Do not activate changes")),
3937 "Here you can have the changes activated whenever services "
3938 "have been added or removed."),
3940 ("service_whitelist",
3942 title
=_("Activate only services matching"),
3945 _("Set service names or regular expression patterns here to "
3946 "allow only matching services to be activated automatically. "
3947 "If you set both this and \'Don't activate services matching\', "
3948 "both rules have to apply for a service to be activated."),
3950 ("service_blacklist",
3952 title
=_("Don't activate services matching"),
3955 _("Set service names or regular expression patterns here to "
3956 "prevent matching services from being activated automatically. "
3957 "If you set both this and \'Activate only services matching\', "
3958 "both rules have to apply for a service to be activated."),
3961 optional_keys
=["service_whitelist", "service_blacklist"],
3964 optional_keys
=["inventory_rediscovery"],
3969 @rulespec_group_registry.register
3970 class RulespecGroupMonitoringConfigurationVarious(RulespecSubGroup
):
3972 def main_group(self
):
3973 return RulespecGroupMonitoringConfiguration
3976 def sub_group_name(self
):
3984 @rulespec_registry.register
3985 class RulespecClusteredServicesMapping(ServiceRulespec
):
3988 return RulespecGroupMonitoringConfigurationVarious
3992 return "clustered_services_mapping"
3995 def item_type(self
):
3999 def valuespec(self
):
4001 title
=_("Clustered services for overlapping clusters"),
4002 label
=_("Assign services to the following cluster:"),
4003 help=_("It's possible to have clusters that share nodes. You could say that "
4004 "such clusters "overlap". In such a case using the ruleset "
4005 "<i>Clustered services</i> is not sufficient since it would not be clear "
4006 "to which of the several possible clusters a service found on such a shared "
4007 "node should be assigned to. With this ruleset you can assign services and "
4008 "explicitely specify which cluster assign them to."),
4012 @rulespec_registry.register
4013 class RulespecExtraHostConfServicePeriod(HostRulespec
):
4016 return RulespecGroupMonitoringConfigurationVarious
4020 return "extra_host_conf:service_period"
4023 def valuespec(self
):
4024 return TimeperiodSelection(
4025 title
=_("Service period for hosts"),
4027 "When it comes to availability reporting, you might want the report "
4028 "to cover only certain time periods, e.g. only Monday to Friday "
4029 "from 8:00 to 17:00. You can do this by specifying a service period "
4030 "for hosts or services. In the reporting you can then decide to "
4031 "include, exclude or ignore such periods und thus e.g. create a report "
4032 "of the availability just within or without these times. <b>Note</b>: Changes in the "
4033 "actual <i>definition</i> of a time period will only be reflected in "
4034 "times <i>after</i> that change. Selecting a different service period "
4035 "will also be reflected in the past."),
4039 @rulespec_registry.register
4040 class RulespecExtraServiceConfServicePeriod(ServiceRulespec
):
4043 return RulespecGroupMonitoringConfigurationVarious
4047 return "extra_service_conf:service_period"
4050 def item_type(self
):
4054 def valuespec(self
):
4055 return TimeperiodSelection(
4056 title
=_("Service period for services"),
4058 "When it comes to availability reporting, you might want the report "
4059 "to cover only certain time periods, e.g. only Monday to Friday "
4060 "from 8:00 to 17:00. You can do this by specifying a service period "
4061 "for hosts or services. In the reporting you can then decide to "
4062 "include, exclude or ignore such periods und thus e.g. create a report "
4063 "of the availability just within or without these times. <b>Note</b>: Changes in the "
4064 "actual <i>definition</i> of a time period will only be reflected in "
4065 "times <i>after</i> that change. Selecting a different service period "
4066 "will also be reflected in the past."),
4071 # .--User Interface------------------------------------------------------.
4073 # | | | | |___ ___ _ __ |_ _|_ __ | |_ ___ _ __ / _| __ _ ___ ___ |
4074 # | | | | / __|/ _ \ '__| | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \ |
4075 # | | |_| \__ \ __/ | | || | | | || __/ | | _| (_| | (_| __/ |
4076 # | \___/|___/\___|_| |___|_| |_|\__\___|_| |_| \__,_|\___\___| |
4078 # +----------------------------------------------------------------------+
4079 # | User interface specific rule sets |
4080 # '----------------------------------------------------------------------'
4083 @rulespec_group_registry.register
4084 class RulespecGroupUserInterface(RulespecGroup
):
4087 return "user_interface"
4091 return _("User Interface")
4095 return _("Settings concerning the user interface of Check_MK")
4098 @rulespec_registry.register
4099 class RulespecExtraHostConfIconImage(HostRulespec
):
4102 return RulespecGroupUserInterface
4106 return "extra_host_conf:icon_image"
4109 def valuespec(self
):
4112 title
=_("Icon image for hosts in status GUI"),
4113 help=_("You can assign icons to hosts for the status GUI. "
4114 "Put your images into <tt>%s</tt>. ") %
4115 (cmk
.utils
.paths
.omd_root
+ "/local/share/check_mk/web/htdocs/images/icons"),
4117 forth
=lambda v
: v
and (v
.endswith('.png') and v
[:-4]) or v
,
4121 @rulespec_registry.register
4122 class RulespecExtraServiceConfIconImage(ServiceRulespec
):
4125 return RulespecGroupUserInterface
4129 return "extra_service_conf:icon_image"
4132 def item_type(self
):
4136 def valuespec(self
):
4139 title
=_("Icon image for services in status GUI"),
4140 help=_("You can assign icons to services for the status GUI. "
4141 "Put your images into <tt>%s</tt>. ") %
4142 (cmk
.utils
.paths
.omd_root
+ "/local/share/check_mk/web/htdocs/images/icons"),
4144 forth
=lambda v
: v
and (v
.endswith('.png') and v
[:-4]) or v
,
4148 @rulespec_registry.register
4149 class RulespecHostIconsAndActions(HostRulespec
):
4152 return RulespecGroupUserInterface
4156 return "host_icons_and_actions"
4159 def match_type(self
):
4163 def valuespec(self
):
4164 return UserIconOrAction(
4165 title
=_("Custom icons or actions for hosts in status GUI"),
4166 help=_("You can assign icons or actions to hosts for the status GUI."),
4170 @rulespec_registry.register
4171 class RulespecServiceIconsAndActions(ServiceRulespec
):
4174 return RulespecGroupUserInterface
4178 return "service_icons_and_actions"
4181 def match_type(self
):
4185 def item_type(self
):
4189 def valuespec(self
):
4190 return UserIconOrAction(
4191 title
=_("Custom icons or actions for services in status GUI"),
4192 help=_("You can assign icons or actions to services for the status GUI."),
4196 @rulespec_registry.register
4197 class RulespecExtraHostConfEscapePluginOutput(HostRulespec
):
4200 return RulespecGroupUserInterface
4204 return "extra_host_conf:_ESCAPE_PLUGIN_OUTPUT"
4207 def valuespec(self
):
4208 return DropdownChoice(
4209 title
=_("Escape HTML codes in host output"),
4210 help=_("By default, for security reasons, the GUI does not interpret any HTML "
4211 "code received from external sources, like plugin output or log messages. "
4212 "If you are really sure what you are doing and need to have HTML codes, like "
4213 "links rendered, disable this option. Be aware, you might open the way "
4214 "for several injection attacks.") + _(
4215 "This setting can either be set globally or individually for selected hosts "
4216 "or services using the host or service rulesets."),
4218 ("1", _("Escape HTML codes")),
4219 ("0", _("Don't escape HTML codes (insecure)")),
4225 @rulespec_registry.register
4226 class RulespecExtraServiceConfEscapePluginOutput(ServiceRulespec
):
4229 return RulespecGroupUserInterface
4233 return "extra_service_conf:_ESCAPE_PLUGIN_OUTPUT"
4236 def item_type(self
):
4240 def valuespec(self
):
4241 return DropdownChoice(
4242 title
=_("Escape HTML codes in service output"),
4243 help=_("By default, for security reasons, the GUI does not interpret any HTML "
4244 "code received from external sources, like plugin output or log messages. "
4245 "If you are really sure what you are doing and need to have HTML codes, like "
4246 "links rendered, disable this option. Be aware, you might open the way "
4247 "for several injection attacks.") + _(
4248 "This setting can either be set globally or individually for selected hosts "
4249 "or services using the host or service rulesets."),
4251 ("1", _("Escape HTML codes")),
4252 ("0", _("Don't escape HTML codes (insecure)")),
4258 @rulespec_group_registry.register
4259 class RulespecGroupAgent(RulespecGroup
):
4266 return _("Access to Agents")
4270 return _("Settings concerning the connection to the Check_MK and SNMP agents")
4273 @rulespec_group_registry.register
4274 class RulespecGroupAgentGeneralSettings(RulespecSubGroup
):
4276 def main_group(self
):
4277 return RulespecGroupAgent
4280 def sub_group_name(self
):
4281 return "general_settings"
4285 return _("General Settings")
4288 @rulespec_registry.register
4289 class RulespecDyndnsHosts(BinaryHostRulespec
):
4292 return RulespecGroupAgentGeneralSettings
4296 return "dyndns_hosts"
4300 return _("Hosts with dynamic DNS lookup during monitoring")
4304 return _("This ruleset selects host for dynamic DNS lookup during monitoring. Normally the "
4305 "IP addresses of hosts are statically configured or looked up when you activate "
4306 "the changes. In some rare cases DNS lookups must be done each time a host is "
4307 "connected to, e.g. when the IP address of the host is dynamic and can change.")
4310 @rulespec_registry.register
4311 class RulespecPrimaryAddressFamily(HostRulespec
):
4314 return RulespecGroupAgentGeneralSettings
4318 return "primary_address_family"
4321 def valuespec(self
):
4322 return DropdownChoice(
4324 ("ipv4", _("IPv4")),
4325 ("ipv6", _("IPv6")),
4327 title
=_("Primary IP address family of dual-stack hosts"),
4328 help=_("When you configure dual-stack host (IPv4 + IPv6) monitoring in Check_MK, "
4329 "normally IPv4 is used as primary address family to communicate with this "
4330 "host. The other family, IPv6, is just being pinged. You can use this rule "
4331 "to invert this behaviour to use IPv6 as primary address family."),
4335 @rulespec_group_registry.register
4336 class RulespecGroupAgentSNMP(RulespecSubGroup
):
4338 def main_group(self
):
4339 return RulespecGroupAgent
4342 def sub_group_name(self
):
4350 @rulespec_registry.register
4351 class RulespecSnmpCommunities(HostRulespec
):
4354 return RulespecGroupAgentSNMP
4358 return "snmp_communities"
4361 def valuespec(self
):
4362 return SNMPCredentials(
4363 title
=_("SNMP credentials of monitored hosts"),
4365 _("By default Check_MK uses the community \"public\" to contact hosts via SNMP v1/v2. This rule "
4366 "can be used to customize the the credentials to be used when contacting hosts via SNMP."
4371 @rulespec_registry.register
4372 class RulespecManagementBoardConfig(HostRulespec
):
4375 return RulespecGroupAgentSNMP
4379 return "management_board_config"
4382 def valuespec(self
):
4383 return CascadingDropdown(
4384 title
=_("Management board config"),
4386 ("snmp", _("SNMP"), SNMPCredentials()),
4387 ("ipmi", _("IPMI"), IPMIParameters()),
4392 @rulespec_registry.register
4393 class RulespecSnmpCharacterEncodings(HostRulespec
):
4396 return RulespecGroupAgentSNMP
4400 return "snmp_character_encodings"
4403 def valuespec(self
):
4404 return DropdownChoice(
4405 title
=_("Output text encoding settings for SNMP devices"),
4406 help=_("Some devices send texts in non-ASCII characters. Check_MK"
4407 " always assumes UTF-8 encoding. You can declare other "
4408 " other encodings here"),
4410 ("utf-8", _("UTF-8")),
4411 ("latin1", _("latin1")),
4412 ("cp437", _("cp437")),
4417 @rulespec_registry.register
4418 class RulespecBulkwalkHosts(BinaryHostRulespec
):
4421 return RulespecGroupAgentSNMP
4425 return "bulkwalk_hosts"
4429 return _("Bulk walk: Hosts using bulk walk (enforces SNMP v2c)")
4433 return _("Most SNMP hosts support SNMP version 2c. However, Check_MK defaults to version "
4434 "1, in order to support as many devices as possible. Please use this ruleset in "
4435 "order to configure SNMP v2c for as many hosts as possible. That version has two "
4436 "advantages: it supports 64 bit counters, which avoids problems with wrapping "
4437 "counters at too much traffic. And it supports bulk walk, which saves much CPU "
4438 "and network resources. Please be aware, however, that there are some broken "
4439 "devices out there, that support bulk walk but behave very bad when it is used. "
4440 "When you want to enable v2c while not using bulk walk, please use the rule set "
4441 "snmpv2c_hosts instead.")
4444 @rulespec_registry.register
4445 class RulespecSnmpBulkSize(HostRulespec
):
4448 return RulespecGroupAgentSNMP
4452 return "snmp_bulk_size"
4455 def valuespec(self
):
4457 title
=_("Bulk walk: Number of OIDs per bulk"),
4458 label
=_("Number of OIDs to request per bulk: "),
4463 "This variable allows you to configure the numbr of OIDs Check_MK should request "
4464 "at once. This rule only applies to SNMP hosts that are configured to be bulk "
4465 "walk hosts.You may want to use this rule to tune SNMP performance. Be aware: A "
4466 "higher value is not always better. It may decrease the transactions between "
4467 "Check_MK and the target system, but may increase the OID overhead in case you "
4468 "only need a small amount of OIDs."),
4472 @rulespec_registry.register
4473 class RulespecSnmpWithoutSysDescr(BinaryHostRulespec
):
4476 return RulespecGroupAgentSNMP
4480 return "snmp_without_sys_descr"
4484 return _("Hosts without system description OID")
4488 return _("Devices which do not publish the system description OID .1.3.6.1.2.1.1.1.0 are "
4489 "normally ignored by the SNMP inventory. Use this ruleset to select hosts which "
4490 "should nevertheless be checked.")
4493 @rulespec_registry.register
4494 class RulespecSnmpv2CHosts(BinaryHostRulespec
):
4497 return RulespecGroupAgentSNMP
4501 return "snmpv2c_hosts"
4505 return _("Legacy SNMP devices using SNMP v2c")
4509 return _("There exist a few devices out there that behave very badly when using SNMP v2c "
4510 "and bulk walk. If you want to use SNMP v2c on those devices, nevertheless, you "
4511 "need to configure this device as legacy snmp device and upgrade it to SNMP v2c "
4512 "(without bulk walk) with this rule set. One reason is enabling 64 bit counters. "
4513 "Note: This rule won't apply if the device is already configured as SNMP v2c "
4517 @rulespec_registry.register
4518 class RulespecSnmpTiming(HostRulespec
):
4521 return RulespecGroupAgentSNMP
4525 return "snmp_timing"
4528 def match_type(self
):
4532 def factory_default(self
):
4533 return {'retries': 5, 'timeout': 1}
4536 def valuespec(self
):
4538 title
=_("Timing settings for SNMP access"),
4539 help=_("This rule decides about the number of retries and timeout values "
4540 "for the SNMP access to devices."),
4545 title
=_("Response timeout for a single query"),
4547 "After a request is sent to the remote SNMP agent we will wait up to this "
4548 "number of seconds until assuming the answer get lost and retrying."),
4559 title
=_("Number of retries"),
4568 @rulespec_registry.register
4569 class RulespecNonInlineSnmpHosts(BinaryHostRulespec
):
4572 return RulespecGroupAgentSNMP
4576 return "non_inline_snmp_hosts"
4580 return _("Hosts not using Inline-SNMP")
4584 return _("Check_MK has an efficient SNMP implementation called Inline SNMP which reduces "
4585 "the load produced by SNMP monitoring on the monitoring host significantly. This "
4586 "option is enabled by default for all SNMP hosts and it is a good idea to keep "
4587 "this default setting. However, there are SNMP devices which have problems with "
4588 "this SNMP implementation. You can use this rule to disable Inline SNMP for these "
4592 @rulespec_registry.register
4593 class RulespecUsewalkHosts(BinaryHostRulespec
):
4596 return RulespecGroupAgentSNMP
4600 return "usewalk_hosts"
4604 return _("Simulating SNMP by using a stored SNMP walk")
4608 return _("This ruleset helps in test and development. You can create stored SNMP walks on "
4609 "the command line with cmk --snmpwalk HOSTNAME. A host that is configured with "
4610 "this ruleset will then use the information from that file instead of using real "
4614 @rulespec_registry.register
4615 class RulespecSnmpPorts(HostRulespec
):
4618 return RulespecGroupAgentSNMP
4625 def valuespec(self
):
4630 title
=_("UDP port used for SNMP"),
4631 help=_("This variable allows you to customize the UDP port to be used to "
4632 "communicate via SNMP on a per-host-basis."),
4636 @rulespec_group_registry.register
4637 class RulespecGroupAgentCMKAgent(RulespecSubGroup
):
4639 def main_group(self
):
4640 return RulespecGroupAgent
4643 def sub_group_name(self
):
4644 return "check_mk_agent"
4648 return _("Check_MK Agent")
4651 @rulespec_registry.register
4652 class RulespecAgentPorts(HostRulespec
):
4655 return RulespecGroupAgentCMKAgent
4659 return "agent_ports"
4662 def valuespec(self
):
4667 title
=_("TCP port for connection to Check_MK agent"),
4668 help=_("This variable allows to specify the TCP port to "
4669 "be used to connect to the agent on a per-host-basis. "),
4673 @rulespec_registry.register
4674 class RulespecTcpConnectTimeouts(HostRulespec
):
4677 return RulespecGroupAgentCMKAgent
4681 return "tcp_connect_timeouts"
4684 def valuespec(self
):
4689 title
=_("Agent TCP connect timeout"),
4691 "Timeout for TCP connect to the Check_MK agent in seconds. If the connection "
4692 "to the agent cannot be established within this time, it is considered to be unreachable. "
4693 "Note: This does <b>not</b> limit the time the agent needs to "
4694 "generate its output. "
4695 "This rule can be used to specify a timeout on a per-host-basis."),
4699 @rulespec_registry.register
4700 class RulespecAgentEncryption(HostRulespec
):
4703 return RulespecGroupAgentCMKAgent
4707 return "agent_encryption"
4710 def valuespec(self
):
4713 ("passphrase", PasswordSpec(title
=_("Encryption secret"), allow_empty
=False)),
4716 title
=_("Encryption for Agent"),
4717 help=_("Choose if the agent agents encrypt packages. This controls whether "
4718 "baked agents encrypt their output and whether check_mk expects "
4719 "encrypted output. "
4720 "Please note: If you opt to enforce encryption, "
4721 "agents that don't support encryption will not work any more. "
4722 "Further note: This only affects regular agents, not special agents "
4723 "aka datasource programs."),
4724 default_value
="disable",
4725 choices
=[("enforce", _("Enforce (drop unencrypted data)")),
4726 ("allow", _("Enable (accept encrypted and unencrypted data)")),
4727 ("disable", _("Disable (drop encrypted data)"))])),
4730 title
=_("Encryption for Realtime Updates"),
4731 help=_("Choose if realtime updates are sent/expected encrypted"),
4732 default_value
="enforce",
4733 choices
=[("enforce", _("Enforce (drop unencrypted data)")),
4734 ("allow", _("Enable (accept encrypted and unencrypted data)")),
4735 ("disable", _("Disable (drop encrypted data)"))])),
4738 title
=_("Encryption"),
4739 help=_("Control encryption of data sent from agent to host."),
4743 def _common_check_mk_exit_status_elements():
4747 MonitoringState(default_value
=2, title
=_("State in case of empty output")),
4751 MonitoringState(default_value
=2, title
=_("State in case of connection problems")),
4755 MonitoringState(default_value
=2, title
=_("State in case of a timeout")),
4759 MonitoringState(default_value
=3, title
=_("State in case of unhandled exception")),
4764 def transform_exit_code_spec(p
):
4767 return {"overall": p
}
4770 @rulespec_registry.register
4771 class RulespecCheckMkExitStatus(HostRulespec
):
4774 return RulespecGroupAgentCMKAgent
4778 return "check_mk_exit_status"
4781 def match_type(self
):
4785 def factory_default(self
):
4791 'missing_sections': 1
4795 def valuespec(self
):
4801 title
=_("Overall status"),
4802 elements
=_common_check_mk_exit_status_elements() + [
4807 title
=_("State in case of wrong agent version")),
4814 "State if just <i>some</i> agent sections are missing")),
4817 "specific_missing_sections",
4823 _('Beside of setting the generic "Missing sections" state above '
4824 'you can specify a regex pattern to match specific section names and '
4825 'give them an individual state in case they are missing. '
4826 'Note that the first match is used.'),
4827 mode
=RegExpUnicode
.prefix
),
4830 orientation
="horizontal"),
4831 title
=_("State if specific sections are missing"),
4837 title
=_("Individual states per data source"),
4842 elements
=_common_check_mk_exit_status_elements() + [
4847 title
=_("State in case of wrong agent version")),
4852 title
=_("Programs"),
4853 elements
=_common_check_mk_exit_status_elements())),
4856 title
=_("Programs"),
4857 elements
=_common_check_mk_exit_status_elements())),
4861 elements
=_common_check_mk_exit_status_elements())),
4864 title
=_("SNMP Management Board"),
4865 elements
=_common_check_mk_exit_status_elements())),
4868 title
=_("IPMI Management Board"),
4869 elements
=_common_check_mk_exit_status_elements())),
4872 title
=_("Piggyback"),
4873 elements
=_common_check_mk_exit_status_elements())),
4876 optional_keys
=["individual"],
4878 forth
=transform_exit_code_spec
,
4879 title
=_("Status of the Check_MK services"),
4881 "This ruleset specifies the total status of the Check_MK services <i>Check_MK</i>, "
4882 "<i>Check_MK Discovery</i> and <i>Check_MK HW/SW Inventory</i> in case of various "
4883 "error situations. One use case is the monitoring of hosts that are not always up. "
4884 "You can have Check_MK an OK status here if the host is not reachable. Note: the "
4885 "<i>Timeout</i> setting only works when using the Check_MK Micro Core."),
4889 @rulespec_registry.register
4890 class RulespecCheckMkAgentTargetVersions(HostRulespec
):
4893 return RulespecGroupAgentCMKAgent
4897 return "check_mk_agent_target_versions"
4900 def valuespec(self
):
4903 title
=_("Check for correct version of Check_MK agent"),
4904 help=_("Here you can make sure that all of your Check_MK agents are running"
4905 " one specific version. Agents running "
4906 " a different version return a non-OK state."),
4908 ("ignore", _("Ignore the version")),
4909 ("site", _("Same version as the monitoring site")),
4910 ("specific", _("Specific version"), TextAscii(allow_empty
=False,)),
4911 ("at_least", _("At least"),
4912 Dictionary(elements
=[
4915 title
=_('Official Release version'),
4918 ('daily_build', TextAscii(
4919 title
=_('Daily build'),
4924 default_value
="ignore",
4926 # In the past, this was a OptionalDropdownChoice() which values could be strings:
4927 # ignore, site or a custom string representing a version number.
4928 forth
=lambda x
: isinstance(x
, str) and x
not in ["ignore", "site"] and ("specific", x
)
4933 @rulespec_group_registry.register
4934 class RulespecGroupMonitoringAgents(RulespecGroup
):
4941 return _("Monitoring Agents")
4945 return _("Configuration of monitoring agents for Linux, Windows and Unix")
4948 @rulespec_group_registry.register
4949 class RulespecGroupMonitoringAgentsGenericOptions(RulespecSubGroup
):
4951 def main_group(self
):
4952 return RulespecGroupMonitoringAgents
4955 def sub_group_name(self
):
4956 return "generic_options"
4960 return _("Generic Options")
4963 @rulespec_registry.register
4964 class RulespecAgentConfigOnlyFrom(HostRulespec
):
4967 return RulespecGroupMonitoringAgentsGenericOptions
4971 return "agent_config:only_from"
4974 def valuespec(self
):
4975 return ListOfStrings(
4976 valuespec
=IPNetwork(),
4977 title
=_("Allowed agent access via IP address"),
4978 help=_("This rule allows you to restrict the access to the "
4979 "Check_MK agent to certain IP addresses and networks. "
4980 "Usually you configure just the IP addresses of your "
4981 "Check_MK servers here. You can enter either IP addresses "
4982 "in the form <tt>1.2.3.4</tt> or networks in the style "
4983 "<tt>1.2.0.0/16</tt>. If you leave this configuration empty "
4984 "or create no rule then <b>all</b> addresses are allowed to "
4985 "access the agent. IPv6 addresses and networks are also allowed."),
4989 @rulespec_registry.register
4990 class RulespecPiggybackTranslation(HostRulespec
):
4993 return RulespecGroupAgentGeneralSettings
4997 return "piggyback_translation"
5000 def match_type(self
):
5004 def valuespec(self
):
5005 return HostnameTranslation(
5006 title
=_("Hostname translation for piggybacked hosts"),
5008 _("Some agents or agent plugins send data not only for the queried host but also "
5009 "for other hosts "piggyback" with their own data. This is the case "
5010 "for the vSphere special agent and the SAP R/3 plugin, for example. The hostnames "
5011 "that these agents send must match your hostnames in your monitoring configuration. "
5012 "If that is not the case, then with this rule you can define a hostname translation. "
5013 "Note: This rule must be configured for the "pig" - i.e. the host that the "
5014 "agent is running on. It is not applied to the translated piggybacked hosts."),
5018 @rulespec_registry.register
5019 class RulespecServiceDescriptionTranslation(HostRulespec
):
5022 return RulespecGroupAgentGeneralSettings
5026 return "service_description_translation"
5029 def valuespec(self
):
5030 return ServiceDescriptionTranslation(
5031 title
=_("Translation of service descriptions"),
5033 _("Within this ruleset service descriptions can be translated similar to the ruleset "
5034 "<tt>Hostname translation for piggybacked hosts</tt>. Services such as "
5035 "<tt>Check_MK</tt>, <tt>Check_MK Agent</tt>, <tt>Check_MK Discovery</tt>, "
5036 "<tt>Check_MK inventory</tt>, and <tt>Check_MK HW/SW Inventory</tt> are excluded. "
5037 "<b>Attention:</b><ul>"
5038 "<li>Downtimes and other configured rules which match these "
5039 "services have to be adapted.</li>"
5040 "<li>Performance data and graphs will begin from scratch for translated services.</li>"
5041 "<li>Especially configured check parameters keep their functionality further on.</li>"
5042 "<li>This new ruleset translates also the item part of a service description. "
5043 "This means that after such a translation the item may be gone but is used in the "
5044 "conditions of the parameters further on if any parameters are configured. "
5045 "This might be confusing.</li></ul>"
5046 "This rule should only be configured in the early stages."),
5050 def get_snmp_checktypes():
5051 checks
= watolib
.check_mk_local_automation("get-check-information")
5052 types
= [(cn
, (c
['title'] != cn
and '%s: ' % cn
or '') + c
['title'])
5053 for (cn
, c
) in checks
.items()
5056 return [(None, _('All SNMP Checks'))] + types
5059 def get_snmp_section_names():
5060 checks
= watolib
.check_mk_local_automation("get-check-information")
5061 snmp_section_names
= set(cn
.split(".", 1)[0] for (cn
, c
) in checks
.items() if c
['snmp'])
5062 section_choices
= [(sn
, sn
) for sn
in snmp_section_names
]
5063 return [(None, _('All SNMP Checks'))] + sorted(section_choices
)
5066 @rulespec_registry.register
5067 class RulespecSnmpCheckInterval(HostRulespec
):
5070 return RulespecGroupAgentSNMP
5074 return "snmp_check_interval"
5077 def valuespec(self
):
5079 title
=_('Check intervals for SNMP checks'),
5081 'This rule can be used to customize the check interval of each SNMP based check. '
5082 'With this option it is possible to configure a longer check interval for specific '
5083 'checks, than then normal check interval.'),
5088 help=_("You can only configure \"section names\" here and not choose all "
5089 "individual SNMP based checks here. It is only possible to define "
5090 "SNMP check intervals for main checks and all the related sub "
5091 "checks together. The reason for this is that the data of the "
5092 "main check and it's sub checks is defined for the whole group "
5093 "of checks in the main check and also fetched for all these "
5094 "checks together."),
5095 choices
=get_snmp_section_names
,
5097 # Transform check types to section names
5098 forth
=lambda e
: e
.split(".")[0] if e
is not None else None,
5101 title
=_("Do check every"),
5109 @rulespec_registry.register
5110 class RulespecSNMPv3Contexts(HostRulespec
):
5113 return RulespecGroupAgentSNMP
5117 return "snmpv3_contexts"
5120 def valuespec(self
):
5122 title
=_('SNMPv3 contexts to use in requests'),
5124 'By default Check_MK does not use a specific context during SNMPv3 queries, '
5125 'but some devices are offering their information in different SNMPv3 contexts. '
5126 'This rule can be used to configure, based on hosts and check type, which SNMPv3 '
5127 'contexts Check_MK should ask for when getting information via SNMPv3.'),
5130 title
=_("Checktype"),
5131 choices
=get_snmp_checktypes
,
5134 title
=_("SNMP Context IDs"),