Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / cmk / gui / plugins / wato / check_mk_configuration.py
bloba04dd9ecad975c4f770fdd94c8346ab6743c0a62
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
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.
27 import re
28 import logging
30 import cmk
31 import cmk.utils.paths
33 import cmk.gui.sites as sites
34 import cmk.gui.config as config
35 import cmk.gui.watolib as watolib
36 import cmk.gui.userdb as userdb
37 import cmk.gui.utils as utils
38 from cmk.gui.exceptions import MKUserError
39 from cmk.gui.i18n import _
41 from cmk.gui.valuespec import (
42 Dictionary,
43 TextAscii,
44 TextUnicode,
45 DropdownChoice,
46 Tuple,
47 ListOf,
48 Integer,
49 Float,
50 Transform,
51 ListOfStrings,
52 IPNetwork,
53 CascadingDropdown,
54 MonitoringState,
55 RegExpUnicode,
56 IconSelector,
57 PasswordSpec,
58 ListOfTimeRanges,
59 Age,
60 FixedValue,
61 Optional,
62 Alternative,
63 ListChoice,
64 Checkbox,
65 ID,
66 ListOfCAs,
67 LogLevelChoice,
70 from cmk.gui.plugins.wato import (
71 config_variable_group_registry,
72 ConfigVariableGroup,
73 config_variable_registry,
74 ConfigVariable,
75 ConfigDomainGUI,
76 ConfigDomainCore,
77 ConfigDomainCACertificates,
78 site_neutral_path,
79 rulespec_group_registry,
80 RulespecGroup,
81 RulespecSubGroup,
82 register_rule,
83 PluginCommandLine,
84 UserIconOrAction,
85 SNMPCredentials,
86 IPMIParameters,
87 HostnameTranslation,
88 ServiceDescriptionTranslation,
89 GroupSelection,
90 CheckTypeSelection,
91 TimeperiodSelection,
92 HTTPProxyInput,
95 from cmk.gui.plugins.wato.omd_configuration import ConfigVariableGroupSiteManagement
96 from cmk.gui.plugins.views.icons import icon_and_action_registry
97 from cmk.gui.watolib.bulk_discovery import vs_bulk_discovery
99 # .--Global Settings-----------------------------------------------------.
100 # | ____ _ _ _ ____ _ _ _ |
101 # | / ___| | ___ | |__ __ _| | / ___| ___| |_| |_(_)_ __ __ _ ___ |
102 # || | _| |/ _ \| '_ \ / _` | | \___ \ / _ \ __| __| | '_ \ / _` / __| |
103 # || |_| | | (_) | |_) | (_| | | ___) | __/ |_| |_| | | | | (_| \__ \ |
104 # | \____|_|\___/|_.__/ \__,_|_| |____/ \___|\__|\__|_|_| |_|\__, |___/ |
105 # | |___/ |
106 # +----------------------------------------------------------------------+
107 # | Global configuration settings for main.mk and multisite.mk |
108 # '----------------------------------------------------------------------'
111 @config_variable_group_registry.register
112 class ConfigVariableGroupUserInterface(ConfigVariableGroup):
113 def title(self):
114 return _("User Interface")
116 def sort_index(self):
117 return 20
120 @config_variable_registry.register
121 class ConfigVariableUITheme(ConfigVariable):
122 def group(self):
123 return ConfigVariableGroupUserInterface
125 def domain(self):
126 return ConfigDomainGUI
128 def ident(self):
129 return "ui_theme"
131 def valuespec(self):
132 return DropdownChoice(
133 title=_("User interface theme"),
134 help=_("Change the default user interface theme of your Check_MK installation"),
135 choices=config.theme_choices(),
139 @config_variable_registry.register
140 class ConfigVariableBulkDiscoveryDefaultSettings(ConfigVariable):
141 def group(self):
142 return ConfigVariableGroupUserInterface
144 def domain(self):
145 return ConfigDomainGUI
147 def ident(self):
148 return "bulk_discovery_default_settings"
150 def valuespec(self):
151 return vs_bulk_discovery()
154 @config_variable_registry.register
155 class ConfigVariableLogLevels(ConfigVariable):
156 def group(self):
157 return ConfigVariableGroupUserInterface
159 def domain(self):
160 return ConfigDomainGUI
162 def ident(self):
163 return "log_levels"
165 def valuespec(self):
166 return Dictionary(
167 title=_("Logging"),
168 help=_("This setting decides which types of messages to log into "
169 "the web log <tt>%s</tt>.") %
170 site_neutral_path(cmk.utils.paths.log_dir + "/web.log"),
171 elements=self._web_log_level_elements(),
172 optional_keys=[],
175 def _web_log_level_elements(self):
176 elements = []
177 for level_id, title, help_text in [
178 ("cmk.web", _("Web"),
179 _("The log level for all log entries not assigned to the other "
180 "log categories on this page.")),
181 ("cmk.web.auth", _("Authentication"),
182 _("The log level for user authentication related log entries.")),
183 ("cmk.web.ldap", _("LDAP"), _("The log level for LDAP related log entries.")),
184 ("cmk.web.bi.compilation", _("BI compilation"),
185 _("If this option is enabled, Check_MK BI will create a log with details "
186 "about compiling BI aggregations. This includes statistics and "
187 "details for each executed compilation.")),
188 ("cmk.web.automations", _("Automation calls"),
189 _("Communication between different components of Check_MK (e.g. GUI and check engine) "
190 "will be logged in this log level."))
192 elements.append((level_id,
193 LogLevelChoice(
194 title=title,
195 help=help_text,
196 default_value=logging.WARNING,
199 return elements
202 @config_variable_registry.register
203 class ConfigVariableDebug(ConfigVariable):
204 def group(self):
205 return ConfigVariableGroupUserInterface
207 def domain(self):
208 return ConfigDomainGUI
210 def ident(self):
211 return "debug"
213 def valuespec(self):
214 return Checkbox(
215 title=_("Debug mode"),
216 label=_("enable debug mode"),
217 help=_("When Multisite is running in debug mode, internal Python error messages "
218 "are being displayed and various debug information in other places is "
219 "also available."),
223 @config_variable_registry.register
224 class ConfigVariableGUIProfile(ConfigVariable):
225 def group(self):
226 return ConfigVariableGroupUserInterface
228 def domain(self):
229 return ConfigDomainGUI
231 def ident(self):
232 return "profile"
234 def valuespec(self):
235 return DropdownChoice(
236 title=_("Profile requests"),
237 help=_("It is possible to profile the rendering process of Multisite pages. This "
238 "Is done using the Python module cProfile. When profiling is performed "
239 "two files are created <tt>%s</tt> and <tt>%s</tt>. By executing the later "
240 "file you can get runtime statistics about the last processed page. When "
241 "enabled by request the profiling mode is enabled by providing the HTTP "
242 "variable <tt>_profile</tt>.") %
243 (site_neutral_path(cmk.utils.paths.var_dir + "/multisite.profile"),
244 site_neutral_path(cmk.utils.paths.var_dir + "/multisite.profile.py")),
245 choices=[
246 (False, _("Disable profiling")),
247 ("enable_by_var", _("Enable profiling by request")),
248 (True, _("Enable profiling for all requests")),
253 @config_variable_registry.register
254 class ConfigVariableDebugLivestatusQueries(ConfigVariable):
255 def group(self):
256 return ConfigVariableGroupUserInterface
258 def domain(self):
259 return ConfigDomainGUI
261 def ident(self):
262 return "debug_livestatus_queries"
264 def valuespec(self):
265 return Checkbox(
266 title=_("Debug Livestatus queries"),
267 label=_("enable debug of Livestatus queries"),
268 help=_("With this option turned on all Livestatus queries made by Multisite "
269 "in order to render views are being displayed."),
273 @config_variable_registry.register
274 class ConfigVariableSelectionLivetime(ConfigVariable):
275 def group(self):
276 return ConfigVariableGroupUserInterface
278 def domain(self):
279 return ConfigDomainGUI
281 def ident(self):
282 return "selection_livetime"
284 def valuespec(self):
285 return Integer(
286 title=_('Checkbox Selection Livetime'),
287 help=
288 _('This option defines the maximum age of unmodified checkbox selections stored for users. '
289 'If a user modifies the selection in a view, these selections are persisted for the currently '
290 'open view. When a view is re-opened a new selection is used. The old one remains on the '
291 'server until the livetime is exceeded.'),
292 minvalue=1,
296 @config_variable_registry.register
297 class ConfigVariableShowLivestatusErrors(ConfigVariable):
298 def group(self):
299 return ConfigVariableGroupUserInterface
301 def domain(self):
302 return ConfigDomainGUI
304 def ident(self):
305 return "show_livestatus_errors"
307 def valuespec(self):
308 return Checkbox(
309 title=_("Show MK Livestatus error messages"),
310 label=_("show errors"),
311 help=
312 _("This option controls whether error messages from unreachable sites are shown in the output of "
313 "views. Those error messages shall alert you that not all data from all sites has been shown. "
314 "Other people - however - find those messages distracting. "),
318 @config_variable_registry.register
319 class ConfigVariableEnableSounds(ConfigVariable):
320 def group(self):
321 return ConfigVariableGroupUserInterface
323 def domain(self):
324 return ConfigDomainGUI
326 def ident(self):
327 return "enable_sounds"
329 def valuespec(self):
330 return Checkbox(
331 title=_("Enable sounds in views"),
332 label=_("enable sounds"),
333 help=_("If sounds are enabled then the user will be alarmed by problems shown "
334 "in a Multisite status view if that view has been configured for sounds. "
335 "From the views shipped in with Multisite all problem views have sounds "
336 "enabled."),
340 @config_variable_registry.register
341 class ConfigVariableContextButtonsToShow(ConfigVariable):
342 def group(self):
343 return ConfigVariableGroupUserInterface
345 def domain(self):
346 return ConfigDomainGUI
348 def ident(self):
349 return "context_buttons_to_show"
351 def valuespec(self):
352 return Optional(
353 Integer(
354 title=_("show"),
355 label=_("buttons"),
356 minvalue=1,
357 maxvalue=100,
358 size=2,
360 title=_("Number of context buttons to show"),
361 label=_("Show only most frequently used buttons"),
362 help=_("If this option is enabled, then Multisite only show the most "
363 "used context buttons and hides the rest. Which buttons are used "
364 "how often is computed separately per user."),
368 @config_variable_registry.register
369 class ConfigVariableSoftQueryLimit(ConfigVariable):
370 def group(self):
371 return ConfigVariableGroupUserInterface
373 def domain(self):
374 return ConfigDomainGUI
376 def ident(self):
377 return "soft_query_limit"
379 def valuespec(self):
380 return Integer(
381 title=_("Soft query limit"),
382 help=_("Whenever the number of returned datasets of a view would exceed this "
383 "limit, a warning is being displayed and no further data is being shown. "
384 "A normal user can override this limit with one mouse click."),
385 minvalue=1,
389 @config_variable_registry.register
390 class ConfigVariableHardQueryLimit(ConfigVariable):
391 def group(self):
392 return ConfigVariableGroupUserInterface
394 def domain(self):
395 return ConfigDomainGUI
397 def ident(self):
398 return "hard_query_limit"
400 def valuespec(self):
401 return Integer(
402 title=_("Hard query limit"),
403 help=_("Whenever the number of returned datasets of a view would exceed this "
404 "limit, an error message is shown. The normal user cannot override "
405 "the hard limit. The purpose of the hard limit is to secure the server "
406 "against useless queries with huge result sets."),
407 minvalue=1,
411 @config_variable_registry.register
412 class ConfigVariableQuicksearchDropdownLimit(ConfigVariable):
413 def group(self):
414 return ConfigVariableGroupUserInterface
416 def domain(self):
417 return ConfigDomainGUI
419 def ident(self):
420 return "quicksearch_dropdown_limit"
422 def valuespec(self):
423 return Integer(
424 title=_("Number of elements to show in Quicksearch"),
425 help=_("When typing a texts in the Quicksearch snapin, a dropdown will "
426 "appear listing all matching host names containing that text. "
427 "That list is limited in size so that the dropdown will not get "
428 "too large when you have a huge number of lists. "),
429 minvalue=1,
433 @config_variable_registry.register
434 class ConfigVariableQuicksearchSearchOrder(ConfigVariable):
435 def group(self):
436 return ConfigVariableGroupUserInterface
438 def domain(self):
439 return ConfigDomainGUI
441 def ident(self):
442 return "quicksearch_search_order"
444 def valuespec(self):
445 return ListOf(
446 Tuple(
447 elements=[
448 DropdownChoice(
449 title=_("Search filter"),
450 choices=[
451 ("h", _("Hostname")),
452 ("al", _("Hostalias")),
453 ("ad", _("Hostaddress")),
454 ("tg", _("Hosttag")),
455 ("hg", _("Hostgroup")),
456 ("sg", _("Servicegroup")),
457 ("s", _("Service Description")),
460 DropdownChoice(
461 title=_("Match behaviour"),
462 choices=[
463 ("continue", _("Continue search")),
464 ("finished",
465 _("Search finished: Also show all results of previous filters")),
466 ("finished_distinct",
467 _("Search finished: Only show results of this filter")),
470 ],),
471 title=_("Quicksearch search order"),
472 add_label=_("Add search filter"),
476 @config_variable_registry.register
477 class ConfigVariableTableRowLimit(ConfigVariable):
478 def group(self):
479 return ConfigVariableGroupUserInterface
481 def domain(self):
482 return ConfigDomainGUI
484 def ident(self):
485 return "table_row_limit"
487 def valuespec(self):
488 return Integer(
489 title=_("Limit the number of rows shown in tables"),
490 help=_("Several pages which use tables to show data in rows, like the "
491 "\"Users\" configuration page, can be configured to show "
492 "only a limited number of rows when accessing the pages."),
493 minvalue=1,
494 unit=_('rows'),
498 @config_variable_registry.register
499 class ConfigVariableStartURL(ConfigVariable):
500 def group(self):
501 return ConfigVariableGroupUserInterface
503 def domain(self):
504 return ConfigDomainGUI
506 def ident(self):
507 return "start_url"
509 def valuespec(self):
510 return TextAscii(
511 title=_("Start URL to display in main frame"),
512 help=_("When you point your browser to the Check_MK GUI, usually the dashboard "
513 "is shown in the main (right) frame. You can replace this with any other "
514 "URL you like here."),
515 size=80,
516 allow_empty=False,
517 validate=utils.validate_start_url,
521 @config_variable_registry.register
522 class ConfigVariablePageHeading(ConfigVariable):
523 def group(self):
524 return ConfigVariableGroupUserInterface
526 def domain(self):
527 return ConfigDomainGUI
529 def ident(self):
530 return "page_heading"
532 def valuespec(self):
533 return TextUnicode(
534 title=_("Page title"),
535 help=_("This title will be displayed in your browser's title bar or tab. You can use "
536 "a <tt>%s</tt> to insert the alias of your monitoring site to the title."),
537 size=80,
541 @config_variable_registry.register
542 class ConfigVariablePagetitleDateFormat(ConfigVariable):
543 def group(self):
544 return ConfigVariableGroupUserInterface
546 def domain(self):
547 return ConfigDomainGUI
549 def ident(self):
550 return "pagetitle_date_format"
552 def valuespec(self):
553 return DropdownChoice(
554 title=_("Date format for page titles"),
555 help=_("When enabled, the headline of each page also displays "
556 "the date in addition the time."),
557 choices=[
558 (None, _("Do not display a date")),
559 ('yyyy-mm-dd', _("YYYY-MM-DD")),
560 ('dd.mm.yyyy', _("DD.MM.YYYY")),
565 @config_variable_registry.register
566 class ConfigVariableEscapePluginOutput(ConfigVariable):
567 def group(self):
568 return ConfigVariableGroupUserInterface
570 def domain(self):
571 return ConfigDomainGUI
573 def ident(self):
574 return "escape_plugin_output"
576 def valuespec(self):
577 return Checkbox(
578 title=_("Escape HTML codes in plugin output"),
579 help=_("By default, for security reasons, the GUI does not interpret any HTML "
580 "code received from external sources, like plugin output or log messages. "
581 "If you are really sure what you are doing and need to have HTML codes, like "
582 "links rendered, disable this option. Be aware, you might open the way "
583 "for several injection attacks.") + _(
584 "This setting can either be set globally or individually for selected hosts "
585 "or services using the host or service rulesets."),
586 label=_("Prevent loading HTML from plugin output or log messages"),
590 @config_variable_registry.register
591 class ConfigVariableCrashReportTarget(ConfigVariable):
592 def group(self):
593 return ConfigVariableGroupUserInterface
595 def domain(self):
596 return ConfigDomainGUI
598 def ident(self):
599 return "crash_report_target"
601 def valuespec(self):
602 return TextAscii(
603 title=_("Fallback mail address for crash reports"),
604 help=_("By default crash reports will be sent to our crash reporting server. In case "
605 "this fails for some reason, the crash reports can be sent by mail to the "
606 "address configured here."),
607 size=80,
608 attrencode=True,
612 @config_variable_registry.register
613 class ConfigVariableDrawRuleIcon(ConfigVariable):
614 def group(self):
615 return ConfigVariableGroupUserInterface
617 def domain(self):
618 return ConfigDomainGUI
620 def ident(self):
621 return "multisite_draw_ruleicon"
623 def valuespec(self):
624 return Checkbox(
625 title=_("Show icon linking to WATO parameter editor for services"),
626 label=_("Show WATO icon"),
627 help=_("When enabled a rule editor icon is displayed for each "
628 "service in the multisite views. It is only displayed if the user "
629 "does have the permission to edit rules."),
633 def transform_virtual_host_trees(trees):
634 def id_from_title(title):
635 return re.sub("[^-a-zA-Z0-9_]+", "", title.lower())
637 for index, tree in enumerate(trees):
638 if isinstance(tree, tuple):
639 trees[index] = {
640 "id": id_from_title(tree[0]),
641 "title": tree[0],
642 "tree_spec": tree[1],
644 else:
645 # Transform existing dicts with old key "tag_groups"
646 if "tag_groups" in tree:
647 tree["tree_spec"] = tree.pop("tag_groups")
649 return sorted(trees, key=lambda x: x["title"])
652 @config_variable_registry.register
653 class ConfigVariableVirtualHostTrees(ConfigVariable):
654 def group(self):
655 return ConfigVariableGroupUserInterface
657 def domain(self):
658 return ConfigDomainGUI
660 def ident(self):
661 return "virtual_host_trees"
663 def valuespec(self):
664 return Transform(
665 ListOf(
666 Dictionary(
667 elements=[
668 ("id", ID(
669 title=_("ID"),
670 allow_empty=False,
672 ("title", TextUnicode(
673 title=_("Title of the tree"),
674 allow_empty=False,
676 ("exclude_empty_tag_choices",
677 Checkbox(
678 title=_("Exclude empty tag choices"),
679 default_value=False,
681 ("tree_spec",
682 ListOf(
683 DropdownChoice(choices=self._virtual_host_tree_choices,),
684 title=_("Tree levels"),
685 allow_empty=False,
686 magic="#!#",
689 optional_keys=[],
691 add_label=_("Create new virtual host tree configuration"),
692 title=_("Virtual Host Trees"),
693 help=
694 _("Here you can define tree configurations for the snapin <i>Virtual Host-Trees</i>. "
695 "These trees organize your hosts based on their values in certain host tag groups. "
696 "Each host tag group you select will create one level in the tree."),
697 validate=self._validate_virtual_host_trees,
698 movable=False,
700 forth=transform_virtual_host_trees,
703 def _virtual_host_tree_choices(self):
704 return self._wato_host_tag_group_choices() + [("foldertree:", _("WATO folder tree"))] + [
705 ("folder:%d" % l, _("WATO folder level %d") % l) for l in range(1, 7)
708 def _wato_host_tag_group_choices(self):
709 # We add to the choices:
710 # 1. All host tag groups with their id
711 # 2. All *topics* that:
712 # - consist only of checkbox tags
713 # - contain at least two entries
714 choices = []
715 by_topic = {}
716 for entry in config.host_tag_groups():
717 tgid = entry[0]
718 topic, tit = watolib.parse_hosttag_title(entry[1])
719 choices.append((tgid, tit))
720 by_topic.setdefault(topic, []).append(entry)
722 # Now search for checkbox-only-topics
723 for topic, entries in by_topic.items():
724 for entry in entries:
725 tgid, _title, tags = entry[:3]
726 if len(tags) != 1:
727 break
728 else:
729 if len(entries) > 1:
730 choices.append((
731 "topic:" + topic,
732 _("Topic") + ": " + topic,
735 return choices
737 def _validate_virtual_host_trees(self, value, varprefix):
738 tree_ids = set()
739 for tree in value:
740 if tree["id"] in tree_ids:
741 raise MKUserError(varprefix, _("The ID needs to be unique."))
742 tree_ids.add(tree["id"])
744 # Validate that each element is selected once
745 seen = set()
746 for element in tree["tree_spec"]:
747 if element in seen:
748 raise MKUserError(
749 varprefix,
750 _("Found '%s' a second time in tree '%s'. Each element can only be "
751 "choosen once.") % (element, tree["id"]))
753 seen.add(element)
756 @config_variable_registry.register
757 class ConfigVariableRescheduleTimeout(ConfigVariable):
758 def group(self):
759 return ConfigVariableGroupUserInterface
761 def domain(self):
762 return ConfigDomainGUI
764 def ident(self):
765 return "reschedule_timeout"
767 def valuespec(self):
768 return Float(
769 title=_("Timeout for rescheduling checks in Multisite"),
770 help=_("When you reschedule a check by clicking on the &quot;arrow&quot;-icon "
771 "then Multisite will use this number of seconds as a timeout. If the "
772 "monitoring core has not executed the check within this time, an error "
773 "will be displayed and the page not reloaded."),
774 minvalue=1.0,
775 unit="sec",
776 display_format="%.1f",
780 @config_variable_registry.register
781 class ConfigVariableSidebarShowVersionInSidebar(ConfigVariable):
782 def group(self):
783 return ConfigVariableGroupUserInterface
785 def domain(self):
786 return ConfigDomainGUI
788 def ident(self):
789 return "sidebar_show_version_in_sidebar"
791 def valuespec(self):
792 return Checkbox(
793 title=_("Show Check_MK edition & version in sidebar"),
794 label=_("Show the edition ad version"),
795 help=_("Use this option to hide the Check_MK edition and version information from "
796 "the header of the sidebar."),
800 @config_variable_registry.register
801 class ConfigVariableSidebarUpdateInterval(ConfigVariable):
802 def group(self):
803 return ConfigVariableGroupUserInterface
805 def domain(self):
806 return ConfigDomainGUI
808 def ident(self):
809 return "sidebar_update_interval"
811 def valuespec(self):
812 return Float(
813 title=_("Interval of sidebar status updates"),
814 help=_("The information provided by the sidebar snapins is refreshed in a regular "
815 "interval. You can change the refresh interval to fit your needs here. This "
816 "value means that all snapnis which request a regular refresh are updated "
817 "in this interval."),
818 minvalue=10.0,
819 unit="sec",
820 display_format="%.1f",
824 @config_variable_registry.register
825 class ConfigVariableSidebarNotifyInterval(ConfigVariable):
826 def group(self):
827 return ConfigVariableGroupUserInterface
829 def domain(self):
830 return ConfigDomainGUI
832 def ident(self):
833 return "sidebar_notify_interval"
835 def valuespec(self):
836 return Optional(
837 Float(
838 minvalue=10.0,
839 unit="sec",
840 display_format="%.1f",
842 title=_("Interval of sidebar popup notification updates"),
843 help=_(
844 "The sidebar can be configured to regularly check for pending popup notififcations. "
845 "This is disabled by default."),
846 none_label=_('(disabled)'),
850 @config_variable_registry.register
851 class ConfigVariableiAdHocDowntime(ConfigVariable):
852 def group(self):
853 return ConfigVariableGroupUserInterface
855 def domain(self):
856 return ConfigDomainGUI
858 def ident(self):
859 return "adhoc_downtime"
861 def valuespec(self):
862 return Optional(
863 Dictionary(
864 optional_keys=False,
865 elements=[
866 ("duration",
867 Integer(
868 title=_("Duration"),
869 help=_("The duration in minutes of the adhoc downtime."),
870 minvalue=1,
871 unit=_("minutes"),
872 default_value=60,
874 ("comment",
875 TextUnicode(
876 title=_("Adhoc comment"),
877 help=_("The comment which is automatically sent with an adhoc downtime"),
878 size=80,
879 allow_empty=False,
880 attrencode=True,
884 title=_("Adhoc downtime"),
885 label=_("Enable adhoc downtime"),
886 help=_("This setting allows to set an adhoc downtime comment and its duration. "
887 "When enabled a new button <i>Adhoc downtime for __ minutes</i> will "
888 "be available in the command form."),
892 @config_variable_registry.register
893 class ConfigVariableAuthByHTTPHeader(ConfigVariable):
894 def group(self):
895 return ConfigVariableGroupUserInterface
897 def domain(self):
898 return ConfigDomainGUI
900 def ident(self):
901 return "auth_by_http_header"
903 def valuespec(self):
904 return Optional(
905 TextAscii(
906 label=_("HTTP Header Variable"),
907 help=_("Configure the name of the environment variable to read "
908 "from the incoming HTTP requests"),
909 default_value='REMOTE_USER',
910 attrencode=True,
912 title=_("Authenticate users by incoming HTTP requests"),
913 label=_("Activate HTTP header authentication (Warning: Only activate "
914 "in trusted environments, see help for details)"),
915 help=_("If this option is enabled, multisite reads the configured HTTP header "
916 "variable from the incoming HTTP request and simply takes the string "
917 "in this variable as name of the authenticated user. "
918 "Be warned: Only allow access from trusted ip addresses "
919 "(Apache <tt>Allow from</tt>), like proxy "
920 "servers, to this webpage. A user with access to this page could simply fake "
921 "the authentication information. This option can be useful to "
922 " realize authentication in reverse proxy environments."),
923 none_value=False,
924 none_label=_("Don't use HTTP header authentication"),
925 indent=False,
929 @config_variable_registry.register
930 class ConfigVariableStalenessThreshold(ConfigVariable):
931 def group(self):
932 return ConfigVariableGroupUserInterface
934 def domain(self):
935 return ConfigDomainGUI
937 def ident(self):
938 return "staleness_threshold"
940 def valuespec(self):
941 return Float(
942 title=_('Staleness value to mark hosts / services stale'),
943 help=_(
944 'The staleness value of a host / service is calculated by measuring the '
945 'configured check intervals a check result is old. A value of 1.5 means the '
946 'current check result has been gathered one and a half check intervals of an object. '
947 'This would mean 90 seconds in case of a check which is checked each 60 seconds.'),
948 minvalue=1,
952 @config_variable_registry.register
953 class ConfigVariableLoginScreen(ConfigVariable):
954 def group(self):
955 return ConfigVariableGroupUserInterface
957 def domain(self):
958 return ConfigDomainGUI
960 def ident(self):
961 return "login_screen"
963 def valuespec(self):
964 return Dictionary(
965 title=_("Customize login screen"),
966 elements=[
967 ("hide_version",
968 FixedValue(
969 True,
970 title=_("Hide Check_MK version"),
971 totext=_("Hide the Check_MK version from the login box"),
973 ("login_message",
974 TextUnicode(
975 title=_("Show a login message"),
976 help=
977 _("You may use this option to give your users an informational text before logging in."
979 size=80,
981 ("footer_links",
982 ListOf(
983 Tuple(
984 elements=[
985 TextUnicode(title=_("Title"),),
986 TextAscii(
987 title=_('URL'),
988 size=80,
990 DropdownChoice(
991 title=_("Open in"),
992 choices=[
993 ("_blank", _("Load in a new window / tab")),
994 ("_top", _("Load in current window / tab")),
998 orientation="horizontal",
1000 totext=_("%d links"),
1001 title=_("Custom footer links"),
1004 required_keys=[],
1008 @config_variable_registry.register
1009 class ConfigVariableUserLocalizations(ConfigVariable):
1010 def group(self):
1011 return ConfigVariableGroupUserInterface
1013 def domain(self):
1014 return ConfigDomainGUI
1016 def ident(self):
1017 return "user_localizations"
1019 def valuespec(self):
1020 return Transform(
1021 ListOf(
1022 Tuple(
1023 elements=[
1024 TextUnicode(title=_("Original Text"), size=40),
1025 Dictionary(
1026 title=_("Translations"),
1027 elements=lambda: [(l or "en", TextUnicode(title=a, size=32))
1028 for (l, a) in cmk.gui.i18n.get_languages()],
1029 columns=2,
1031 ],),
1032 title=_("Custom localizations"),
1033 movable=False,
1034 totext=_("%d translations"),
1036 forth=lambda d: sorted(d.items()),
1037 back=dict,
1041 @config_variable_registry.register
1042 class ConfigVariableUserIconsAndActions(ConfigVariable):
1043 def group(self):
1044 return ConfigVariableGroupUserInterface
1046 def domain(self):
1047 return ConfigDomainGUI
1049 def ident(self):
1050 return "user_icons_and_actions"
1052 def valuespec(self):
1053 return Transform(
1054 ListOf(
1055 Tuple(
1056 elements=[
1057 ID(title=_("ID")),
1058 Dictionary(
1059 elements=[
1060 ('icon', IconSelector(
1061 title=_('Icon'),
1062 allow_empty=False,
1064 ('title', TextUnicode(title=_('Title'),)),
1065 ('url',
1066 Transform(
1067 Tuple(
1068 title=_('Action'),
1069 elements=[
1070 TextAscii(
1071 title=_('URL'),
1072 help=
1073 _('This URL is opened when clicking on the action / icon. You '
1074 'can use some macros within the URL which are dynamically '
1075 'replaced for each object. These are:<br>'
1076 '<ul>'
1077 '<li>$HOSTNAME$: Contains the name of the host</li>'
1078 '<li>$HOSTNAME_URL_ENCODED$: Same as above but URL encoded</li>'
1079 '<li>$SERVICEDESC$: Contains the service description '
1080 '(in case this is a service)</li>'
1081 '<li>$SERVICEDESC_URL_ENCODED$: Same as above but URL encoded</li>'
1082 '<li>$HOSTADDRESS$: Contains the network address of the host</li>'
1083 '<li>$HOSTADDRESS_URL_ENCODED$: Same as above but URL encoded</li>'
1084 '<li>$USER_ID$: The user ID of the currently active user</li>'
1085 '</ul>'),
1086 size=80,
1088 DropdownChoice(
1089 title=_("Open in"),
1090 choices=[
1091 ("_blank", _("Load in a new window / tab")),
1092 ("_self",
1093 _("Load in current content area (keep sidebar)"
1095 ("_top", _("Load as new page (hide sidebar)")),
1100 forth=lambda x: not isinstance(x, tuple) and (x, "_self") or x,
1102 ('toplevel',
1103 FixedValue(
1104 True,
1105 title=_('Show in column'),
1106 totext=_('Directly show the action icon in the column'),
1107 help=_('Makes the icon appear in the column instead '
1108 'of the dropdown menu.'),
1110 ('sort_index',
1111 Integer(
1112 title=_('Sort index'),
1113 help=
1114 _('You can use the sort index to control the order of the '
1115 'elements in the column and the menu. The elements are sorted '
1116 'from smaller to higher numbers. The action menu icon '
1117 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1118 'of <tt>20</tt>. All other default icons have a sort index of '
1119 '<tt>30</tt> configured.'),
1120 min_value=0,
1121 default_value=15,
1124 optional_keys=['title', 'url', 'toplevel', 'sort_index'],
1126 ],),
1127 title=_("Custom icons and actions"),
1128 movable=False,
1129 totext=_("%d icons and actions"),
1131 forth=lambda d: sorted(d.items()),
1132 back=dict,
1136 @config_variable_registry.register
1137 class ConfigVariableUserDowntimeTimeranges(ConfigVariable):
1138 def group(self):
1139 return ConfigVariableGroupUserInterface
1141 def domain(self):
1142 return ConfigDomainGUI
1144 def ident(self):
1145 return "user_downtime_timeranges"
1147 def valuespec(self):
1148 return ListOf(
1149 Dictionary(
1150 elements=[('title', TextUnicode(title=_('Title'),)),
1151 ('end',
1152 Alternative(
1153 title=_("To"),
1154 elements=[
1155 Age(
1156 title=_("Duration"),
1157 display=["minutes", "hours", "days"],
1159 DropdownChoice(
1160 title=_("Until"),
1161 choices=[
1162 ('next_day', _("Start of next day")),
1163 ('next_week', _("Start of next week")),
1164 ('next_month', _("Start of next month")),
1165 ('next_year', _("Start of next year")),
1167 default_value="next_day",
1170 style="dropdown",
1171 default_value=24 * 60 * 60,
1172 ))],
1173 optional_keys=[],
1175 title=_("Custom Downtime Timeranges"),
1176 movable=True,
1177 totext=_("%d timeranges"),
1181 @config_variable_registry.register
1182 class ConfigVariableBuiltinIconVisibility(ConfigVariable):
1183 def group(self):
1184 return ConfigVariableGroupUserInterface
1186 def domain(self):
1187 return ConfigDomainGUI
1189 def ident(self):
1190 return "builtin_icon_visibility"
1192 def valuespec(self):
1193 return Transform(
1194 ListOf(
1195 Tuple(
1196 elements=[
1197 DropdownChoice(
1198 title=_("Icon"),
1199 choices=self._get_builtin_icons,
1200 sorted=True,
1202 Dictionary(
1203 elements=[
1204 ('toplevel',
1205 Checkbox(
1206 title=_('Show in column'),
1207 label=_('Directly show the action icon in the column'),
1208 help=_('Makes the icon appear in the column instead '
1209 'of the dropdown menu.'),
1210 default_value=True,
1212 ('sort_index',
1213 Integer(
1214 title=_('Sort index'),
1215 help=
1216 _('You can use the sort index to control the order of the '
1217 'elements in the column and the menu. The elements are sorted '
1218 'from smaller to higher numbers. The action menu icon '
1219 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1220 'of <tt>20</tt>. All other default icons have a sort index of '
1221 '<tt>30</tt> configured.'),
1222 min_value=0,
1225 optional_keys=['toplevel', 'sort_index'],
1227 ],),
1228 title=_("Builtin icon visibility"),
1229 movable=False,
1230 totext=_("%d icons customized"),
1231 help=_("You can use this option to change the default visibility "
1232 "options of the builtin icons. You can change whether or not "
1233 "the icons are shown in the popup menu or on top level and "
1234 "change the sorting of the icons."),
1236 forth=lambda d: sorted(d.items()),
1237 back=dict,
1240 def _get_builtin_icons(self):
1241 return [(id_, id_) for id_ in icon_and_action_registry.keys()]
1244 @config_variable_registry.register
1245 class ConfigVariableServiceViewGrouping(ConfigVariable):
1246 def group(self):
1247 return ConfigVariableGroupUserInterface
1249 def domain(self):
1250 return ConfigDomainGUI
1252 def ident(self):
1253 return "service_view_grouping"
1255 def valuespec(self):
1256 return ListOf(
1257 Dictionary(
1258 elements=[
1259 ('title', TextUnicode(title=_('Title to show for the group'),)),
1260 ('pattern',
1261 RegExpUnicode(
1262 title=_('Grouping expression'),
1263 help=_('This regular expression is used to match the services to be put '
1264 'into this group. This is a prefix match regular expression.'),
1265 mode=RegExpUnicode.prefix,
1267 ('min_items',
1268 Integer(
1269 title=_('Minimum number of items to create a group'),
1270 help=_('When less than these items are found for a group, the services '
1271 'are not shown grouped together.'),
1272 min_value=2,
1273 default_value=2,
1276 optional_keys=[],
1278 title=_("Grouping of services in table views"),
1279 help=_(
1280 "You can use this option to make the service table views fold services matching "
1281 "the given patterns into groups. Only services in state <i>OK</i> will be folded "
1282 "together. Groups of only one service will not be rendered. If multiple patterns "
1283 "match a service, the service will be added to the first matching group."),
1284 add_label=_("Add new grouping definition"),
1288 @config_variable_registry.register
1289 class ConfigVariableTopologyDefaultFilterGroup(ConfigVariable):
1290 def group(self):
1291 return ConfigVariableGroupUserInterface
1293 def domain(self):
1294 return ConfigDomainGUI
1296 def ident(self):
1297 return "topology_default_filter_group"
1299 def valuespec(self):
1300 return Optional(
1301 DropdownChoice(
1302 choices=lambda: sites.all_groups("host"),
1303 sorted=True,
1305 title=_("Network Topology: Default Filter Group"),
1306 help=_(
1307 "By default the network topology view shows you the parent / child relations "
1308 "of all hosts within your local site. The list can be filtered based on hostgroup "
1309 "memberships by the users. You can define a default group to use for filtering "
1310 "which is used when a user opens the network topology view."),
1311 none_label=_("Show all hosts when opening the network topology view"),
1315 @config_variable_registry.register
1316 class ConfigVariableViewActionDefaults(ConfigVariable):
1317 def group(self):
1318 return ConfigVariableGroupUserInterface
1320 def domain(self):
1321 return ConfigDomainGUI
1323 def ident(self):
1324 return "view_action_defaults"
1326 def valuespec(self):
1327 return Dictionary(
1328 title=_("View action defaults"),
1329 elements=[
1330 ("ack_sticky", Checkbox(
1331 title=_("Sticky"),
1332 label=_("Enable"),
1333 default_value=True,
1335 ("ack_notify",
1336 Checkbox(
1337 title=_("Send notification"),
1338 label=_("Enable"),
1339 default_value=True,
1341 ("ack_persistent",
1342 Checkbox(
1343 title=_("Persistent comment"),
1344 label=_("Enable"),
1345 default_value=False,
1347 ("ack_expire",
1348 Age(
1349 title=_("Expire acknowledgement after"),
1350 display=["days", "hours", "minutes"],
1351 default_value=0,
1354 optional_keys=[],
1358 @config_variable_registry.register
1359 class ConfigVariableTrustedCertificateAuthorities(ConfigVariable):
1360 def group(self):
1361 return ConfigVariableGroupSiteManagement
1363 def domain(self):
1364 return ConfigDomainCACertificates
1366 def ident(self):
1367 return "trusted_certificate_authorities"
1369 def valuespec(self):
1370 return Dictionary(
1371 title=_("Trusted certificate authorities for SSL"),
1372 help=_("Whenever a server component of Check_MK opens a SSL connection it uses the "
1373 "certificate authorities configured here for verifying the SSL certificate of "
1374 "the destination server. This is used for example when performing WATO "
1375 "replication to slave sites or when special agents are communicating via HTTPS. "
1376 "The CA certificates configured here will be written to the CA bundle %s.") %
1377 site_neutral_path(ConfigDomainCACertificates.trusted_cas_file),
1378 elements=[
1379 ("use_system_wide_cas",
1380 Checkbox(
1381 title=_("Use system wide CAs"),
1382 help=_("All supported linux distributions provide a mechanism of managing "
1383 "trusted CAs. Depending on your linux distributions the paths where "
1384 "these CAs are stored and the commands to manage the CAs differ. "
1385 "Please checko out the documentation of your linux distribution "
1386 "in case you want to customize trusted CAs system wide. You can "
1387 "choose here to trust the system wide CAs here. Check_MK will search "
1388 "these directories for system wide CAs: %s") % ", ".join(
1389 ConfigDomainCACertificates.system_wide_trusted_ca_search_paths),
1390 label=_("Trust system wide configured CAs"),
1392 ("trusted_cas", ListOfCAs(
1393 title=_("Check_MK specific"),
1394 allow_empty=True,
1397 optional_keys=False,
1402 # .--WATO----------------------------------------------------------------.
1403 # | __ ___ _____ ___ |
1404 # | \ \ / / \|_ _/ _ \ |
1405 # | \ \ /\ / / _ \ | || | | | |
1406 # | \ V V / ___ \| || |_| | |
1407 # | \_/\_/_/ \_\_| \___/ |
1408 # | |
1409 # +----------------------------------------------------------------------+
1410 # | Global Configuration for WATO |
1411 # '----------------------------------------------------------------------'
1414 @config_variable_group_registry.register
1415 class ConfigVariableGroupWATO(ConfigVariableGroup):
1416 def title(self):
1417 return _("Administration Tool (WATO)")
1419 def sort_index(self):
1420 return 25
1423 @config_variable_registry.register
1424 class ConfigVariableWATOMaxSnapshots(ConfigVariable):
1425 def group(self):
1426 return ConfigVariableGroupWATO
1428 def domain(self):
1429 return ConfigDomainGUI
1431 def ident(self):
1432 return "wato_max_snapshots"
1434 def valuespec(self):
1435 return Integer(
1436 title=_("Number of configuration snapshots to keep"),
1437 help=_("Whenever you successfully activate changes a snapshot of the configuration "
1438 "will be created. You can also create snapshots manually. WATO will delete old "
1439 "snapshots when the maximum number of snapshots is reached."),
1440 minvalue=1,
1444 @config_variable_registry.register
1445 class ConfigVariableWATOActivationMethod(ConfigVariable):
1446 def group(self):
1447 return ConfigVariableGroupWATO
1449 def domain(self):
1450 return ConfigDomainGUI
1452 def ident(self):
1453 return "wato_activation_method"
1455 def valuespec(self):
1456 return DropdownChoice(
1457 title=_("WATO restart mode for Nagios"),
1458 help=_("Should WATO restart or reload Nagios when activating changes"),
1459 choices=[
1460 ('restart', _("Restart")),
1461 ('reload', _("Reload")),
1466 @config_variable_registry.register
1467 class ConfigVariableWATOLegacyEval(ConfigVariable):
1468 def group(self):
1469 return ConfigVariableGroupWATO
1471 def domain(self):
1472 return ConfigDomainGUI
1474 def ident(self):
1475 return "wato_legacy_eval"
1477 def valuespec(self):
1478 return Checkbox(
1479 title=_("Use unsafe legacy encoding for distributed WATO"),
1480 help=
1481 _("The current implementation of WATO uses a Python module called <tt>ast</tt> for the "
1482 "communication between sites. Previous versions of Check_MK used an insecure encoding "
1483 "named <tt>pickle</tt>. Even in the current version WATO falls back to <tt>pickle</tt> "
1484 "if your Python version is not recent enough. This is at least the case for RedHat/CentOS 5.X "
1485 "and Debian 5.0. In a mixed environment you can force using the legacy <tt>pickle</tt> format "
1486 "in order to create compatibility."),
1490 @config_variable_registry.register
1491 class ConfigVariableWATOHideFilenames(ConfigVariable):
1492 def group(self):
1493 return ConfigVariableGroupWATO
1495 def domain(self):
1496 return ConfigDomainGUI
1498 def ident(self):
1499 return "wato_hide_filenames"
1501 def valuespec(self):
1502 return Checkbox(
1503 title=_("Hide internal folder names in WATO"),
1504 label=_("hide folder names"),
1505 help=_("When enabled, then the internal names of WATO folder in the filesystem "
1506 "are not shown. They will automatically be derived from the name of the folder "
1507 "when a new folder is being created. Disable this option if you want to see and "
1508 "set the filenames manually."),
1512 @config_variable_registry.register
1513 class ConfigVariableWATOUploadInsecureSnapshots(ConfigVariable):
1514 def group(self):
1515 return ConfigVariableGroupWATO
1517 def domain(self):
1518 return ConfigDomainGUI
1520 def ident(self):
1521 return "wato_upload_insecure_snapshots"
1523 def valuespec(self):
1524 return Checkbox(
1525 title=_("Allow upload of insecure WATO snapshots"),
1526 label=_("upload insecure snapshots"),
1527 help=
1528 _("When enabled, insecure snapshots are allowed. Please keep in mind that the upload "
1529 "of unverified snapshots represents a security risk, since the content of a snapshot is executed "
1530 "during runtime. Any manipulations in the content - either willingly or unwillingly (XSS attack) "
1531 "- pose a serious security risk."),
1535 @config_variable_registry.register
1536 class ConfigVariableWATOHideHosttags(ConfigVariable):
1537 def group(self):
1538 return ConfigVariableGroupWATO
1540 def domain(self):
1541 return ConfigDomainGUI
1543 def ident(self):
1544 return "wato_hide_hosttags"
1546 def valuespec(self):
1547 return Checkbox(
1548 title=_("Hide hosttags in WATO folder view"),
1549 label=_("hide hosttags"),
1550 help=_("When enabled, hosttags are no longer shown within the WATO folder view"),
1554 @config_variable_registry.register
1555 class ConfigVariableWATOHideVarnames(ConfigVariable):
1556 def group(self):
1557 return ConfigVariableGroupWATO
1559 def domain(self):
1560 return ConfigDomainGUI
1562 def ident(self):
1563 return "wato_hide_varnames"
1565 def valuespec(self):
1566 return Checkbox(
1567 title=_("Hide names of configuration variables"),
1568 label=_("hide variable names"),
1569 help=_("When enabled, internal configuration variable names of Check_MK are hidden "
1570 "from the user (for example in the rule editor)"),
1574 @config_variable_registry.register
1575 class ConfigVariableHideHelpInLists(ConfigVariable):
1576 def group(self):
1577 return ConfigVariableGroupWATO
1579 def domain(self):
1580 return ConfigDomainGUI
1582 def ident(self):
1583 return "wato_hide_help_in_lists"
1585 def valuespec(self):
1586 return Checkbox(
1587 title=_("Hide help text of rules in list views"),
1588 label=_("hide help text"),
1589 help=_("When disabled, WATO shows the help texts of rules also in the list views."),
1593 @config_variable_registry.register
1594 class ConfigVariableWATOUseGit(ConfigVariable):
1595 def group(self):
1596 return ConfigVariableGroupWATO
1598 def domain(self):
1599 return ConfigDomainGUI
1601 def ident(self):
1602 return "wato_use_git"
1604 def valuespec(self):
1605 return Checkbox(
1606 title=_("Use GIT version control for WATO"),
1607 label=_("enable GIT version control"),
1608 help=_(
1609 "When enabled, all changes of configuration files are tracked with the "
1610 "version control system GIT. You need to make sure that git is installed "
1611 "on your monitoring server. The version history currently cannot be viewed "
1612 "via the web GUI. Please use git command line tools within your Check_MK "
1613 "configuration directory. If you want easier tracking of configuration file changes "
1614 "simply enable the global settings option <tt>Pretty print configuration files</tt>"
1619 @config_variable_registry.register
1620 class ConfigVariableWATOPrettyPrintConfig(ConfigVariable):
1621 def group(self):
1622 return ConfigVariableGroupWATO
1624 def domain(self):
1625 return ConfigDomainGUI
1627 def ident(self):
1628 return "wato_pprint_config"
1630 def valuespec(self):
1631 return Checkbox(
1632 title=_("Pretty-Print configuration files"),
1633 label=_("pretty-print configuration files"),
1634 help=
1635 _("When enabled, most of the configuration files are pretty printed and easier to read. "
1636 "On the downside, however, pretty printing bigger configurations can be quite slow - "
1637 "so the overall WATO GUI performance will decrease."),
1641 @config_variable_registry.register
1642 class ConfigVariableWATOHideFoldersWithoutReadPermissions(ConfigVariable):
1643 def group(self):
1644 return ConfigVariableGroupWATO
1646 def domain(self):
1647 return ConfigDomainGUI
1649 def ident(self):
1650 return "wato_hide_folders_without_read_permissions"
1652 def valuespec(self):
1653 return Checkbox(
1654 title=_("Hide folders without read permissions"),
1655 label=_("hide folders without read permissions"),
1656 help=_(
1657 "When enabled, a subfolder is not shown, when the user does not have sufficient "
1658 "permissions to this folder and all of its subfolders. However, the subfolder is "
1659 "shown if the user has permissions to any of its subfolder."),
1663 @config_variable_registry.register
1664 class ConfigVariableWATOIconCategories(ConfigVariable):
1665 def group(self):
1666 return ConfigVariableGroupWATO
1668 def domain(self):
1669 return ConfigDomainGUI
1671 def ident(self):
1672 return "wato_icon_categories"
1674 def valuespec(self):
1675 return ListOf(
1676 Tuple(
1677 elements=[
1678 ID(title=_("ID"),),
1679 TextUnicode(title=_("Title"),),
1681 orientation="horizontal",
1683 title=_("Icon categories"),
1684 help=_("You can customize the list of icon categories to be able to assign "
1685 "your <a href=\"?mode=icons\">custom icons</a> to these categories. "
1686 "They will then be shown under this category in the icon selector."),
1691 # .--User Management-----------------------------------------------------.
1692 # | _ _ __ __ _ |
1693 # | | | | |___ ___ _ __ | \/ | __ _ _ __ ___ | |_ |
1694 # | | | | / __|/ _ \ '__| | |\/| |/ _` | '_ ` _ \| __| |
1695 # | | |_| \__ \ __/ | | | | | (_| | | | | | | |_ |
1696 # | \___/|___/\___|_| |_| |_|\__, |_| |_| |_|\__| |
1697 # | |___/ |
1698 # +----------------------------------------------------------------------+
1699 # | Global settings for users and LDAP connector. |
1700 # '----------------------------------------------------------------------'
1703 @config_variable_group_registry.register
1704 class ConfigVariableGroupUserManagement(ConfigVariableGroup):
1705 def title(self):
1706 return _("User Management")
1708 def sort_index(self):
1709 return 40
1712 @config_variable_registry.register
1713 class ConfigVariableLockOnLogonFailures(ConfigVariable):
1714 def group(self):
1715 return ConfigVariableGroupUserManagement
1717 def domain(self):
1718 return ConfigDomainGUI
1720 def ident(self):
1721 return "lock_on_logon_failures"
1723 def valuespec(self):
1724 return Optional(
1725 Integer(
1726 label=_("Number of logon failures to lock the account"),
1727 default_value=3,
1728 minvalue=1,
1730 none_value=False,
1731 title=_("Lock user accounts after N logon failures"),
1732 label=_("Activate automatic locking of user accounts"),
1733 help=_("This options enables automatic locking of user accounts after "
1734 "the configured number of consecutive invalid login attempts. "
1735 "Once the account is locked only an admin user can unlock it. "
1736 "Beware: Also the admin users will be locked that way. You need "
1737 "to manually edit <tt>etc/htpasswd</tt> and remove the <tt>!</tt> "
1738 "in case you are locked out completely."),
1742 @config_variable_registry.register
1743 class ConfigVariablePasswordPolicy(ConfigVariable):
1744 def group(self):
1745 return ConfigVariableGroupUserManagement
1747 def domain(self):
1748 return ConfigDomainGUI
1750 def ident(self):
1751 return "password_policy"
1753 def valuespec(self):
1754 return Dictionary(
1755 title=_('Password policy for local accounts'),
1756 help=_(
1757 'You can define some rules to which each user password ahers. By default '
1758 'all passwords are accepted, even ones which are made of only a single character, '
1759 'which is obviously a bad idea. Using this option you can enforce your users '
1760 'to choose more secure passwords.'),
1761 elements=[
1762 ('min_length', Integer(
1763 title=_("Minimum password length"),
1764 minvalue=1,
1766 ('num_groups',
1767 Integer(
1768 title=_("Number of character groups to use"),
1769 minvalue=1,
1770 maxvalue=4,
1771 help=_(
1772 "Force the user to choose a password that contains characters from at least "
1773 "this number of different character groups. "
1774 "Character groups are: <ul>"
1775 "<li>lowercase letters</li>"
1776 "<li>uppercase letters</li>"
1777 "<li>digits</li>"
1778 "<li>special characters such as an underscore or dash</li>"
1779 "</ul>"),
1781 ('max_age',
1782 Age(
1783 title=_("Maximum age of passwords"),
1784 minvalue=1,
1785 display=["days"],
1786 default_value=365 * 86400,
1792 @config_variable_registry.register
1793 class ConfigVariableUserIdleTimeout(ConfigVariable):
1794 def group(self):
1795 return ConfigVariableGroupUserManagement
1797 def domain(self):
1798 return ConfigDomainGUI
1800 def ident(self):
1801 return "user_idle_timeout"
1803 def valuespec(self):
1804 return Optional(
1805 Age(
1806 title=None,
1807 display=["minutes", "hours", "days"],
1808 minvalue=60,
1809 default_value=3600,
1811 title=_("Login session idle timeout"),
1812 label=_("Enable a login session idle timeout"),
1813 help=_("Normally a user login session is valid until the password is changed or "
1814 "the user is locked. By enabling this option, you can apply a time limit "
1815 "to login sessions which is applied when the user stops interacting with "
1816 "the GUI for a given amount of time. When a user is exceeding the configured "
1817 "maximum idle time, the user will be logged out and redirected to the login "
1818 "screen to renew the login session. This setting can be overriden for each "
1819 "user individually in the profile of the users."),
1823 @config_variable_registry.register
1824 class ConfigVariableSingleUserSession(ConfigVariable):
1825 def group(self):
1826 return ConfigVariableGroupUserManagement
1828 def domain(self):
1829 return ConfigDomainGUI
1831 def ident(self):
1832 return "single_user_session"
1834 def valuespec(self):
1835 return Optional(
1836 Age(
1837 title=None,
1838 display=["minutes", "hours"],
1839 label=_("Session timeout:"),
1840 minvalue=30,
1841 default_value=60,
1843 title=_("Limit login to single session at a time"),
1844 label=_("Users can only login from one client at a time"),
1845 help=_("Normally a user can login to the GUI from unlimited number of clients at "
1846 "the same time. If you want to enforce your users to be able to login only once "
1847 " (from one client which means device and browser), you can enable this option. "
1848 "When the user logs out or is inactive for the configured amount of time, the "
1849 "session is invalidated automatically and the user has to log in again from the "
1850 "current or another device."),
1854 @config_variable_registry.register
1855 class ConfigVariableDefaultUserProfile(ConfigVariable):
1856 def group(self):
1857 return ConfigVariableGroupUserManagement
1859 def domain(self):
1860 return ConfigDomainGUI
1862 def ident(self):
1863 return "default_user_profile"
1865 def valuespec(self):
1866 return Dictionary(
1867 title=_("Default user profile"),
1868 help=_(
1869 "With this option you can specify the attributes a user which is created during "
1870 "its initial login gets added. For example, the default is to add the role \"user\" "
1871 "to all automatically created users."),
1872 elements=self._default_user_profile_elements,
1873 optional_keys=[],
1876 def _default_user_profile_elements(self):
1877 elements = []
1879 if cmk.is_managed_edition():
1880 import cmk.gui.cme.managed as managed
1881 elements += managed.customer_choice_element()
1883 return elements + [
1884 ('roles',
1885 ListChoice(
1886 title=_('User roles'),
1887 help=_('Specify the initial roles of an automatically created user.'),
1888 default_value=['user'],
1889 choices=self._list_roles,
1891 ('contactgroups',
1892 ListChoice(
1893 title=_('Contact groups'),
1894 help=_('Specify the initial contact groups of an automatically created user.'),
1895 default_value=[],
1896 choices=self._list_contactgroups,
1898 ("force_authuser",
1899 Checkbox(
1900 title=_("Visibility of Hosts/Services"),
1901 label=_("Only show hosts and services the user is a contact for"),
1902 help=_("Specifiy the initial setting for an automatically created user."),
1903 default_value=False,
1907 def _list_roles(self):
1908 roles = userdb.load_roles()
1909 return [(i, r["alias"]) for i, r in roles.items()]
1911 def _list_contactgroups(self):
1912 contact_groups = userdb.load_group_information().get("contact", {})
1913 entries = [(c, g['alias']) for c, g in contact_groups.items()]
1914 return sorted(entries)
1917 @config_variable_registry.register
1918 class ConfigVariableSaveUserAccessTimes(ConfigVariable):
1919 def group(self):
1920 return ConfigVariableGroupUserManagement
1922 def domain(self):
1923 return ConfigDomainGUI
1925 def ident(self):
1926 return "save_user_access_times"
1928 def valuespec(self):
1929 return Checkbox(
1930 title=_("Save last access times of users"),
1931 label=_("Save the time of the latest user activity"),
1932 help=_("When enabled, the time of the last access is stored for each user. The last "
1933 "activity is shown on the users page."),
1938 # .--Check_MK------------------------------------------------------------.
1939 # | ____ _ _ __ __ _ __ |
1940 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
1941 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
1942 # | | |___| | | | __/ (__| < | | | | . \ |
1943 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
1944 # | |_____| |
1945 # +----------------------------------------------------------------------+
1946 # | Operation mode of Check_MK |
1947 # '----------------------------------------------------------------------'
1950 @config_variable_group_registry.register
1951 class ConfigVariableGroupCheckExecution(ConfigVariableGroup):
1952 def title(self):
1953 return _("Execution of checks")
1955 def sort_index(self):
1956 return 10
1959 @config_variable_registry.register
1960 class ConfigVariableUseNewDescriptionsFor(ConfigVariable):
1961 def group(self):
1962 return ConfigVariableGroupCheckExecution
1964 def domain(self):
1965 return ConfigDomainCore
1967 def ident(self):
1968 return "use_new_descriptions_for"
1970 def valuespec(self):
1971 return ListChoice(
1972 title=_("Use new service descriptions"),
1973 help=_(
1974 "In order to make Check_MK more consistent, "
1975 "the descriptions of several services have been renamed in newer "
1976 "Check_MK versions. One example is the filesystem services that have "
1977 "been renamed from <tt>fs_</tt> into <tt>Filesystem</tt>. But since renaming "
1978 "of existing services has many implications - including existing rules, performance "
1979 "data and availability history - these renamings are disabled per default for "
1980 "existing installations. Here you can switch to the new descriptions for "
1981 "selected check types"),
1982 choices=[
1983 ("df", _("Used space in filesystems")),
1984 ("df_netapp", _("NetApp Filers: Used Space in Filesystems")),
1985 ("df_netapp32", _("NetApp Filers: Used space in Filesystem Using 32-Bit Counters")),
1986 ("esx_vsphere_datastores", _("VMWare ESX host systems: Used space")),
1987 ("hr_fs", _("Used space in filesystems via SNMP")),
1988 ("vms_diskstat.df", _("Disk space on OpenVMS")),
1989 ("zfsget", _("Used space in ZFS pools and filesystems")),
1990 ("ps", _("State and Count of Processes")),
1991 ("ps.perf", _("State and Count of Processes (with additional performance data)")),
1992 ("wmic_process", _("Resource consumption of windows processes")),
1993 ("services", _("Windows Services")),
1994 ("logwatch", _("Check logfiles for relevant new messages")),
1995 ("logwatch.groups", _("Check logfile groups")),
1996 ("cmk-inventory", _("Monitor hosts for unchecked services (Check_MK Discovery)")),
1997 ("hyperv_vms", _("Hyper-V Server: State of VMs")),
1998 ("ibm_svc_mdiskgrp",
1999 _("IBM SVC / Storwize V3700 / V7000: Status and Usage of MDisksGrps")),
2000 ("ibm_svc_system", _("IBM SVC / V7000: System Info")),
2001 ("ibm_svc_systemstats.diskio",
2002 _("IBM SVC / V7000: Disk Throughput for Drives/MDisks/VDisks in Total")),
2003 ("ibm_svc_systemstats.iops",
2004 _("IBM SVC / V7000: IO operations/sec for Drives/MDisks/VDisks in Total")),
2005 ("ibm_svc_systemstats.disk_latency",
2006 _("IBM SVC / V7000: Latency for Drives/MDisks/VDisks in Total")),
2007 ("ibm_svc_systemstats.cache", _("IBM SVC / V7000: Cache Usage in Total")),
2008 ("casa_cpu_temp", _("Casa module: CPU temperature")),
2009 ("cmciii.temp", _("Rittal CMC-III Units: Temperatures")),
2010 ("cmciii.psm_current", _("Rittal CMC-III Units: Current")),
2011 ("cmciii_lcp_airin", _("Rittal CMC-III LCP: Air In and Temperature")),
2012 ("cmciii_lcp_airout", _("Rittal CMC-III LCP: Air Out Temperature")),
2013 ("cmciii_lcp_water", _("Rittal CMC-III LCP: Water In/Out Temperature")),
2014 ("etherbox.temp", _("Etherbox / MessPC: Sensor Temperature")),
2015 ("liebert_bat_temp", _("Liebert UPS Device: Temperature sensor")),
2016 ("nvidia.temp", _("Temperatures of NVIDIA graphics card")),
2017 ("ups_bat_temp", _("Generic UPS Device: Temperature sensor")),
2018 ("innovaphone_temp", _("Innovaphone Gateway: Current Temperature")),
2019 ("enterasys_temp", _("Enterasys Switch: Temperature")),
2020 ("raritan_emx", _("Raritan EMX Rack: Temperature")),
2021 ("raritan_pdu_inlet", _("Raritan PDU: Input Phases")),
2022 ("mknotifyd", _("Notification Spooler")),
2023 ("mknotifyd.connection", _("Notification Spooler Connection")),
2024 ("postfix_mailq", _("Postfix: Mail Queue")),
2025 ("nullmailer_mailq", _("Nullmailer: Mail Queue")),
2026 ("barracuda_mailqueues", _("Barracuda: Mail Queue")),
2027 ("qmail_stats", _("Qmail: Mail Queue")),
2028 ("http", _("Check HTTP: Use HTTPS instead of HTTP for SSL/TLS connections")),
2029 ("mssql_backup", _("MSSQL Backup")),
2030 ("mssql_counters.cache_hits", _("MSSQL Cache Hits")),
2031 ("mssql_counters.transactions", _("MSSQL Transactions")),
2032 ("mssql_counters.locks", _("MSSQL Locks")),
2033 ("mssql_counters.sqlstats", _("MSSQL SQL Stats")),
2034 ("mssql_counters.pageactivity", _("MSSQL Page Activity")),
2035 ("mssql_counters.locks_per_batch", _("MSSQL Locks per Batch")),
2036 ("mssql_counters.file_sizes", _("MSSQL File Sizes")),
2037 ("mssql_databases", _("MSSQL Database")),
2038 ("mssql_datafiles", _("MSSQL Datafile")),
2039 ("mssql_tablespaces", _("MSSQL Tablespace")),
2040 ("mssql_transactionlogs", _("MSSQL Transactionlog")),
2041 ("mssql_versions", _("MSSQL Version")),
2042 ("mssql_blocked_sessions", _("MSSQL Blocked Sessions")),
2044 render_orientation="vertical",
2048 @config_variable_registry.register
2049 class ConfigVariableTCPConnectTimeout(ConfigVariable):
2050 def group(self):
2051 return ConfigVariableGroupCheckExecution
2053 def domain(self):
2054 return ConfigDomainCore
2056 def ident(self):
2057 return "tcp_connect_timeout"
2059 def valuespec(self):
2060 return Float(
2061 title=_("Agent TCP connect timeout"),
2062 help=_(
2063 "Timeout for TCP connect to agent in seconds. If the connection "
2064 "to the agent cannot be established within this time, it is considered to be unreachable. "
2065 "Note: This does <b>not</b> limit the time the agent needs to "
2066 "generate its output."),
2067 minvalue=1.0,
2068 unit="sec",
2072 @config_variable_registry.register
2073 class ConfigVariableSimulationMode(ConfigVariable):
2074 def group(self):
2075 return ConfigVariableGroupCheckExecution
2077 def domain(self):
2078 return ConfigDomainCore
2080 def ident(self):
2081 return "simulation_mode"
2083 def valuespec(self):
2084 return Checkbox(
2085 title=_("Simulation mode"),
2086 label=_("Run in simulation mode"),
2087 help=_("This boolean variable allows you to bring check_mk into a dry run mode. "
2088 "No hosts will be contacted, no DNS lookups will take place and data is read "
2089 "from cache files that have been created during normal operation or have "
2090 "been copied here from another monitoring site."),
2094 @config_variable_registry.register
2095 class ConfigVariableRestartLocking(ConfigVariable):
2096 def group(self):
2097 return ConfigVariableGroupCheckExecution
2099 def domain(self):
2100 return ConfigDomainCore
2102 def ident(self):
2103 return "restart_locking"
2105 def valuespec(self):
2106 return DropdownChoice(
2107 title=_("Simultanous activation of changes"),
2108 help=_("When two users simultanously try to activate the changes then "
2109 "you can decide to abort with an error (default) or have the requests "
2110 "serialized. It is also possible - but not recommended - to turn "
2111 "off locking altogether."),
2112 choices=[
2113 ('abort', _("Abort with an error")),
2114 ('wait', _("Wait until the other has finished")),
2115 (None, _("Disable locking")),
2120 @config_variable_registry.register
2121 class ConfigVariableAgentSimulator(ConfigVariable):
2122 def group(self):
2123 return ConfigVariableGroupCheckExecution
2125 def domain(self):
2126 return ConfigDomainCore
2128 def ident(self):
2129 return "agent_simulator"
2131 def valuespec(self):
2132 return Checkbox(
2133 title=_("SNMP Agent Simulator"),
2134 label=_("Process stored SNMP walks with agent simulator"),
2135 help=_("When using stored SNMP walks you can place inline code generating "
2136 "dynamic simulation data. This feature can be activated here. There "
2137 "is a big chance that you will never need this feature..."),
2141 @config_variable_registry.register
2142 class ConfigVariableDelayPrecompile(ConfigVariable):
2143 def group(self):
2144 return ConfigVariableGroupCheckExecution
2146 def domain(self):
2147 return ConfigDomainCore
2149 def ident(self):
2150 return "delay_precompile"
2152 def valuespec(self):
2153 return Checkbox(
2154 title=_("Delay precompiling of host checks"),
2155 label=_("delay precompiling"),
2156 help=_(
2157 "If you enable this option, then Check_MK will not directly Python-bytecompile "
2158 "all host checks when activating the configuration and restarting Nagios. "
2159 "Instead it will delay this to the first "
2160 "time the host is actually checked being by Nagios.<p>This reduces the time needed "
2161 "for the operation, but on the other hand will lead to a slightly higher load "
2162 "of Nagios for the first couple of minutes after the restart. "),
2166 @config_variable_registry.register
2167 class ConfigVariableClusterMaxCachefileAge(ConfigVariable):
2168 def group(self):
2169 return ConfigVariableGroupCheckExecution
2171 def domain(self):
2172 return ConfigDomainCore
2174 def ident(self):
2175 return "cluster_max_cachefile_age"
2177 def valuespec(self):
2178 return Integer(
2179 title=_("Maximum cache file age for clusters"),
2180 label=_("seconds"),
2181 help=_("The number of seconds a cache file may be old if check_mk should "
2182 "use it instead of getting information from the target hosts while "
2183 "checking a cluster. Per default this is enabled and set to 90 seconds. "
2184 "If your check cycle is set to a larger value than one minute then "
2185 "you should increase this accordingly."),
2189 @config_variable_registry.register
2190 class ConfigVariablePiggybackMaxCachefileAge(ConfigVariable):
2191 def group(self):
2192 return ConfigVariableGroupCheckExecution
2194 def domain(self):
2195 return ConfigDomainCore
2197 def ident(self):
2198 return "piggyback_max_cachefile_age"
2200 def valuespec(self):
2201 return Age(
2202 title=_("Maximum age for piggyback files"),
2203 help=_(
2204 "The maximum age for piggy back data from another host to be valid for monitoring. "
2205 "Older files are deleted before processing them. Please make sure that this age is "
2206 "at least as large as you normal check interval for piggy hosts."),
2210 @config_variable_registry.register
2211 class ConfigVariableCheckMKPerfdataWithTimes(ConfigVariable):
2212 def group(self):
2213 return ConfigVariableGroupCheckExecution
2215 def domain(self):
2216 return ConfigDomainCore
2218 def ident(self):
2219 return "check_mk_perfdata_with_times"
2221 def valuespec(self):
2222 return Checkbox(
2223 title=_("Check_MK with times performance data"),
2224 label=_("Return process times within performance data"),
2225 help=_("Enabling this option results in additional performance data "
2226 "for the Check_MK output, giving information regarding the process times. "
2227 "It provides the following fields: user_time, system_time, children_user_time "
2228 "and children_system_time"),
2232 @config_variable_registry.register
2233 class ConfigVariableUseDNSCache(ConfigVariable):
2234 def group(self):
2235 return ConfigVariableGroupCheckExecution
2237 def domain(self):
2238 return ConfigDomainCore
2240 def ident(self):
2241 return "use_dns_cache"
2243 def valuespec(self):
2244 return Checkbox(
2245 title=_("Use DNS lookup cache"),
2246 label=_("Prevent DNS lookups by use of a cache file"),
2247 help=_(
2248 "When this option is enabled (which is the default), then Check_MK tries to "
2249 "prevent IP address lookups during the configuration generation. This can speed "
2250 "up this process greatly when you have a larger number of hosts. The cache is stored "
2251 "in a simple file. Note: when the cache is enabled then changes of the IP address "
2252 "of a host in your name server will not be detected immediately. If you need an "
2253 "immediate update then simply disable the cache once, activate the changes and "
2254 "enabled it again. OMD based installations automatically update the cache once "
2255 "a day."),
2259 @config_variable_registry.register
2260 class ConfigVariableUseInlineSNMP(ConfigVariable):
2261 def group(self):
2262 return ConfigVariableGroupCheckExecution
2264 def domain(self):
2265 return ConfigDomainCore
2267 def ident(self):
2268 return "use_inline_snmp"
2270 def valuespec(self):
2271 return Checkbox(
2272 title=_("Use Inline SNMP"),
2273 label=_("Enable inline SNMP (directly use net-snmp libraries)"),
2274 help=_(
2275 "By default Check_MK uses command line calls of Net-SNMP tools like snmpget or "
2276 "snmpwalk to gather SNMP information. For each request a new command line "
2277 "program is being executed. It is now possible to use the inline SNMP implementation "
2278 "which calls the net-snmp libraries directly via its python bindings. This "
2279 "should increase the performance of SNMP checks in a significant way. The inline "
2280 "SNMP mode is a feature which improves the performance for large installations and "
2281 "only available via our subscription."),
2285 @config_variable_registry.register
2286 class ConfigVariableRecordInlineSNMPStats(ConfigVariable):
2287 def group(self):
2288 return ConfigVariableGroupCheckExecution
2290 def domain(self):
2291 return ConfigDomainCore
2293 def ident(self):
2294 return "record_inline_snmp_stats"
2296 def valuespec(self):
2297 return Checkbox(
2298 title=_("Record statistics of Inline SNMP"),
2299 label=_("Enable recording of Inline SNMP statistics"),
2300 help=_(
2301 "When you have enabled Inline SNMP, you can use this flag to enable recording of "
2302 "some performance related values. The recorded values are stored in a single file "
2303 "at <tt>var/check_mk/snmp.stats</tt>.<br><br>"
2304 "<i>Please note:</i> Only enable this for a short period, because it will "
2305 "decrease the performance of your monitoring."),
2309 @config_variable_registry.register
2310 class ConfigVariableHTTPProxies(ConfigVariable):
2311 def group(self):
2312 return ConfigVariableGroupCheckExecution
2314 def domain(self):
2315 return ConfigDomainCore
2317 def ident(self):
2318 return "http_proxies"
2320 def valuespec(self):
2321 return Transform(
2322 ListOf(
2323 Dictionary(
2324 title=_("HTTP proxy"),
2325 elements=[
2326 ("ident",
2328 title=_("Unique ID"),
2329 help=_(
2330 "The ID must be a unique text. It will be used as an internal key "
2331 "when objects refer to this object."),
2332 allow_empty=False,
2334 ("title",
2335 TextUnicode(
2336 title=_("Title"),
2337 help=_("The title of the %s. It will be used as display name.") %
2338 _("HTTP proxy"),
2339 allow_empty=False,
2340 size=80,
2342 ("proxy_url", HTTPProxyInput()),
2344 optional_keys=None,
2346 title=_("HTTP proxies"),
2347 movable=False,
2348 totext=_("%d HTTP proxy servers configured"),
2349 help=_("Use this option to configure one or several proxy servers that can then be "
2350 "used in different places to establish connections to services using these "
2351 "HTTP proxies."),
2352 validate=self._validate_proxies,
2354 forth=lambda v: v.values(),
2355 back=lambda v: {p["ident"]: p for p in v},
2358 def _validate_proxies(self, value, varprefix):
2359 seen_idents, seen_titles = [], []
2360 for http_proxy in value:
2361 if http_proxy["ident"] in seen_idents:
2362 raise MKUserError(
2363 varprefix,
2364 _("Found multiple proxies using the ID '%s'") % http_proxy["ident"])
2365 seen_idents.append(http_proxy["ident"])
2367 if http_proxy["title"] in seen_titles:
2368 raise MKUserError(
2369 varprefix,
2370 _("Found multiple proxies using the title '%s'") % http_proxy["title"])
2371 seen_titles.append(http_proxy["title"])
2374 @config_variable_group_registry.register
2375 class ConfigVariableGroupServiceDiscovery(ConfigVariableGroup):
2376 def title(self):
2377 return _("Service discovery")
2379 def sort_index(self):
2380 return 4
2383 @config_variable_registry.register
2384 class ConfigVariableInventoryCheckInterval(ConfigVariable):
2385 def group(self):
2386 return ConfigVariableGroupServiceDiscovery
2388 def domain(self):
2389 return ConfigDomainCore
2391 def ident(self):
2392 return "inventory_check_interval"
2394 def valuespec(self):
2395 return Optional(
2396 Integer(
2397 title=_("Perform service discovery check every"),
2398 unit=_("minutes"),
2399 min_value=1,
2400 default_value=720),
2401 title=_("Enable regular service discovery checks (deprecated)"),
2402 help=_("If enabled, Check_MK will create one additional service per host "
2403 "that does a regular check, if the service discovery would find new services "
2404 "currently un-monitored. <b>Note:</b> This option is deprecated and has been "
2405 "replaced by the rule set <a href='%s'>Periodic Service Discovery</a>, "
2406 "which allows a per-host configuration and additional features such as "
2407 "automatic rediscovery. Rules in that rule set will override the global "
2408 "settings done here.") % "wato.py?mode=edit_ruleset&varname=periodic_discovery",
2412 @config_variable_registry.register
2413 class ConfigVariableInventoryCheckSeverity(ConfigVariable):
2414 def group(self):
2415 return ConfigVariableGroupServiceDiscovery
2417 def domain(self):
2418 return ConfigDomainCore
2420 def ident(self):
2421 return "inventory_check_severity"
2423 def valuespec(self):
2424 return DropdownChoice(
2425 title=_("Severity of failed service discovery check"),
2426 help=_("Please select which alarm state the service discovery check services "
2427 "shall assume in case that un-monitored services are found."),
2428 choices=[
2429 (0, _("OK - do not alert, just display")),
2430 (1, _("Warning")),
2431 (2, _("Critical")),
2432 (3, _("Unknown")),
2437 @config_variable_registry.register
2438 class ConfigVariableInventoryCheckDoScan(ConfigVariable):
2439 def group(self):
2440 return ConfigVariableGroupServiceDiscovery
2442 def domain(self):
2443 return ConfigDomainCore
2445 def ident(self):
2446 return "inventory_check_do_scan"
2448 def valuespec(self):
2449 return DropdownChoice(
2450 title=_("Service discovery check for SNMP devices"),
2451 choices=[
2452 (True, _("Perform full SNMP scan always, detect new check types")),
2453 (False, _("Just rely on existing check files, detect new items only")),
2458 @config_variable_registry.register
2459 class ConfigVariableInventoryCheckAutotrigger(ConfigVariable):
2460 def group(self):
2461 return ConfigVariableGroupServiceDiscovery
2463 def domain(self):
2464 return ConfigDomainCore
2466 def ident(self):
2467 return "inventory_check_autotrigger"
2469 def valuespec(self):
2470 return Checkbox(
2471 title=_("Service discovery triggers service discovery check"),
2472 label=_(
2473 "Automatically schedule service discovery check after service configuration changes"
2475 help=_("When this option is enabled then after each change of the service "
2476 "configuration of a host via WATO - may it be via manual changes or a bulk "
2477 "discovery - the service discovery check is automatically rescheduled in order "
2478 "to reflect the new service state correctly immediately."),
2483 # .--Rulesets------------------------------------------------------------.
2484 # | ____ _ _ |
2485 # | | _ \ _ _| | ___ ___ ___| |_ ___ |
2486 # | | |_) | | | | |/ _ \/ __|/ _ \ __/ __| |
2487 # | | _ <| |_| | | __/\__ \ __/ |_\__ \ |
2488 # | |_| \_\\__,_|_|\___||___/\___|\__|___/ |
2489 # | |
2490 # +----------------------------------------------------------------------+
2491 # | Rulesets for hosts and services except check parameter rules. |
2492 # '----------------------------------------------------------------------'
2495 @rulespec_group_registry.register
2496 class RulespecGroupGrouping(RulespecGroup):
2497 @property
2498 def name(self):
2499 return "grouping"
2501 @property
2502 def title(self):
2503 return _("Grouping")
2505 @property
2506 def help(self):
2507 return _("Assignment of host & services to host, service and contacts groups.")
2510 register_rule(
2511 RulespecGroupGrouping,
2512 "host_groups",
2513 GroupSelection(
2514 "host",
2515 title=_("Assignment of hosts to host groups"),
2516 help=_("Hosts can be grouped together into host groups. The most common use case "
2517 "is to put hosts which belong together in a host group to make it possible "
2518 "to get them listed together in the status GUI.")),
2519 match="all")
2521 register_rule(
2522 RulespecGroupGrouping,
2523 "service_groups",
2524 GroupSelection("service", title=_("Assignment of services to service groups")),
2525 match="all",
2526 itemtype="service")
2528 register_rule(
2529 RulespecGroupGrouping,
2530 "host_contactgroups",
2531 GroupSelection("contact", title=_("Assignment of hosts to contact groups")),
2532 match="all")
2534 register_rule(
2535 RulespecGroupGrouping,
2536 "service_contactgroups",
2537 GroupSelection("contact", title=_("Assignment of services to contact groups")),
2538 match="all",
2539 itemtype="service")
2542 @rulespec_group_registry.register
2543 class RulespecGroupMonitoringConfiguration(RulespecGroup):
2544 @property
2545 def name(self):
2546 return "monconf"
2548 @property
2549 def title(self):
2550 return _("Monitoring Configuration")
2552 @property
2553 def help(self):
2554 return _(
2555 "Intervals for checking, retries, clustering, configuration for inventory and similar")
2558 @rulespec_group_registry.register
2559 class RulespecGroupMonitoringConfigurationServiceChecks(RulespecSubGroup):
2560 @property
2561 def main_group(self):
2562 return RulespecGroupMonitoringConfiguration
2564 @property
2565 def sub_group_name(self):
2566 return "service_checks"
2568 @property
2569 def title(self):
2570 return _("Service Checks")
2573 register_rule(
2574 RulespecGroupMonitoringConfigurationServiceChecks,
2575 "extra_service_conf:max_check_attempts",
2576 Integer(
2577 title=_("Maximum number of check attempts for service"),
2578 help=_("The maximum number of failed checks until a service problem state will "
2579 "be considered as <u>hard</u>. Only hard state trigger notifications. "),
2580 minvalue=1),
2581 itemtype="service")
2583 register_rule(
2584 RulespecGroupMonitoringConfigurationServiceChecks,
2585 "extra_service_conf:check_interval",
2586 Transform(
2587 Age(minvalue=1, default_value=60),
2588 forth=lambda v: int(v * 60),
2589 back=lambda v: float(v) / 60.0,
2590 title=_("Normal check interval for service checks"),
2591 help=_("Check_MK usually uses an interval of one minute for the active Check_MK "
2592 "check and for legacy checks. Here you can specify a larger interval. Please "
2593 "note, that this setting only applies to active checks (those with the "
2594 "reschedule button). If you want to change the check interval of "
2595 "the Check_MK service only, specify <tt><b>Check_MK$</b></tt> in the list "
2596 "of services."),
2598 itemtype="service")
2600 register_rule(
2601 RulespecGroupMonitoringConfigurationServiceChecks,
2602 "extra_service_conf:retry_interval",
2603 Transform(
2604 Age(minvalue=1, default_value=60),
2605 forth=lambda v: int(v * 60),
2606 back=lambda v: float(v) / 60.0,
2607 title=_("Retry check interval for service checks"),
2608 help=_("This setting is relevant if you have set the maximum number of check "
2609 "attempts to a number greater than one. In case a service check is not OK "
2610 "and the maximum number of check attempts is not yet reached, it will be "
2611 "rescheduled with this interval. The retry interval is usually set to a smaller "
2612 "value than the normal interval.<br><br>This setting only applies to "
2613 "active checks.")),
2614 itemtype="service")
2616 register_rule(
2617 RulespecGroupMonitoringConfigurationServiceChecks,
2618 "extra_service_conf:check_period",
2619 TimeperiodSelection(
2620 title=_("Check period for active services"),
2621 help=_("If you specify a notification period for a service then active checks "
2622 "of that service will only be done in that period. Please note, that the "
2623 "checks driven by Check_MK are passive checks and are not affected by this "
2624 "rule. You can use the rule for the active Check_MK check, however.")),
2625 itemtype="service")
2627 register_rule(
2628 RulespecGroupMonitoringConfigurationServiceChecks,
2629 "check_periods",
2630 TimeperiodSelection(
2631 title=_("Check period for passive Check_MK services"),
2632 help=_("If you specify a notification period for a Check_MK service then "
2633 "results will be processed only within this period.")),
2634 itemtype="service")
2636 register_rule(
2637 RulespecGroupMonitoringConfigurationServiceChecks,
2638 "extra_service_conf:process_perf_data",
2639 DropdownChoice(
2640 title=_("Enable/disable processing of perfdata for services"),
2641 help=_("This setting allows you to disable the processing of perfdata for a "
2642 "service completely."),
2643 choices=[("1", _("Enable processing of perfdata")),
2644 ("0", _("Disable processing of perfdata"))],
2646 itemtype="service")
2648 register_rule(
2649 RulespecGroupMonitoringConfigurationServiceChecks,
2650 "extra_service_conf:passive_checks_enabled",
2651 DropdownChoice(
2652 title=_("Enable/disable passive checks for services"),
2653 help=_("This setting allows you to disable the processing of passiv check results for a "
2654 "service."),
2655 choices=[("1", _("Enable processing of passive check results")),
2656 ("0", _("Disable processing of passive check results"))],
2658 itemtype="service")
2660 register_rule(
2661 RulespecGroupMonitoringConfigurationServiceChecks,
2662 "extra_service_conf:active_checks_enabled",
2663 DropdownChoice(
2664 title=_("Enable/disable active checks for services"),
2665 help=_("This setting allows you to disable or enable "
2666 "active checks for a service."),
2667 choices=[("1", _("Enable active checks")), ("0", _("Disable active checks"))],
2669 itemtype="service")
2672 @rulespec_group_registry.register
2673 class RulespecGroupMonitoringConfigurationHostChecks(RulespecSubGroup):
2674 @property
2675 def main_group(self):
2676 return RulespecGroupMonitoringConfiguration
2678 @property
2679 def sub_group_name(self):
2680 return "host_checks"
2682 @property
2683 def title(self):
2684 return _("Host Checks")
2687 register_rule(
2688 RulespecGroupMonitoringConfigurationHostChecks, "extra_host_conf:max_check_attempts",
2689 Integer(
2690 title=_("Maximum number of check attempts for host"),
2691 help=_("The maximum number of failed host checks until the host will be considered "
2692 "in a hard down state"),
2693 minvalue=1))
2695 register_rule(
2696 RulespecGroupMonitoringConfigurationHostChecks, "extra_host_conf:check_interval",
2697 Transform(
2698 Age(minvalue=1, default_value=60),
2699 forth=lambda v: int(v * 60),
2700 back=lambda v: float(v) / 60.0,
2701 title=_("Normal check interval for host checks"),
2702 help=_(
2703 "The default interval is set to 6 seconds for smart ping and one minute for all other. Here you can specify a larger "
2704 "interval. The host is contacted in this interval on a regular base. The host "
2705 "check is also being executed when a problematic service state is detected to check "
2706 "wether or not the service problem is resulting from a host problem.")))
2708 register_rule(
2709 RulespecGroupMonitoringConfigurationHostChecks, "extra_host_conf:retry_interval",
2710 Transform(
2711 Age(minvalue=1, default_value=60),
2712 forth=lambda v: int(v * 60),
2713 back=lambda v: float(v) / 60.0,
2714 title=_("Retry check interval for host checks"),
2715 help=_(
2716 "This setting is relevant if you have set the maximum number of check "
2717 "attempts to a number greater than one. In case a host check is not UP "
2718 "and the maximum number of check attempts is not yet reached, it will be "
2719 "rescheduled with this interval. The retry interval is usually set to a smaller "
2720 "value than the normal interval. The default is 6 seconds for smart ping and 60 seconds for all other."
2724 register_rule(
2725 RulespecGroupMonitoringConfigurationHostChecks,
2726 "extra_host_conf:check_period",
2727 TimeperiodSelection(
2728 title=_("Check period for hosts"),
2729 help=_("If you specify a check period for a host then active checks of that "
2730 "host will only take place within that period. In the rest of the time "
2731 "the state of the host will stay at its last status.")),
2735 def _host_check_command_choices():
2736 if config.user.may('wato.add_or_modify_executables'):
2737 custom_choice = [
2738 ("custom", _("Use a custom check plugin..."), PluginCommandLine()),
2740 else:
2741 custom_choice = []
2743 return [
2744 ("ping", _("PING (active check with ICMP echo request)")),
2745 ("smart", _("Smart PING (only with Check_MK Micro Core)")),
2746 ("tcp", _("TCP Connect"),
2747 Integer(label=_("to port:"), minvalue=1, maxvalue=65535, default_value=80)),
2748 ("ok", _("Always assume host to be up")),
2749 ("agent", _("Use the status of the Check_MK Agent")),
2750 ("service", _("Use the status of the service..."),
2751 TextUnicode(
2752 size=45,
2753 allow_empty=False,
2754 attrencode=True,
2755 help=_("You can use the macro <tt>$HOSTNAME$</tt> here. It will be replaced "
2756 "with the name of the current host."),
2758 ] + custom_choice
2761 register_rule(
2762 RulespecGroupMonitoringConfigurationHostChecks,
2763 "host_check_commands",
2764 CascadingDropdown(
2765 title=_("Host Check Command"),
2766 help=_("Usually Check_MK uses a series of PING (ICMP echo request) in order to determine "
2767 "whether a host is up. In some cases this is not possible, however. With this rule "
2768 "you can specify an alternative way of determining the host's state."),
2769 choices=_host_check_command_choices,
2770 default_value="ping",
2771 orientation="horizontal",
2773 match='first')
2776 @rulespec_group_registry.register
2777 class RulespecGroupMonitoringConfigurationNotifications(RulespecSubGroup):
2778 @property
2779 def main_group(self):
2780 return RulespecGroupMonitoringConfiguration
2782 @property
2783 def sub_group_name(self):
2784 return "notifications"
2786 @property
2787 def title(self):
2788 return _("Notifications")
2791 register_rule(
2792 RulespecGroupMonitoringConfigurationNotifications, "extra_host_conf:notifications_enabled",
2793 DropdownChoice(
2794 title=_("Enable/disable notifications for hosts"),
2795 help=_("This setting allows you to disable notifications about problems of a "
2796 "host completely. Per default all notifications are enabled. Sometimes "
2797 "it is more convenient to just disable notifications then to remove a "
2798 "host completely from the monitoring. Note: this setting has no effect "
2799 "on the notifications of service problems of a host."),
2800 choices=[("1", _("Enable host notifications")), ("0", _("Disable host notifications"))],
2803 register_rule(
2804 RulespecGroupMonitoringConfigurationNotifications,
2805 "extra_service_conf:notifications_enabled",
2806 DropdownChoice(
2807 title=_("Enable/disable notifications for services"),
2808 help=_("This setting allows you to disable notifications about problems of a "
2809 "service completely. Per default all notifications are enabled."),
2810 choices=[("1", _("Enable service notifications")), ("0",
2811 _("Disable service notifications"))],
2813 itemtype="service")
2815 register_rule(
2816 RulespecGroupMonitoringConfigurationNotifications,
2817 "extra_host_conf:notification_options",
2818 Transform(
2819 ListChoice(
2820 choices=[
2821 ("d", _("Host goes down")),
2822 ("u", _("Host gets unreachble")),
2823 ("r", _("Host goes up again")),
2824 ("f", _("Start or end of flapping state")),
2825 ("s", _("Start or end of a scheduled downtime")),
2827 default_value=["d", "r", "f", "s"],
2829 title=_("Notified events for hosts"),
2830 help=_("This ruleset allows you to restrict notifications of host problems to certain "
2831 "states, e.g. only notify on DOWN, but not on UNREACHABLE. Please select the types "
2832 "of events that should initiate notifications. Please note that several other "
2833 "filters must also be passed in order for notifications to finally being sent out."
2834 "<br><br>"
2835 "Please note: There is a difference between the Microcore and Nagios when you have "
2836 "a host that has no matching rule in this ruleset. In this case the Microcore will "
2837 "not send out UNREACHABLE notifications while the Nagios core would send out "
2838 "UNREACHABLE notifications. To align this behaviour, create a rule matching "
2839 "all your hosts and configure it to either send UNREACHABLE notifications or not."),
2840 forth=lambda x: x != 'n' and x.split(",") or [],
2841 back=lambda x: ",".join(x) or "n",
2845 register_rule(
2846 RulespecGroupMonitoringConfigurationNotifications,
2847 "extra_service_conf:notification_options",
2848 Transform(
2849 ListChoice(
2850 choices=[
2851 ("w", _("Service goes into warning state")),
2852 ("u", _("Service goes into unknown state")),
2853 ("c", _("Service goes into critical state")),
2854 ("r", _("Service recovers to OK")),
2855 ("f", _("Start or end of flapping state")),
2856 ("s", _("Start or end of a scheduled downtime")),
2858 default_value=["w", "u", "c", "r", "f", "s"],
2860 title=_("Notified events for services"),
2861 help=_("This ruleset allows you to restrict notifications of service problems to certain "
2862 "states, e.g. only notify on CRIT, but not on WARN. Please select the types "
2863 "of events that should initiate notifications. Please note that several other "
2864 "filters must also be passed in order for notifications to finally being sent out."),
2865 forth=lambda x: x != 'n' and x.split(",") or [],
2866 back=lambda x: ",".join(x) or "n",
2868 itemtype="service")
2870 register_rule(
2871 RulespecGroupMonitoringConfigurationNotifications,
2872 "extra_host_conf:notification_period",
2873 TimeperiodSelection(
2874 title=_("Notification period for hosts"),
2875 help=_("If you specify a notification period for a host then notifications "
2876 "about problems of that host (not of its services!) will only be sent "
2877 "if those problems occur within the notification period. Also you can "
2878 "filter out problems in the problems views for objects not being in "
2879 "their notification period (you can think of the notification period "
2880 "as the 'service time').")),
2883 register_rule(
2884 RulespecGroupMonitoringConfigurationNotifications,
2885 "extra_service_conf:notification_period",
2886 TimeperiodSelection(
2887 title=_("Notification period for services"),
2888 help=_("If you specify a notification period for a service then notifications "
2889 "about that service will only be sent "
2890 "if those problems occur within the notification period. Also you can "
2891 "filter out problems in the problems views for objects not being in "
2892 "their notification period (you can think of the notification period "
2893 "as the 'service time').")),
2894 itemtype="service")
2897 def transform_float_minutes_to_age(float_minutes):
2898 return int(float_minutes * 60)
2901 def transform_age_to_float_minutes(age):
2902 return float(age) / 60.0
2905 register_rule(
2906 RulespecGroupMonitoringConfigurationNotifications,
2907 "extra_host_conf:first_notification_delay",
2908 Transform(
2909 Age(
2910 minvalue=0,
2911 default_value=300,
2912 label=_("Delay:"),
2913 title=_("Delay host notifications"),
2914 help=_("This setting delays notifications about host problems by the "
2915 "specified amount of time. If the host is up again within that "
2916 "time, no notification will be sent out."),
2918 forth=transform_float_minutes_to_age,
2919 back=transform_age_to_float_minutes,
2921 factory_default=0.0,
2924 register_rule(
2925 RulespecGroupMonitoringConfigurationNotifications,
2926 "extra_service_conf:first_notification_delay",
2927 Transform(
2928 Age(
2929 minvalue=0,
2930 default_value=300,
2931 label=_("Delay:"),
2932 unit=_("minutes"),
2933 title=_("Delay service notifications"),
2934 help=_("This setting delays notifications about service problems by the "
2935 "specified amount of time. If the service is OK again within that "
2936 "time, no notification will be sent out."),
2938 forth=transform_float_minutes_to_age,
2939 back=transform_age_to_float_minutes,
2941 factory_default=0.0,
2942 itemtype="service")
2944 register_rule(
2945 RulespecGroupMonitoringConfigurationNotifications, "extra_host_conf:notification_interval",
2946 Optional(
2947 Transform(
2948 Float(minvalue=0.05, default_value=120.0, label=_("Interval:"), unit=_("minutes")),
2949 forth=float,
2951 title=_("Periodic notifications during host problems"),
2952 help=_("If you enable periodic notifications, then during a problem state "
2953 "of the host notifications will be sent out in regular intervals "
2954 "until the problem is acknowledged."),
2955 label=_("Enable periodic notifications"),
2956 none_label=_("disabled"),
2957 none_value=0.0,
2960 register_rule(
2961 RulespecGroupMonitoringConfigurationNotifications,
2962 "extra_service_conf:notification_interval",
2963 Optional(
2964 Transform(
2965 Float(minvalue=0.05, default_value=120.0, label=_("Interval:"), unit=_("minutes")),
2966 forth=float,
2968 title=_("Periodic notifications during service problems"),
2969 help=_("If you enable periodic notifications, then during a problem state "
2970 "of the service notifications will be sent out in regular intervals "
2971 "until the problem is acknowledged."),
2972 label=_("Enable periodic notifications"),
2973 none_label=_("disabled"),
2974 none_value=0.0,
2976 itemtype="service")
2978 register_rule(
2979 RulespecGroupMonitoringConfigurationNotifications, "extra_host_conf:flap_detection_enabled",
2980 DropdownChoice(
2981 title=_("Enable/disable flapping detection for hosts"),
2982 help=_("This setting allows you to disable the flapping detection for a "
2983 "host completely."),
2984 choices=[("1", _("Enable flap detection")), ("0", _("Disable flap detection"))],
2987 register_rule(
2988 RulespecGroupMonitoringConfigurationNotifications,
2989 "extra_service_conf:flap_detection_enabled",
2990 DropdownChoice(
2991 title=_("Enable/disable flapping detection for services"),
2992 help=_("This setting allows you to disable the flapping detection for a "
2993 "service completely."),
2994 choices=[("1", _("Enable flap detection")), ("0", _("Disable flap detection"))],
2996 itemtype="service")
2998 register_rule(
2999 RulespecGroupMonitoringConfigurationNotifications,
3000 "extra_service_conf:notes_url",
3001 TextAscii(
3002 label=_("URL:"),
3003 title=_("Notes URL for Services"),
3004 help=_("With this setting you can set links to documentations "
3005 "for each service"),
3006 attrencode=True,
3008 itemtype="service")
3010 register_rule(
3011 RulespecGroupMonitoringConfigurationNotifications,
3012 "extra_host_conf:notes_url",
3013 TextAscii(
3014 label=_("URL:"),
3015 title=_("Notes URL for Hosts"),
3016 help=_("With this setting you can set links to documentations "
3017 "for Hosts"),
3018 attrencode=True,
3022 register_rule(
3023 RulespecGroupMonitoringConfigurationNotifications,
3024 "extra_service_conf:display_name",
3025 TextUnicode(
3026 title=_("Alternative display name for Services"),
3027 help=_("This rule set allows you to specify an alternative name "
3028 "to be displayed for certain services. This name is available as "
3029 "a column when creating new views or modifying existing ones. "
3030 "It is always visible in the details view of a service. In the "
3031 "availability reporting there is an option for using that name "
3032 "instead of the normal service description. It does <b>not</b> automatically "
3033 "replace the normal service name in all views.<br><br><b>Note</b>: The "
3034 "purpose of this rule set is to define unique names for several well-known "
3035 "services. It cannot rename services in general."),
3036 size=64,
3037 attrencode=True,
3039 itemtype="service")
3042 @rulespec_group_registry.register
3043 class RulespecGroupMonitoringConfigurationInventoryAndCMK(RulespecSubGroup):
3044 @property
3045 def main_group(self):
3046 return RulespecGroupMonitoringConfiguration
3048 @property
3049 def sub_group_name(self):
3050 return "inventory_and_check_mk_settings"
3052 @property
3053 def title(self):
3054 return _("Inventory and Check_MK settings")
3057 register_rule(
3058 RulespecGroupMonitoringConfigurationInventoryAndCMK,
3059 "only_hosts",
3060 title=_("Hosts to be monitored"),
3061 help=_("By adding rules to this ruleset you can define a subset of your hosts "
3062 "to be actually monitored. As long as the rule set is empty "
3063 "all configured hosts will be monitored. As soon as you add at least one "
3064 "rule, only hosts with a matching rule will be monitored."),
3065 optional=True, # only_hosts is None per default
3068 register_rule(
3069 RulespecGroupMonitoringConfigurationInventoryAndCMK,
3070 "ignored_services",
3071 title=_("Disabled services"),
3072 help=_("Services that are declared as <u>disabled</u> by this rule set will not be added "
3073 "to a host during discovery (automatic service detection). Services that already "
3074 "exist will continued to be monitored but be marked as obsolete in the service "
3075 "list of a host."),
3076 itemtype="service")
3078 register_rule(
3079 RulespecGroupMonitoringConfigurationInventoryAndCMK, "ignored_checks",
3080 CheckTypeSelection(
3081 title=_("Disabled checks"),
3082 help=_("This ruleset is similar to 'Disabled services', but selects checks to be disabled "
3083 "by their <b>type</b>. This allows you to disable certain technical implementations "
3084 "such as filesystem checks via SNMP on hosts that also have the Check_MK agent "
3085 "installed."),
3088 register_rule(
3089 RulespecGroupMonitoringConfigurationInventoryAndCMK,
3090 "clustered_services",
3091 title=_("Clustered services"),
3092 help=_("When you define HA clusters in WATO then you also have to specify "
3093 "which services of a node should be assigned to the cluster and "
3094 "which services to the physical node. This is done by this ruleset. "
3095 "Please note that the rule will be applied to the <i>nodes</i>, not "
3096 "to the cluster.<br><br>Please make sure that you re-inventorize the "
3097 "cluster and the physical nodes after changing this ruleset."),
3098 itemtype="service")
3100 register_rule(
3101 RulespecGroupMonitoringConfigurationInventoryAndCMK, "periodic_discovery",
3102 Alternative(
3103 title=_("Periodic service discovery"),
3104 style="dropdown",
3105 default_value={
3106 "check_interval": 2 * 60,
3107 "severity_unmonitored": 1,
3108 "severity_vanished": 0,
3109 "inventory_check_do_scan": True,
3111 elements=[
3112 FixedValue(
3113 None,
3114 title=_("Do not perform periodic service discovery check"),
3115 totext=_("no discovery check"),
3117 Dictionary(
3118 title=_("Perform periodic service discovery check"),
3119 help=_(
3120 "If enabled, Check_MK will create one additional service per host "
3121 "that does a periodic check, if the service discovery would find new services "
3122 "that are currently not monitored."),
3123 elements=[
3124 ("check_interval",
3125 Transform(
3126 Age(minvalue=1, display=["days", "hours", "minutes"]),
3127 forth=lambda v: int(v * 60),
3128 back=lambda v: float(v) / 60.0,
3129 title=_("Perform service discovery every"),
3131 ("severity_unmonitored",
3132 DropdownChoice(
3133 title=_("Severity of unmonitored services"),
3134 help=_(
3135 "Please select which alarm state the service discovery check services "
3136 "shall assume in case that un-monitored services are found."),
3137 choices=[
3138 (0, _("OK - do not alert, just display")),
3139 (1, _("Warning")),
3140 (2, _("Critical")),
3141 (3, _("Unknown")),
3144 ("severity_vanished",
3145 DropdownChoice(
3146 title=_("Severity of vanished services"),
3147 help=_(
3148 "Please select which alarm state the service discovery check services "
3149 "shall assume in case that non-existing services are being monitored."
3151 choices=[
3152 (0, _("OK - do not alert, just display")),
3153 (1, _("Warning")),
3154 (2, _("Critical")),
3155 (3, _("Unknown")),
3158 ("inventory_check_do_scan",
3159 DropdownChoice(
3160 title=_("Service discovery check for SNMP devices"),
3161 choices=[
3162 (True, _("Perform full SNMP scan always, detect new check types")),
3163 (False, _("Just rely on existing check files, detect new items only"))
3164 ])),
3165 ("inventory_rediscovery",
3166 Dictionary(
3167 title=_("Automatically update service configuration"),
3168 help=_(
3169 "If active the check will not only notify about un-monitored services, "
3170 "it will also automatically add/remove them as neccessary."),
3171 elements=[
3172 ("mode",
3173 DropdownChoice(
3174 title=_("Mode"),
3175 choices=[(0, _("Add unmonitored services")),
3176 (1, _("Remove vanished services")),
3177 (2, _("Add unmonitored & remove vanished services")),
3178 (3, _("Refresh all services (tabula rasa)"))],
3179 orientation="vertical",
3180 default_value=0,
3182 ("group_time",
3183 Age(title=_("Group discovery and activation for up to"),
3184 help=_(
3185 "A delay can be configured here so that multiple "
3186 "discoveries can be activated in one go. This avoids frequent core "
3187 "restarts in situations with frequent services changes."),
3188 default_value=15 * 60,
3189 display=["hours", "minutes"])),
3190 ("excluded_time",
3191 ListOfTimeRanges(
3192 title=
3193 _("Never do discovery or activate changes in the following time ranges"
3195 help=_("This avoids automatic changes during these times so "
3196 "that the automatic system doesn't interfere with "
3197 "user activity."),
3199 ("activation",
3200 DropdownChoice(
3201 title=_("Automatic activation"),
3202 choices=[
3203 (True, _("Automatically activate changes")),
3204 (False, _("Do not activate changes")),
3206 default_value=True,
3207 help=_(
3208 "Here you can have the changes activated whenever services "
3209 "have been added or removed."),
3211 ("service_whitelist",
3212 ListOfStrings(
3213 title=_("Activate only services matching"),
3214 allow_empty=False,
3215 help=_(
3216 "Set service names or regular expression patterns here to "
3217 "allow only matching services to be activated automatically. "
3218 "If you set both this and \'Don't activate services matching\', "
3219 "both rules have to apply for a service to be activated."),
3221 ("service_blacklist",
3222 ListOfStrings(
3223 title=_("Don't activate services matching"),
3224 allow_empty=False,
3225 help=
3226 _("Set service names or regular expression patterns here to "
3227 "prevent matching services from being activated automatically. "
3228 "If you set both this and \'Activate only services matching\', "
3229 "both rules have to apply for a service to be activated."),
3232 optional_keys=["service_whitelist", "service_blacklist"],
3235 optional_keys=["inventory_rediscovery"],
3240 @rulespec_group_registry.register
3241 class RulespecGroupMonitoringConfigurationVarious(RulespecSubGroup):
3242 @property
3243 def main_group(self):
3244 return RulespecGroupMonitoringConfiguration
3246 @property
3247 def sub_group_name(self):
3248 return "various"
3250 @property
3251 def title(self):
3252 return _("Various")
3255 register_rule(
3256 RulespecGroupMonitoringConfigurationVarious,
3257 "clustered_services_mapping",
3258 TextAscii(
3259 title=_("Clustered services for overlapping clusters"),
3260 label=_("Assign services to the following cluster:"),
3261 help=_("It's possible to have clusters that share nodes. You could say that "
3262 "such clusters &quot;overlap&quot;. In such a case using the ruleset "
3263 "<i>Clustered services</i> is not sufficient since it would not be clear "
3264 "to which of the several possible clusters a service found on such a shared "
3265 "node should be assigned to. With this ruleset you can assign services and "
3266 "explicitely specify which cluster assign them to."),
3268 itemtype="service",
3271 register_rule(
3272 RulespecGroupMonitoringConfigurationVarious,
3273 "extra_host_conf:service_period",
3274 TimeperiodSelection(
3275 title=_("Service period for hosts"),
3276 help=_(
3277 "When it comes to availability reporting, you might want the report "
3278 "to cover only certain time periods, e.g. only Monday to Friday "
3279 "from 8:00 to 17:00. You can do this by specifying a service period "
3280 "for hosts or services. In the reporting you can then decide to "
3281 "include, exclude or ignore such periods und thus e.g. create a report "
3282 "of the availability just within or without these times. <b>Note</b>: Changes in the "
3283 "actual <i>definition</i> of a time period will only be reflected in "
3284 "times <i>after</i> that change. Selecting a different service period "
3285 "will also be reflected in the past.")),
3288 register_rule(
3289 RulespecGroupMonitoringConfigurationVarious,
3290 "extra_service_conf:service_period",
3291 TimeperiodSelection(
3292 title=_("Service period for services"),
3293 help=_(
3294 "When it comes to availability reporting, you might want the report "
3295 "to cover only certain time periods, e.g. only Monday to Friday "
3296 "from 8:00 to 17:00. You can do this by specifying a service period "
3297 "for hosts or services. In the reporting you can then decide to "
3298 "include, exclude or ignore such periods und thus e.g. create a report "
3299 "of the availability just within or without these times. <b>Note</b>: Changes in the "
3300 "actual <i>definition</i> of a time period will only be reflected in "
3301 "times <i>after</i> that change. Selecting a different service period "
3302 "will also be reflected in the past.")),
3303 itemtype="service")
3306 # .--User Interface------------------------------------------------------.
3307 # | _ _ ___ _ __ |
3308 # | | | | |___ ___ _ __ |_ _|_ __ | |_ ___ _ __ / _| __ _ ___ ___ |
3309 # | | | | / __|/ _ \ '__| | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \ |
3310 # | | |_| \__ \ __/ | | || | | | || __/ | | _| (_| | (_| __/ |
3311 # | \___/|___/\___|_| |___|_| |_|\__\___|_| |_| \__,_|\___\___| |
3312 # | |
3313 # +----------------------------------------------------------------------+
3314 # | User interface specific rule sets |
3315 # '----------------------------------------------------------------------'
3318 @rulespec_group_registry.register
3319 class RulespecGroupUserInterface(RulespecGroup):
3320 @property
3321 def name(self):
3322 return "user_interface"
3324 @property
3325 def title(self):
3326 return _("User Interface")
3328 @property
3329 def help(self):
3330 return _("Settings concerning the user interface of Check_MK")
3333 register_rule(
3334 RulespecGroupUserInterface, "extra_host_conf:icon_image",
3335 Transform(
3336 IconSelector(
3337 title=_("Icon image for hosts in status GUI"),
3338 help=_("You can assign icons to hosts for the status GUI. "
3339 "Put your images into <tt>%s</tt>. ") %
3340 (cmk.utils.paths.omd_root + "/local/share/check_mk/web/htdocs/images/icons"),
3342 forth=lambda v: v and (v.endswith('.png') and v[:-4]) or v,
3345 register_rule(
3346 RulespecGroupUserInterface,
3347 "extra_service_conf:icon_image",
3348 Transform(
3349 IconSelector(
3350 title=_("Icon image for services in status GUI"),
3351 help=_("You can assign icons to services for the status GUI. "
3352 "Put your images into <tt>%s</tt>. ") %
3353 (cmk.utils.paths.omd_root + "/local/share/check_mk/web/htdocs/images/icons"),
3355 forth=lambda v: v and (v.endswith('.png') and v[:-4]) or v,
3357 itemtype="service")
3359 register_rule(
3360 RulespecGroupUserInterface,
3361 "host_icons_and_actions",
3362 UserIconOrAction(
3363 title=_("Custom icons or actions for hosts in status GUI"),
3364 help=_("You can assign icons or actions to hosts for the status GUI.")),
3365 match="all",
3368 register_rule(
3369 RulespecGroupUserInterface,
3370 "service_icons_and_actions",
3371 UserIconOrAction(
3372 title=_("Custom icons or actions for services in status GUI"),
3373 help=_("You can assign icons or actions to services for the status GUI."),
3375 match="all",
3376 itemtype="service",
3379 register_rule(
3380 RulespecGroupUserInterface, "extra_host_conf:_ESCAPE_PLUGIN_OUTPUT",
3381 DropdownChoice(
3382 title=_("Escape HTML codes in host output"),
3383 help=_("By default, for security reasons, the GUI does not interpret any HTML "
3384 "code received from external sources, like plugin output or log messages. "
3385 "If you are really sure what you are doing and need to have HTML codes, like "
3386 "links rendered, disable this option. Be aware, you might open the way "
3387 "for several injection attacks.") + _(
3388 "This setting can either be set globally or individually for selected hosts "
3389 "or services using the host or service rulesets."),
3390 choices=[
3391 ("1", _("Escape HTML codes")),
3392 ("0", _("Don't escape HTML codes (insecure)")),
3394 default_value="1",
3397 register_rule(
3398 RulespecGroupUserInterface,
3399 "extra_service_conf:_ESCAPE_PLUGIN_OUTPUT",
3400 DropdownChoice(
3401 title=_("Escape HTML codes in service output"),
3402 help=_("By default, for security reasons, the GUI does not interpret any HTML "
3403 "code received from external sources, like plugin output or log messages. "
3404 "If you are really sure what you are doing and need to have HTML codes, like "
3405 "links rendered, disable this option. Be aware, you might open the way "
3406 "for several injection attacks.") + _(
3407 "This setting can either be set globally or individually for selected hosts "
3408 "or services using the host or service rulesets."),
3409 choices=[
3410 ("1", _("Escape HTML codes")),
3411 ("0", _("Don't escape HTML codes (insecure)")),
3413 default_value="1",
3415 itemtype="service",
3419 @rulespec_group_registry.register
3420 class RulespecGroupAgent(RulespecGroup):
3421 @property
3422 def name(self):
3423 return "agent"
3425 @property
3426 def title(self):
3427 return _("Access to Agents")
3429 @property
3430 def help(self):
3431 return _("Settings concerning the connection to the Check_MK and SNMP agents")
3434 @rulespec_group_registry.register
3435 class RulespecGroupAgentGeneralSettings(RulespecSubGroup):
3436 @property
3437 def main_group(self):
3438 return RulespecGroupAgent
3440 @property
3441 def sub_group_name(self):
3442 return "general_settings"
3444 @property
3445 def title(self):
3446 return _("General Settings")
3449 register_rule(
3450 RulespecGroupAgentGeneralSettings,
3451 "dyndns_hosts",
3452 title=_("Hosts with dynamic DNS lookup during monitoring"),
3453 help=_("This ruleset selects host for dynamic DNS lookup during monitoring. Normally "
3454 "the IP addresses of hosts are statically configured or looked up when you "
3455 "activate the changes. In some rare cases DNS lookups must be done each time "
3456 "a host is connected to, e.g. when the IP address of the host is dynamic "
3457 "and can change."))
3459 register_rule(
3460 RulespecGroupAgentGeneralSettings, "primary_address_family",
3461 DropdownChoice(
3462 choices=[
3463 ("ipv4", _("IPv4")),
3464 ("ipv6", _("IPv6")),
3466 title=_("Primary IP address family of dual-stack hosts"),
3467 help=_("When you configure dual-stack host (IPv4 + IPv6) monitoring in Check_MK, "
3468 "normally IPv4 is used as primary address family to communicate with this "
3469 "host. The other family, IPv6, is just being pinged. You can use this rule "
3470 "to invert this behaviour to use IPv6 as primary address family.")))
3473 @rulespec_group_registry.register
3474 class RulespecGroupAgentSNMP(RulespecSubGroup):
3475 @property
3476 def main_group(self):
3477 return RulespecGroupAgent
3479 @property
3480 def sub_group_name(self):
3481 return "snmp"
3483 @property
3484 def title(self):
3485 return _("SNMP")
3488 register_rule(
3489 RulespecGroupAgentSNMP, "snmp_communities",
3490 SNMPCredentials(
3491 title=_("SNMP credentials of monitored hosts"),
3492 help=
3493 _("By default Check_MK uses the community \"public\" to contact hosts via SNMP v1/v2. This rule "
3494 "can be used to customize the the credentials to be used when contacting hosts via SNMP."
3498 register_rule(
3499 RulespecGroupAgentSNMP,
3500 "management_board_config",
3501 CascadingDropdown(
3502 title=_("Management board config"),
3503 choices=[
3504 ("snmp", _("SNMP"), SNMPCredentials()),
3505 ("ipmi", _("IPMI"), IPMIParameters()),
3510 register_rule(
3511 RulespecGroupAgentSNMP, "snmp_character_encodings",
3512 DropdownChoice(
3513 title=_("Output text encoding settings for SNMP devices"),
3514 help=_("Some devices send texts in non-ASCII characters. Check_MK"
3515 " always assumes UTF-8 encoding. You can declare other "
3516 " other encodings here"),
3517 choices=[
3518 ("utf-8", _("UTF-8")),
3519 ("latin1", _("latin1")),
3520 ("cp437", _("cp437")),
3523 register_rule(
3524 RulespecGroupAgentSNMP,
3525 "bulkwalk_hosts",
3526 title=_("Bulk walk: Hosts using bulk walk (enforces SNMP v2c)"),
3527 help=_(
3528 "Most SNMP hosts support SNMP version 2c. However, Check_MK defaults to version 1, "
3529 "in order to support as many devices as possible. Please use this ruleset in order "
3530 "to configure SNMP v2c for as many hosts as possible. That version has two advantages: "
3531 "it supports 64 bit counters, which avoids problems with wrapping counters at too "
3532 "much traffic. And it supports bulk walk, which saves much CPU and network resources. "
3533 "Please be aware, however, that there are some broken devices out there, that support "
3534 "bulk walk but behave very bad when it is used. When you want to enable v2c while not using "
3535 "bulk walk, please use the rule set snmpv2c_hosts instead."))
3537 register_rule(
3538 RulespecGroupAgentSNMP,
3539 "snmp_bulk_size",
3540 Integer(
3541 title=_("Bulk walk: Number of OIDs per bulk"),
3542 label=_("Number of OIDs to request per bulk: "),
3543 minvalue=1,
3544 maxvalue=100,
3545 default_value=10,
3547 help=_("This variable allows you to configure the numbr of OIDs Check_MK should request "
3548 "at once. This rule only applies to SNMP hosts that are configured to be bulk walk "
3549 "hosts."
3550 "You may want to use this rule to tune SNMP performance. Be aware: A higher value "
3551 "is not always better. It may decrease the transactions between Check_MK and the "
3552 "target system, but may increase the OID overhead in case you only need a small "
3553 "amount of OIDs."),
3556 register_rule(
3557 RulespecGroupAgentSNMP,
3558 "snmp_without_sys_descr",
3559 title=_("Hosts without system description OID"),
3560 help=_("Devices which do not publish the system description OID "
3561 ".1.3.6.1.2.1.1.1.0 are normally ignored by the SNMP inventory. "
3562 "Use this ruleset to select hosts which should nevertheless "
3563 "be checked."))
3565 register_rule(
3566 RulespecGroupAgentSNMP,
3567 "snmpv2c_hosts",
3568 title=_("Legacy SNMP devices using SNMP v2c"),
3569 help=
3570 _("There exist a few devices out there that behave very badly when using SNMP v2c and bulk walk. "
3571 "If you want to use SNMP v2c on those devices, nevertheless, you need to configure this device as "
3572 "legacy snmp device and upgrade it to SNMP v2c (without bulk walk) with this rule set. One reason is enabling 64 bit counters. "
3573 "Note: This rule won't apply if the device is already configured as SNMP v2c device."))
3575 register_rule(
3576 RulespecGroupAgentSNMP,
3577 "snmp_timing",
3578 Dictionary(
3579 title=_("Timing settings for SNMP access"),
3580 help=_("This rule decides about the number of retries and timeout values "
3581 "for the SNMP access to devices."),
3582 elements=[
3584 "timeout",
3585 Float(
3586 title=_("Response timeout for a single query"),
3587 help=_(
3588 "After a request is sent to the remote SNMP agent we will wait up to this "
3589 "number of seconds until assuming the answer get lost and retrying."),
3590 default_value=1,
3591 minvalue=0.1,
3592 maxvalue=60,
3593 allow_int=True,
3594 unit=_("sec"),
3595 size=6,
3598 ("retries",
3599 Integer(
3600 title=_("Number of retries"),
3601 default_value=5,
3602 minvalue=0,
3603 maxvalue=50,
3606 factory_default={
3607 "timeout": 1,
3608 "retries": 5
3610 match="dict")
3612 register_rule(
3613 RulespecGroupAgentSNMP,
3614 "non_inline_snmp_hosts",
3615 title=_("Hosts not using Inline-SNMP"),
3616 help=_("Check_MK has an efficient SNMP implementation called Inline SNMP which reduces the "
3617 "load produced by SNMP monitoring on the monitoring host significantly. This option is "
3618 "enabled by default for all SNMP hosts and it is a good idea to keep this default "
3619 "setting. However, there are SNMP devices which have problems with this SNMP "
3620 "implementation. You can use this rule to disable Inline SNMP for these hosts."))
3622 register_rule(
3623 RulespecGroupAgentSNMP,
3624 "usewalk_hosts",
3625 title=_("Simulating SNMP by using a stored SNMP walk"),
3626 help=_("This ruleset helps in test and development. You can create stored SNMP "
3627 "walks on the command line with cmk --snmpwalk HOSTNAME. A host that "
3628 "is configured with this ruleset will then use the information from that "
3629 "file instead of using real SNMP. "))
3631 register_rule(
3632 RulespecGroupAgentSNMP,
3633 "snmp_ports",
3634 Integer(minvalue=1, maxvalue=65535, default_value=161),
3635 title=_("UDP port used for SNMP"),
3636 help=_("This variable allows you to customize the UDP port to "
3637 "be used to communicate via SNMP on a per-host-basis."),
3641 @rulespec_group_registry.register
3642 class RulespecGroupAgentCMKAgent(RulespecSubGroup):
3643 @property
3644 def main_group(self):
3645 return RulespecGroupAgent
3647 @property
3648 def sub_group_name(self):
3649 return "check_mk_agent"
3651 @property
3652 def title(self):
3653 return _("Check_MK Agent")
3656 register_rule(
3657 RulespecGroupAgentCMKAgent,
3658 "agent_ports",
3659 Integer(minvalue=1, maxvalue=65535, default_value=6556),
3660 title=_("TCP port for connection to Check_MK agent"),
3661 help=_("This variable allows to specify the TCP port to "
3662 "be used to connect to the agent on a per-host-basis. "),
3665 register_rule(
3666 RulespecGroupAgentCMKAgent,
3667 "tcp_connect_timeouts",
3668 Float(
3669 minvalue=1.0,
3670 default_value=5.0,
3671 unit="sec",
3673 title=_("Agent TCP connect timeout"),
3674 help=_(
3675 "Timeout for TCP connect to the Check_MK agent in seconds. If the connection "
3676 "to the agent cannot be established within this time, it is considered to be unreachable. "
3677 "Note: This does <b>not</b> limit the time the agent needs to "
3678 "generate its output. "
3679 "This rule can be used to specify a timeout on a per-host-basis."),
3682 register_rule(
3683 RulespecGroupAgentCMKAgent,
3684 "agent_encryption",
3685 Dictionary(
3686 elements=[
3687 ("passphrase", PasswordSpec(title=_("Encryption secret"), allow_empty=False)),
3688 ("use_regular",
3689 DropdownChoice(
3690 title=_("Encryption for Agent"),
3691 help=_("Choose if the agent agents encrypt packages. This controls whether "
3692 "baked agents encrypt their output and whether check_mk expects "
3693 "encrypted output. "
3694 "Please note: If you opt to enforce encryption, "
3695 "agents that don't support encryption will not work any more. "
3696 "Further note: This only affects regular agents, not special agents "
3697 "aka datasource programs."),
3698 default_value="disable",
3699 choices=[("enforce", _("Enforce (drop unencrypted data)")),
3700 ("allow", _("Enable (accept encrypted and unencrypted data)")),
3701 ("disable", _("Disable (drop encrypted data)"))])),
3702 ("use_realtime",
3703 DropdownChoice(
3704 title=_("Encryption for Realtime Updates"),
3705 help=_("Choose if realtime updates are sent/expected encrypted"),
3706 default_value="enforce",
3707 choices=[("enforce", _("Enforce (drop unencrypted data)")),
3708 ("allow", _("Enable (accept encrypted and unencrypted data)")),
3709 ("disable", _("Disable (drop encrypted data)"))])),
3711 optional_keys=[]),
3712 title=_("Encryption"),
3713 help=_("Control encryption of data sent from agent to host."),
3717 def _common_check_mk_exit_status_elements():
3718 return [
3720 "empty_output",
3721 MonitoringState(default_value=2, title=_("State in case of empty output")),
3724 "connection",
3725 MonitoringState(default_value=2, title=_("State in case of connection problems")),
3728 "timeout",
3729 MonitoringState(default_value=2, title=_("State in case of a timeout")),
3732 "exception",
3733 MonitoringState(default_value=3, title=_("State in case of unhandled exception")),
3738 def transform_exit_code_spec(p):
3739 if "overall" in p:
3740 return p
3741 return {"overall": p}
3744 register_rule(
3745 RulespecGroupAgentCMKAgent,
3746 "check_mk_exit_status",
3747 Transform(
3748 Dictionary(
3749 elements=[
3750 ("overall",
3751 Dictionary(
3752 title=_("Overall status"),
3753 elements=_common_check_mk_exit_status_elements() + [
3755 "wrong_version",
3756 MonitoringState(
3757 default_value=1, title=_("State in case of wrong agent version")),
3760 "missing_sections",
3761 MonitoringState(
3762 default_value=1,
3763 title=_("State if just <i>some</i> agent sections are missing")),
3766 "specific_missing_sections",
3767 ListOf(
3768 Tuple(
3769 elements=[
3770 RegExpUnicode(
3771 help=
3772 _('Beside of setting the generic "Missing sections" state above '
3773 'you can specify a regex pattern to match specific section names and '
3774 'give them an individual state in case they are missing. '
3775 'Note that the first match is used.'),
3776 mode=RegExpUnicode.prefix),
3777 MonitoringState(),
3779 orientation="horizontal"),
3780 title=_("State if specific sections are missing"),
3783 ])),
3784 ("individual",
3785 Dictionary(
3786 title=_("Individual states per data source"),
3787 elements=[
3788 ("agent",
3789 Dictionary(
3790 title=_("Agent"),
3791 elements=_common_check_mk_exit_status_elements() + [
3793 "wrong_version",
3794 MonitoringState(
3795 default_value=1,
3796 title=_("State in case of wrong agent version")),
3798 ])),
3799 ("programs",
3800 Dictionary(
3801 title=_("Programs"),
3802 elements=_common_check_mk_exit_status_elements())),
3803 ("special",
3804 Dictionary(
3805 title=_("Programs"),
3806 elements=_common_check_mk_exit_status_elements())),
3807 ("snmp",
3808 Dictionary(
3809 title=_("SNMP"), elements=_common_check_mk_exit_status_elements())),
3810 ("mgmt_snmp",
3811 Dictionary(
3812 title=_("SNMP Management Board"),
3813 elements=_common_check_mk_exit_status_elements())),
3814 ("mgmt_ipmi",
3815 Dictionary(
3816 title=_("IPMI Management Board"),
3817 elements=_common_check_mk_exit_status_elements())),
3818 ("piggyback",
3819 Dictionary(
3820 title=_("Piggyback"),
3821 elements=_common_check_mk_exit_status_elements())),
3822 ])),
3824 optional_keys=["individual"],
3826 forth=transform_exit_code_spec),
3827 factory_default={
3828 "connection": 2,
3829 "missing_sections": 1,
3830 "empty_output": 2,
3831 "wrong_version": 1,
3832 "exception": 3
3834 title=_("Status of the Check_MK services"),
3835 help=_("This ruleset specifies the total status of the Check_MK services <i>Check_MK</i>, "
3836 "<i>Check_MK Discovery</i> and <i>Check_MK HW/SW Inventory</i> in case of various "
3837 "error situations. One use case is the monitoring of hosts that are not always up. "
3838 "You can have Check_MK an OK status here if the host is not reachable. Note: the "
3839 "<i>Timeout</i> setting only works when using the Check_MK Micro Core."),
3840 match="dict",
3843 register_rule(
3844 RulespecGroupAgentCMKAgent,
3845 "check_mk_agent_target_versions",
3846 Transform(
3847 CascadingDropdown(
3848 title=_("Check for correct version of Check_MK agent"),
3849 help=_("Here you can make sure that all of your Check_MK agents are running"
3850 " one specific version. Agents running "
3851 " a different version return a non-OK state."),
3852 choices=[
3853 ("ignore", _("Ignore the version")),
3854 ("site", _("Same version as the monitoring site")),
3855 ("specific", _("Specific version"), TextAscii(allow_empty=False,)),
3856 ("at_least", _("At least"),
3857 Dictionary(elements=[
3858 ('release', TextAscii(
3859 title=_('Official Release version'),
3860 allow_empty=False,
3862 ('daily_build', TextAscii(
3863 title=_('Daily build'),
3864 allow_empty=False,
3866 ])),
3868 default_value="ignore",
3870 # In the past, this was a OptionalDropdownChoice() which values could be strings:
3871 # ignore, site or a custom string representing a version number.
3872 forth=lambda x: isinstance(x, str) and x not in ["ignore", "site"] and ("specific", x) or x,
3876 @rulespec_group_registry.register
3877 class RulespecGroupMonitoringAgents(RulespecGroup):
3878 @property
3879 def name(self):
3880 return "agents"
3882 @property
3883 def title(self):
3884 return _("Monitoring Agents")
3886 @property
3887 def help(self):
3888 return _("Configuration of monitoring agents for Linux, Windows and Unix")
3891 @rulespec_group_registry.register
3892 class RulespecGroupMonitoringAgentsGenericOptions(RulespecSubGroup):
3893 @property
3894 def main_group(self):
3895 return RulespecGroupMonitoringAgents
3897 @property
3898 def sub_group_name(self):
3899 return "generic_options"
3901 @property
3902 def title(self):
3903 return _("Generic Options")
3906 register_rule(
3907 RulespecGroupMonitoringAgentsGenericOptions,
3908 "agent_config:only_from",
3909 ListOfStrings(
3910 valuespec=IPNetwork(),
3911 title=_("Allowed agent access via IP address"),
3912 help=_("This rule allows you to restrict the access to the "
3913 "Check_MK agent to certain IP addresses and networks. "
3914 "Usually you configure just the IP addresses of your "
3915 "Check_MK servers here. You can enter either IP addresses "
3916 "in the form <tt>1.2.3.4</tt> or networks in the style "
3917 "<tt>1.2.0.0/16</tt>. If you leave this configuration empty "
3918 "or create no rule then <b>all</b> addresses are allowed to "
3919 "access the agent. IPv6 addresses and networks are also allowed."),
3921 match="first")
3923 register_rule(
3924 RulespecGroupAgentGeneralSettings,
3925 "piggyback_translation",
3926 HostnameTranslation(
3927 title=_("Hostname translation for piggybacked hosts"),
3928 help=_(
3929 "Some agents or agent plugins send data not only for the queried host but also "
3930 "for other hosts &quot;piggyback&quot; with their own data. This is the case "
3931 "for the vSphere special agent and the SAP R/3 plugin, for example. The hostnames "
3932 "that these agents send must match your hostnames in your monitoring configuration. "
3933 "If that is not the case, then with this rule you can define a hostname translation. "
3934 "Note: This rule must be configured for the &quot;pig&quot; - i.e. the host that the "
3935 "agent is running on. It is not applied to the translated piggybacked hosts."),
3937 match="dict")
3939 register_rule(
3940 RulespecGroupAgentGeneralSettings,
3941 "service_description_translation",
3942 ServiceDescriptionTranslation(
3943 title=_("Translation of service descriptions"),
3944 help=_(
3945 "Within this ruleset service descriptions can be translated similar to the ruleset "
3946 "<tt>Hostname translation for piggybacked hosts</tt>. Services such as "
3947 "<tt>Check_MK</tt>, <tt>Check_MK Agent</tt>, <tt>Check_MK Discovery</tt>, "
3948 "<tt>Check_MK inventory</tt>, and <tt>Check_MK HW/SW Inventory</tt> are excluded. "
3949 "<b>Attention:</b><ul>"
3950 "<li>Downtimes and other configured rules which match these "
3951 "services have to be adapted.</li>"
3952 "<li>Performance data and graphs will begin from scratch for translated services.</li>"
3953 "<li>Especially configured check parameters keep their functionality further on.</li>"
3954 "<li>This new ruleset translates also the item part of a service description. "
3955 "This means that after such a translation the item may be gone but is used in the "
3956 "conditions of the parameters further on if any parameters are configured. "
3957 "This might be confusing.</li></ul>"
3958 "This rule should only be configured in the early stages."),
3960 match_type="all")
3963 def get_snmp_checktypes():
3964 checks = watolib.check_mk_local_automation("get-check-information")
3965 types = [(cn, (c['title'] != cn and '%s: ' % cn or '') + c['title'])
3966 for (cn, c) in checks.items()
3967 if c['snmp']]
3968 types.sort()
3969 return [(None, _('All SNMP Checks'))] + types
3972 def get_snmp_section_names():
3973 checks = watolib.check_mk_local_automation("get-check-information")
3974 return [(None, _('All SNMP Checks'))] + sorted(
3975 [(cn, cn) for (cn, c) in checks.items() if c['snmp']])
3978 register_rule(
3979 RulespecGroupAgentSNMP,
3980 "snmp_check_interval",
3981 Tuple(
3982 title=_('Check intervals for SNMP checks'),
3983 help=_('This rule can be used to customize the check interval of each SNMP based check. '
3984 'With this option it is possible to configure a longer check interval for specific '
3985 'checks, than then normal check interval.'),
3986 elements=[
3987 Transform(
3988 DropdownChoice(
3989 title=_("Check"),
3990 help=_("You can only configure \"section names\" here and not choose all "
3991 "individual SNMP based checks here. It is only possible to define "
3992 "SNMP check intervals for main checks and all the related sub "
3993 "checks together. The reason for this is that the data of the "
3994 "main check and it's sub checks is defined for the whole group "
3995 "of checks in the main check and also fetched for all these "
3996 "checks together."),
3997 choices=get_snmp_section_names,
3999 # Transform check types to section names
4000 forth=lambda e: e.split(".")[0] if e is not None else None,
4002 Integer(
4003 title=_("Do check every"),
4004 unit=_("minutes"),
4005 min_value=1,
4006 default_value=1,
4010 register_rule(
4011 RulespecGroupAgentSNMP, "snmpv3_contexts",
4012 Tuple(
4013 title=_('SNMPv3 contexts to use in requests'),
4014 help=_('By default Check_MK does not use a specific context during SNMPv3 queries, '
4015 'but some devices are offering their information in different SNMPv3 contexts. '
4016 'This rule can be used to configure, based on hosts and check type, which SNMPv3 '
4017 'contexts Check_MK should ask for when getting information via SNMPv3.'),
4018 elements=[
4019 DropdownChoice(
4020 title=_("Checktype"),
4021 choices=get_snmp_checktypes,
4023 ListOfStrings(
4024 title=_("SNMP Context IDs"),
4025 allow_empty=False,