Add specific visualization for labels depending on their source
[check_mk.git] / cmk / gui / plugins / wato / check_mk_configuration.py
blob6cc8294fcf686264f1329c9d34513384bf9451be
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.tags
34 import cmk.gui.sites as sites
35 import cmk.gui.config as config
36 import cmk.gui.watolib as watolib
37 import cmk.gui.userdb as userdb
38 import cmk.gui.utils as utils
39 from cmk.gui.exceptions import MKUserError
40 from cmk.gui.i18n import _
42 from cmk.gui.valuespec import (
43 Dictionary,
44 TextAscii,
45 TextUnicode,
46 DropdownChoice,
47 Tuple,
48 ListOf,
49 Integer,
50 Float,
51 Transform,
52 ListOfStrings,
53 IPNetwork,
54 CascadingDropdown,
55 MonitoringState,
56 RegExpUnicode,
57 IconSelector,
58 PasswordSpec,
59 ListOfTimeRanges,
60 Age,
61 FixedValue,
62 Optional,
63 Alternative,
64 ListChoice,
65 Checkbox,
66 ID,
67 ListOfCAs,
68 LogLevelChoice,
69 Labels,
72 from cmk.gui.plugins.wato import (
73 config_variable_group_registry,
74 ConfigVariableGroup,
75 config_variable_registry,
76 ConfigVariable,
77 ConfigDomainGUI,
78 ConfigDomainCore,
79 ConfigDomainCACertificates,
80 site_neutral_path,
81 rulespec_registry,
82 HostRulespec,
83 ServiceRulespec,
84 BinaryHostRulespec,
85 BinaryServiceRulespec,
86 rulespec_group_registry,
87 RulespecGroup,
88 RulespecSubGroup,
89 PluginCommandLine,
90 UserIconOrAction,
91 SNMPCredentials,
92 IPMIParameters,
93 HostnameTranslation,
94 ServiceDescriptionTranslation,
95 ContactGroupSelection,
96 HostGroupSelection,
97 ServiceGroupSelection,
98 CheckTypeSelection,
99 TimeperiodSelection,
100 HTTPProxyInput,
103 from cmk.gui.plugins.wato.omd_configuration import ConfigVariableGroupSiteManagement
104 from cmk.gui.plugins.views.icons import icon_and_action_registry
105 from cmk.gui.watolib.bulk_discovery import vs_bulk_discovery
106 from cmk.gui.watolib.groups import load_contact_group_information
108 # .--Global Settings-----------------------------------------------------.
109 # | ____ _ _ _ ____ _ _ _ |
110 # | / ___| | ___ | |__ __ _| | / ___| ___| |_| |_(_)_ __ __ _ ___ |
111 # || | _| |/ _ \| '_ \ / _` | | \___ \ / _ \ __| __| | '_ \ / _` / __| |
112 # || |_| | | (_) | |_) | (_| | | ___) | __/ |_| |_| | | | | (_| \__ \ |
113 # | \____|_|\___/|_.__/ \__,_|_| |____/ \___|\__|\__|_|_| |_|\__, |___/ |
114 # | |___/ |
115 # +----------------------------------------------------------------------+
116 # | Global configuration settings for main.mk and multisite.mk |
117 # '----------------------------------------------------------------------'
120 @config_variable_group_registry.register
121 class ConfigVariableGroupUserInterface(ConfigVariableGroup):
122 def title(self):
123 return _("User Interface")
125 def sort_index(self):
126 return 20
129 @config_variable_registry.register
130 class ConfigVariableUITheme(ConfigVariable):
131 def group(self):
132 return ConfigVariableGroupUserInterface
134 def domain(self):
135 return ConfigDomainGUI
137 def ident(self):
138 return "ui_theme"
140 def valuespec(self):
141 return DropdownChoice(
142 title=_("User interface theme"),
143 help=_("Change the default user interface theme of your Check_MK installation"),
144 choices=config.theme_choices(),
148 @config_variable_registry.register
149 class ConfigVariableBulkDiscoveryDefaultSettings(ConfigVariable):
150 def group(self):
151 return ConfigVariableGroupUserInterface
153 def domain(self):
154 return ConfigDomainGUI
156 def ident(self):
157 return "bulk_discovery_default_settings"
159 def valuespec(self):
160 return vs_bulk_discovery()
163 @config_variable_registry.register
164 class ConfigVariableLogLevels(ConfigVariable):
165 def group(self):
166 return ConfigVariableGroupUserInterface
168 def domain(self):
169 return ConfigDomainGUI
171 def ident(self):
172 return "log_levels"
174 def valuespec(self):
175 return Dictionary(
176 title=_("Logging"),
177 help=_("This setting decides which types of messages to log into "
178 "the web log <tt>%s</tt>.") %
179 site_neutral_path(cmk.utils.paths.log_dir + "/web.log"),
180 elements=self._web_log_level_elements(),
181 optional_keys=[],
184 def _web_log_level_elements(self):
185 elements = []
186 for level_id, title, help_text in [
187 ("cmk.web", _("Web"),
188 _("The log level for all log entries not assigned to the other "
189 "log categories on this page.")),
190 ("cmk.web.auth", _("Authentication"),
191 _("The log level for user authentication related log entries.")),
192 ("cmk.web.ldap", _("LDAP"), _("The log level for LDAP related log entries.")),
193 ("cmk.web.bi.compilation", _("BI compilation"),
194 _("If this option is enabled, Check_MK BI will create a log with details "
195 "about compiling BI aggregations. This includes statistics and "
196 "details for each executed compilation.")),
197 ("cmk.web.automations", _("Automation calls"),
198 _("Communication between different components of Check_MK (e.g. GUI and check engine) "
199 "will be logged in this log level."))
201 elements.append((level_id,
202 LogLevelChoice(
203 title=title,
204 help=help_text,
205 default_value=logging.WARNING,
208 return elements
211 @config_variable_registry.register
212 class ConfigVariableDebug(ConfigVariable):
213 def group(self):
214 return ConfigVariableGroupUserInterface
216 def domain(self):
217 return ConfigDomainGUI
219 def ident(self):
220 return "debug"
222 def valuespec(self):
223 return Checkbox(
224 title=_("Debug mode"),
225 label=_("enable debug mode"),
226 help=_("When Multisite is running in debug mode, internal Python error messages "
227 "are being displayed and various debug information in other places is "
228 "also available."),
232 @config_variable_registry.register
233 class ConfigVariableGUIProfile(ConfigVariable):
234 def group(self):
235 return ConfigVariableGroupUserInterface
237 def domain(self):
238 return ConfigDomainGUI
240 def ident(self):
241 return "profile"
243 def valuespec(self):
244 return DropdownChoice(
245 title=_("Profile requests"),
246 help=_("It is possible to profile the rendering process of Multisite pages. This "
247 "Is done using the Python module cProfile. When profiling is performed "
248 "two files are created <tt>%s</tt> and <tt>%s</tt>. By executing the later "
249 "file you can get runtime statistics about the last processed page. When "
250 "enabled by request the profiling mode is enabled by providing the HTTP "
251 "variable <tt>_profile</tt>.") %
252 (site_neutral_path(cmk.utils.paths.var_dir + "/multisite.profile"),
253 site_neutral_path(cmk.utils.paths.var_dir + "/multisite.profile.py")),
254 choices=[
255 (False, _("Disable profiling")),
256 ("enable_by_var", _("Enable profiling by request")),
257 (True, _("Enable profiling for all requests")),
262 @config_variable_registry.register
263 class ConfigVariableDebugLivestatusQueries(ConfigVariable):
264 def group(self):
265 return ConfigVariableGroupUserInterface
267 def domain(self):
268 return ConfigDomainGUI
270 def ident(self):
271 return "debug_livestatus_queries"
273 def valuespec(self):
274 return Checkbox(
275 title=_("Debug Livestatus queries"),
276 label=_("enable debug of Livestatus queries"),
277 help=_("With this option turned on all Livestatus queries made by Multisite "
278 "in order to render views are being displayed."),
282 @config_variable_registry.register
283 class ConfigVariableSelectionLivetime(ConfigVariable):
284 def group(self):
285 return ConfigVariableGroupUserInterface
287 def domain(self):
288 return ConfigDomainGUI
290 def ident(self):
291 return "selection_livetime"
293 def valuespec(self):
294 return Integer(
295 title=_('Checkbox Selection Livetime'),
296 help=
297 _('This option defines the maximum age of unmodified checkbox selections stored for users. '
298 'If a user modifies the selection in a view, these selections are persisted for the currently '
299 'open view. When a view is re-opened a new selection is used. The old one remains on the '
300 'server until the livetime is exceeded.'),
301 minvalue=1,
305 @config_variable_registry.register
306 class ConfigVariableShowLivestatusErrors(ConfigVariable):
307 def group(self):
308 return ConfigVariableGroupUserInterface
310 def domain(self):
311 return ConfigDomainGUI
313 def ident(self):
314 return "show_livestatus_errors"
316 def valuespec(self):
317 return Checkbox(
318 title=_("Show MK Livestatus error messages"),
319 label=_("show errors"),
320 help=
321 _("This option controls whether error messages from unreachable sites are shown in the output of "
322 "views. Those error messages shall alert you that not all data from all sites has been shown. "
323 "Other people - however - find those messages distracting. "),
327 @config_variable_registry.register
328 class ConfigVariableEnableSounds(ConfigVariable):
329 def group(self):
330 return ConfigVariableGroupUserInterface
332 def domain(self):
333 return ConfigDomainGUI
335 def ident(self):
336 return "enable_sounds"
338 def valuespec(self):
339 return Checkbox(
340 title=_("Enable sounds in views"),
341 label=_("enable sounds"),
342 help=_("If sounds are enabled then the user will be alarmed by problems shown "
343 "in a Multisite status view if that view has been configured for sounds. "
344 "From the views shipped in with Multisite all problem views have sounds "
345 "enabled."),
349 @config_variable_registry.register
350 class ConfigVariableContextButtonsToShow(ConfigVariable):
351 def group(self):
352 return ConfigVariableGroupUserInterface
354 def domain(self):
355 return ConfigDomainGUI
357 def ident(self):
358 return "context_buttons_to_show"
360 def valuespec(self):
361 return Optional(
362 Integer(
363 title=_("show"),
364 label=_("buttons"),
365 minvalue=1,
366 maxvalue=100,
367 size=2,
369 title=_("Number of context buttons to show"),
370 label=_("Show only most frequently used buttons"),
371 help=_("If this option is enabled, then Multisite only show the most "
372 "used context buttons and hides the rest. Which buttons are used "
373 "how often is computed separately per user."),
377 @config_variable_registry.register
378 class ConfigVariableSoftQueryLimit(ConfigVariable):
379 def group(self):
380 return ConfigVariableGroupUserInterface
382 def domain(self):
383 return ConfigDomainGUI
385 def ident(self):
386 return "soft_query_limit"
388 def valuespec(self):
389 return Integer(
390 title=_("Soft query limit"),
391 help=_("Whenever the number of returned datasets of a view would exceed this "
392 "limit, a warning is being displayed and no further data is being shown. "
393 "A normal user can override this limit with one mouse click."),
394 minvalue=1,
398 @config_variable_registry.register
399 class ConfigVariableHardQueryLimit(ConfigVariable):
400 def group(self):
401 return ConfigVariableGroupUserInterface
403 def domain(self):
404 return ConfigDomainGUI
406 def ident(self):
407 return "hard_query_limit"
409 def valuespec(self):
410 return Integer(
411 title=_("Hard query limit"),
412 help=_("Whenever the number of returned datasets of a view would exceed this "
413 "limit, an error message is shown. The normal user cannot override "
414 "the hard limit. The purpose of the hard limit is to secure the server "
415 "against useless queries with huge result sets."),
416 minvalue=1,
420 @config_variable_registry.register
421 class ConfigVariableQuicksearchDropdownLimit(ConfigVariable):
422 def group(self):
423 return ConfigVariableGroupUserInterface
425 def domain(self):
426 return ConfigDomainGUI
428 def ident(self):
429 return "quicksearch_dropdown_limit"
431 def valuespec(self):
432 return Integer(
433 title=_("Number of elements to show in Quicksearch"),
434 help=_("When typing a texts in the Quicksearch snapin, a dropdown will "
435 "appear listing all matching host names containing that text. "
436 "That list is limited in size so that the dropdown will not get "
437 "too large when you have a huge number of lists. "),
438 minvalue=1,
442 @config_variable_registry.register
443 class ConfigVariableQuicksearchSearchOrder(ConfigVariable):
444 def group(self):
445 return ConfigVariableGroupUserInterface
447 def domain(self):
448 return ConfigDomainGUI
450 def ident(self):
451 return "quicksearch_search_order"
453 def valuespec(self):
454 return ListOf(
455 Tuple(
456 elements=[
457 DropdownChoice(
458 title=_("Search filter"),
459 choices=[
460 ("h", _("Hostname")),
461 ("al", _("Hostalias")),
462 ("ad", _("Hostaddress")),
463 ("tg", _("Hosttag")),
464 ("hg", _("Hostgroup")),
465 ("sg", _("Servicegroup")),
466 ("s", _("Service Description")),
469 DropdownChoice(
470 title=_("Match behaviour"),
471 choices=[
472 ("continue", _("Continue search")),
473 ("finished",
474 _("Search finished: Also show all results of previous filters")),
475 ("finished_distinct",
476 _("Search finished: Only show results of this filter")),
479 ],),
480 title=_("Quicksearch search order"),
481 add_label=_("Add search filter"),
485 @config_variable_registry.register
486 class ConfigVariableTableRowLimit(ConfigVariable):
487 def group(self):
488 return ConfigVariableGroupUserInterface
490 def domain(self):
491 return ConfigDomainGUI
493 def ident(self):
494 return "table_row_limit"
496 def valuespec(self):
497 return Integer(
498 title=_("Limit the number of rows shown in tables"),
499 help=_("Several pages which use tables to show data in rows, like the "
500 "\"Users\" configuration page, can be configured to show "
501 "only a limited number of rows when accessing the pages."),
502 minvalue=1,
503 unit=_('rows'),
507 @config_variable_registry.register
508 class ConfigVariableStartURL(ConfigVariable):
509 def group(self):
510 return ConfigVariableGroupUserInterface
512 def domain(self):
513 return ConfigDomainGUI
515 def ident(self):
516 return "start_url"
518 def valuespec(self):
519 return TextAscii(
520 title=_("Start URL to display in main frame"),
521 help=_("When you point your browser to the Check_MK GUI, usually the dashboard "
522 "is shown in the main (right) frame. You can replace this with any other "
523 "URL you like here."),
524 size=80,
525 allow_empty=False,
526 validate=utils.validate_start_url,
530 @config_variable_registry.register
531 class ConfigVariablePageHeading(ConfigVariable):
532 def group(self):
533 return ConfigVariableGroupUserInterface
535 def domain(self):
536 return ConfigDomainGUI
538 def ident(self):
539 return "page_heading"
541 def valuespec(self):
542 return TextUnicode(
543 title=_("Page title"),
544 help=_("This title will be displayed in your browser's title bar or tab. You can use "
545 "a <tt>%s</tt> to insert the alias of your monitoring site to the title."),
546 size=80,
550 @config_variable_registry.register
551 class ConfigVariablePagetitleDateFormat(ConfigVariable):
552 def group(self):
553 return ConfigVariableGroupUserInterface
555 def domain(self):
556 return ConfigDomainGUI
558 def ident(self):
559 return "pagetitle_date_format"
561 def valuespec(self):
562 return DropdownChoice(
563 title=_("Date format for page titles"),
564 help=_("When enabled, the headline of each page also displays "
565 "the date in addition the time."),
566 choices=[
567 (None, _("Do not display a date")),
568 ('yyyy-mm-dd', _("YYYY-MM-DD")),
569 ('dd.mm.yyyy', _("DD.MM.YYYY")),
574 @config_variable_registry.register
575 class ConfigVariableEscapePluginOutput(ConfigVariable):
576 def group(self):
577 return ConfigVariableGroupUserInterface
579 def domain(self):
580 return ConfigDomainGUI
582 def ident(self):
583 return "escape_plugin_output"
585 def valuespec(self):
586 return Checkbox(
587 title=_("Escape HTML codes in plugin output"),
588 help=_("By default, for security reasons, the GUI does not interpret any HTML "
589 "code received from external sources, like plugin output or log messages. "
590 "If you are really sure what you are doing and need to have HTML codes, like "
591 "links rendered, disable this option. Be aware, you might open the way "
592 "for several injection attacks.") + _(
593 "This setting can either be set globally or individually for selected hosts "
594 "or services using the host or service rulesets."),
595 label=_("Prevent loading HTML from plugin output or log messages"),
599 @config_variable_registry.register
600 class ConfigVariableCrashReportTarget(ConfigVariable):
601 def group(self):
602 return ConfigVariableGroupUserInterface
604 def domain(self):
605 return ConfigDomainGUI
607 def ident(self):
608 return "crash_report_target"
610 def valuespec(self):
611 return TextAscii(
612 title=_("Fallback mail address for crash reports"),
613 help=_("By default crash reports will be sent to our crash reporting server. In case "
614 "this fails for some reason, the crash reports can be sent by mail to the "
615 "address configured here."),
616 size=80,
617 attrencode=True,
621 @config_variable_registry.register
622 class ConfigVariableDrawRuleIcon(ConfigVariable):
623 def group(self):
624 return ConfigVariableGroupUserInterface
626 def domain(self):
627 return ConfigDomainGUI
629 def ident(self):
630 return "multisite_draw_ruleicon"
632 def valuespec(self):
633 return Checkbox(
634 title=_("Show icon linking to WATO parameter editor for services"),
635 label=_("Show WATO icon"),
636 help=_("When enabled a rule editor icon is displayed for each "
637 "service in the multisite views. It is only displayed if the user "
638 "does have the permission to edit rules."),
642 def transform_virtual_host_trees(trees):
643 def id_from_title(title):
644 return re.sub("[^-a-zA-Z0-9_]+", "", title.lower())
646 for index, tree in enumerate(trees):
647 if isinstance(tree, tuple):
648 trees[index] = {
649 "id": id_from_title(tree[0]),
650 "title": tree[0],
651 "tree_spec": tree[1],
653 else:
654 # Transform existing dicts with old key "tag_groups"
655 if "tag_groups" in tree:
656 tree["tree_spec"] = tree.pop("tag_groups")
658 return sorted(trees, key=lambda x: x["title"])
661 @config_variable_registry.register
662 class ConfigVariableVirtualHostTrees(ConfigVariable):
663 def group(self):
664 return ConfigVariableGroupUserInterface
666 def domain(self):
667 return ConfigDomainGUI
669 def ident(self):
670 return "virtual_host_trees"
672 def valuespec(self):
673 return Transform(
674 ListOf(
675 Dictionary(
676 elements=[
677 ("id", ID(
678 title=_("ID"),
679 allow_empty=False,
681 ("title", TextUnicode(
682 title=_("Title of the tree"),
683 allow_empty=False,
685 ("exclude_empty_tag_choices",
686 Checkbox(
687 title=_("Exclude empty tag choices"),
688 default_value=False,
690 ("tree_spec",
691 ListOf(
692 DropdownChoice(choices=self._virtual_host_tree_choices,),
693 title=_("Tree levels"),
694 allow_empty=False,
695 magic="#!#",
698 optional_keys=[],
700 add_label=_("Create new virtual host tree configuration"),
701 title=_("Virtual Host Trees"),
702 help=
703 _("Here you can define tree configurations for the snapin <i>Virtual Host-Trees</i>. "
704 "These trees organize your hosts based on their values in certain host tag groups. "
705 "Each host tag group you select will create one level in the tree."),
706 validate=self._validate_virtual_host_trees,
707 movable=False,
709 forth=transform_virtual_host_trees,
712 def _virtual_host_tree_choices(self):
713 return self._wato_host_tag_group_choices() + [("foldertree:", _("WATO folder tree"))] + [
714 ("folder:%d" % l, _("WATO folder level %d") % l) for l in range(1, 7)
717 def _wato_host_tag_group_choices(self):
718 # We add to the choices:
719 # 1. All host tag groups with their id
720 # 2. All *topics* that:
721 # - consist only of checkbox tags
722 # - contain at least two entries
723 choices = []
724 by_topic = {}
725 for tag_group in config.tags.tag_groups:
726 choices.append((tag_group.id, tag_group.title))
727 by_topic.setdefault(tag_group.topic, []).append(tag_group)
729 # Now search for checkbox-only-topics
730 for topic, tag_groups in by_topic.items():
731 for tag_group in tag_groups:
732 if len(tag_group.tags) != 1:
733 break
734 else:
735 if len(tag_groups) > 1:
736 choices.append((
737 "topic:" + topic,
738 _("Topic") + ": " + topic,
741 return choices
743 def _validate_virtual_host_trees(self, value, varprefix):
744 tree_ids = set()
745 for tree in value:
746 if tree["id"] in tree_ids:
747 raise MKUserError(varprefix, _("The ID needs to be unique."))
748 tree_ids.add(tree["id"])
750 # Validate that each element is selected once
751 seen = set()
752 for element in tree["tree_spec"]:
753 if element in seen:
754 raise MKUserError(
755 varprefix,
756 _("Found '%s' a second time in tree '%s'. Each element can only be "
757 "choosen once.") % (element, tree["id"]))
759 seen.add(element)
762 @config_variable_registry.register
763 class ConfigVariableRescheduleTimeout(ConfigVariable):
764 def group(self):
765 return ConfigVariableGroupUserInterface
767 def domain(self):
768 return ConfigDomainGUI
770 def ident(self):
771 return "reschedule_timeout"
773 def valuespec(self):
774 return Float(
775 title=_("Timeout for rescheduling checks in Multisite"),
776 help=_("When you reschedule a check by clicking on the &quot;arrow&quot;-icon "
777 "then Multisite will use this number of seconds as a timeout. If the "
778 "monitoring core has not executed the check within this time, an error "
779 "will be displayed and the page not reloaded."),
780 minvalue=1.0,
781 unit="sec",
782 display_format="%.1f",
786 @config_variable_registry.register
787 class ConfigVariableSidebarShowVersionInSidebar(ConfigVariable):
788 def group(self):
789 return ConfigVariableGroupUserInterface
791 def domain(self):
792 return ConfigDomainGUI
794 def ident(self):
795 return "sidebar_show_version_in_sidebar"
797 def valuespec(self):
798 return Checkbox(
799 title=_("Show Check_MK edition & version in sidebar"),
800 label=_("Show the edition ad version"),
801 help=_("Use this option to hide the Check_MK edition and version information from "
802 "the header of the sidebar."),
806 @config_variable_registry.register
807 class ConfigVariableSidebarUpdateInterval(ConfigVariable):
808 def group(self):
809 return ConfigVariableGroupUserInterface
811 def domain(self):
812 return ConfigDomainGUI
814 def ident(self):
815 return "sidebar_update_interval"
817 def valuespec(self):
818 return Float(
819 title=_("Interval of sidebar status updates"),
820 help=_("The information provided by the sidebar snapins is refreshed in a regular "
821 "interval. You can change the refresh interval to fit your needs here. This "
822 "value means that all snapnis which request a regular refresh are updated "
823 "in this interval."),
824 minvalue=10.0,
825 unit="sec",
826 display_format="%.1f",
830 @config_variable_registry.register
831 class ConfigVariableSidebarNotifyInterval(ConfigVariable):
832 def group(self):
833 return ConfigVariableGroupUserInterface
835 def domain(self):
836 return ConfigDomainGUI
838 def ident(self):
839 return "sidebar_notify_interval"
841 def valuespec(self):
842 return Optional(
843 Float(
844 minvalue=10.0,
845 unit="sec",
846 display_format="%.1f",
848 title=_("Interval of sidebar popup notification updates"),
849 help=_(
850 "The sidebar can be configured to regularly check for pending popup notififcations. "
851 "This is disabled by default."),
852 none_label=_('(disabled)'),
856 @config_variable_registry.register
857 class ConfigVariableiAdHocDowntime(ConfigVariable):
858 def group(self):
859 return ConfigVariableGroupUserInterface
861 def domain(self):
862 return ConfigDomainGUI
864 def ident(self):
865 return "adhoc_downtime"
867 def valuespec(self):
868 return Optional(
869 Dictionary(
870 optional_keys=False,
871 elements=[
872 ("duration",
873 Integer(
874 title=_("Duration"),
875 help=_("The duration in minutes of the adhoc downtime."),
876 minvalue=1,
877 unit=_("minutes"),
878 default_value=60,
880 ("comment",
881 TextUnicode(
882 title=_("Adhoc comment"),
883 help=_("The comment which is automatically sent with an adhoc downtime"),
884 size=80,
885 allow_empty=False,
886 attrencode=True,
890 title=_("Adhoc downtime"),
891 label=_("Enable adhoc downtime"),
892 help=_("This setting allows to set an adhoc downtime comment and its duration. "
893 "When enabled a new button <i>Adhoc downtime for __ minutes</i> will "
894 "be available in the command form."),
898 @config_variable_registry.register
899 class ConfigVariableAuthByHTTPHeader(ConfigVariable):
900 def group(self):
901 return ConfigVariableGroupUserInterface
903 def domain(self):
904 return ConfigDomainGUI
906 def ident(self):
907 return "auth_by_http_header"
909 def valuespec(self):
910 return Optional(
911 TextAscii(
912 label=_("HTTP Header Variable"),
913 help=_("Configure the name of the environment variable to read "
914 "from the incoming HTTP requests"),
915 default_value='REMOTE_USER',
916 attrencode=True,
918 title=_("Authenticate users by incoming HTTP requests"),
919 label=_("Activate HTTP header authentication (Warning: Only activate "
920 "in trusted environments, see help for details)"),
921 help=_("If this option is enabled, multisite reads the configured HTTP header "
922 "variable from the incoming HTTP request and simply takes the string "
923 "in this variable as name of the authenticated user. "
924 "Be warned: Only allow access from trusted ip addresses "
925 "(Apache <tt>Allow from</tt>), like proxy "
926 "servers, to this webpage. A user with access to this page could simply fake "
927 "the authentication information. This option can be useful to "
928 " realize authentication in reverse proxy environments."),
929 none_value=False,
930 none_label=_("Don't use HTTP header authentication"),
931 indent=False,
935 @config_variable_registry.register
936 class ConfigVariableStalenessThreshold(ConfigVariable):
937 def group(self):
938 return ConfigVariableGroupUserInterface
940 def domain(self):
941 return ConfigDomainGUI
943 def ident(self):
944 return "staleness_threshold"
946 def valuespec(self):
947 return Float(
948 title=_('Staleness value to mark hosts / services stale'),
949 help=_(
950 'The staleness value of a host / service is calculated by measuring the '
951 'configured check intervals a check result is old. A value of 1.5 means the '
952 'current check result has been gathered one and a half check intervals of an object. '
953 'This would mean 90 seconds in case of a check which is checked each 60 seconds.'),
954 minvalue=1,
958 @config_variable_registry.register
959 class ConfigVariableLoginScreen(ConfigVariable):
960 def group(self):
961 return ConfigVariableGroupUserInterface
963 def domain(self):
964 return ConfigDomainGUI
966 def ident(self):
967 return "login_screen"
969 def valuespec(self):
970 return Dictionary(
971 title=_("Customize login screen"),
972 elements=[
973 ("hide_version",
974 FixedValue(
975 True,
976 title=_("Hide Check_MK version"),
977 totext=_("Hide the Check_MK version from the login box"),
979 ("login_message",
980 TextUnicode(
981 title=_("Show a login message"),
982 help=
983 _("You may use this option to give your users an informational text before logging in."
985 size=80,
987 ("footer_links",
988 ListOf(
989 Tuple(
990 elements=[
991 TextUnicode(title=_("Title"),),
992 TextAscii(
993 title=_('URL'),
994 size=80,
996 DropdownChoice(
997 title=_("Open in"),
998 choices=[
999 ("_blank", _("Load in a new window / tab")),
1000 ("_top", _("Load in current window / tab")),
1004 orientation="horizontal",
1006 totext=_("%d links"),
1007 title=_("Custom footer links"),
1010 required_keys=[],
1014 @config_variable_registry.register
1015 class ConfigVariableUserLocalizations(ConfigVariable):
1016 def group(self):
1017 return ConfigVariableGroupUserInterface
1019 def domain(self):
1020 return ConfigDomainGUI
1022 def ident(self):
1023 return "user_localizations"
1025 def valuespec(self):
1026 return Transform(
1027 ListOf(
1028 Tuple(
1029 elements=[
1030 TextUnicode(title=_("Original Text"), size=40),
1031 Dictionary(
1032 title=_("Translations"),
1033 elements=lambda: [(l or "en", TextUnicode(title=a, size=32))
1034 for (l, a) in cmk.gui.i18n.get_languages()],
1035 columns=2,
1037 ],),
1038 title=_("Custom localizations"),
1039 movable=False,
1040 totext=_("%d translations"),
1042 forth=lambda d: sorted(d.items()),
1043 back=dict,
1047 @config_variable_registry.register
1048 class ConfigVariableUserIconsAndActions(ConfigVariable):
1049 def group(self):
1050 return ConfigVariableGroupUserInterface
1052 def domain(self):
1053 return ConfigDomainGUI
1055 def ident(self):
1056 return "user_icons_and_actions"
1058 def valuespec(self):
1059 return Transform(
1060 ListOf(
1061 Tuple(
1062 elements=[
1063 ID(title=_("ID")),
1064 Dictionary(
1065 elements=[
1066 ('icon', IconSelector(
1067 title=_('Icon'),
1068 allow_empty=False,
1070 ('title', TextUnicode(title=_('Title'),)),
1071 ('url',
1072 Transform(
1073 Tuple(
1074 title=_('Action'),
1075 elements=[
1076 TextAscii(
1077 title=_('URL'),
1078 help=
1079 _('This URL is opened when clicking on the action / icon. You '
1080 'can use some macros within the URL which are dynamically '
1081 'replaced for each object. These are:<br>'
1082 '<ul>'
1083 '<li>$HOSTNAME$: Contains the name of the host</li>'
1084 '<li>$HOSTNAME_URL_ENCODED$: Same as above but URL encoded</li>'
1085 '<li>$SERVICEDESC$: Contains the service description '
1086 '(in case this is a service)</li>'
1087 '<li>$SERVICEDESC_URL_ENCODED$: Same as above but URL encoded</li>'
1088 '<li>$HOSTADDRESS$: Contains the network address of the host</li>'
1089 '<li>$HOSTADDRESS_URL_ENCODED$: Same as above but URL encoded</li>'
1090 '<li>$USER_ID$: The user ID of the currently active user</li>'
1091 '</ul>'),
1092 size=80,
1094 DropdownChoice(
1095 title=_("Open in"),
1096 choices=[
1097 ("_blank", _("Load in a new window / tab")),
1098 ("_self",
1099 _("Load in current content area (keep sidebar)"
1101 ("_top", _("Load as new page (hide sidebar)")),
1106 forth=lambda x: not isinstance(x, tuple) and (x, "_self") or x,
1108 ('toplevel',
1109 FixedValue(
1110 True,
1111 title=_('Show in column'),
1112 totext=_('Directly show the action icon in the column'),
1113 help=_('Makes the icon appear in the column instead '
1114 'of the dropdown menu.'),
1116 ('sort_index',
1117 Integer(
1118 title=_('Sort index'),
1119 help=
1120 _('You can use the sort index to control the order of the '
1121 'elements in the column and the menu. The elements are sorted '
1122 'from smaller to higher numbers. The action menu icon '
1123 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1124 'of <tt>20</tt>. All other default icons have a sort index of '
1125 '<tt>30</tt> configured.'),
1126 min_value=0,
1127 default_value=15,
1130 optional_keys=['title', 'url', 'toplevel', 'sort_index'],
1132 ],),
1133 title=_("Custom icons and actions"),
1134 movable=False,
1135 totext=_("%d icons and actions"),
1137 forth=lambda d: sorted(d.items()),
1138 back=dict,
1142 @config_variable_registry.register
1143 class ConfigVariableCustomServiceAttributes(ConfigVariable):
1144 def group(self):
1145 return ConfigVariableGroupUserInterface
1147 def domain(self):
1148 return ConfigDomainGUI
1150 def ident(self):
1151 return "custom_service_attributes"
1153 def valuespec(self):
1154 return Transform(
1155 ListOf(
1156 Dictionary(
1157 elements=[
1158 ("ident",
1159 TextAscii(
1160 title=_("ID"),
1161 help=_("The ID will be used as internal identifier and the custom "
1162 "service attribute will be computed based on the ID. The "
1163 "custom service attribute will be named <tt>_[ID]</tt> in "
1164 "the core configuration and can be gathered using the "
1165 "Livestatus column <tt>custom_variables</tt> using the "
1166 "<tt>[ID]</tt>. The custom service attributes are available "
1167 "to notification scripts as environment variable named "
1168 "<tt>SERVICE_[ID]</tt>."),
1169 validate=self._validate_id,
1170 regex=re.compile('^[A-Z_][-A-Z0-9_]*$'),
1171 regex_error=_(
1172 "An identifier must only consist of letters, digits, dash and "
1173 "underscore and it must start with a letter or underscore.") + " "
1174 + _("Only upper case letters are allowed"))),
1175 ('title', TextUnicode(title=_('Title'),)),
1176 ("type",
1177 DropdownChoice(
1178 title=_("Data type"),
1179 choices=[
1180 ('TextAscii', _('Simple Text')),
1184 optional_keys=[],
1186 title=_("Custom service attributes"),
1187 help=_("These custom service attributes can be assigned to services "
1188 "using the ruleset <a href=\"%s\">%s</a>.") %
1189 ("wato.py?mode=edit_ruleset&varname=custom_service_attributes",
1190 _("Custom service attributes")),
1191 movable=False,
1192 totext=_("%d custom service attributes"),
1193 allow_empty=False,
1194 # Unique IDs are ensured by the transform below. The Transform is executed
1195 # before the validation function has the chance to validate it and print a
1196 # custom error message.
1197 validate=self._validate_unique_entries,
1199 forth=lambda v: v.values(),
1200 back=lambda v: {p["ident"]: p for p in v},
1203 def _validate_id(self, value, varprefix):
1204 internal_ids = [
1205 "ESCAPE_PLUGIN_OUTPUT",
1206 "EC_SL",
1207 "EC_CONTACT",
1208 "SERVICE_PERIOD",
1209 "ACTIONS",
1211 if value.upper() in internal_ids:
1212 raise MKUserError(varprefix, _("This ID can not be used as custom attribute"))
1214 def _validate_unique_entries(self, value, varprefix):
1215 seen_titles = []
1216 for entry in value:
1217 if entry["title"] in seen_titles:
1218 raise MKUserError(varprefix,
1219 _("Found multiple entries using the title '%s'") % entry["title"])
1220 seen_titles.append(entry["title"])
1223 @rulespec_registry.register
1224 class RulespecCustomServiceAttributes(ServiceRulespec):
1225 @property
1226 def group(self):
1227 return RulespecGroupMonitoringConfigurationServiceChecks
1229 @property
1230 def name(self):
1231 return "custom_service_attributes"
1233 @property
1234 def match_type(self):
1235 return "all"
1237 @property
1238 def item_type(self):
1239 return "service"
1241 @property
1242 def valuespec(self):
1243 return ListOf(
1244 CascadingDropdown(
1245 choices=self._custom_service_attribute_choices(),
1246 orientation="horizontal",
1248 title=_("Custom service attributes"),
1249 help=_("Use this ruleset to assign <a href=\"%s\">%s</a> to services.") %
1250 ("wato.py?mode=edit_configvar&varname=custom_service_attributes",
1251 _("Custom service attributes")),
1252 allow_empty=False,
1253 validate=self._validate_unique_entries,
1256 def _custom_service_attribute_choices(self):
1257 choices = []
1259 for ident, attr_spec in config.custom_service_attributes.items():
1260 if attr_spec["type"] == "TextAscii":
1261 vs = TextAscii()
1262 else:
1263 raise NotImplementedError()
1264 choices.append((ident, attr_spec["title"], vs))
1266 return sorted(choices, key=lambda x: x[1])
1268 def _validate_unique_entries(self, value, varprefix):
1269 seen_ids = []
1270 for entry in value:
1271 if entry[0] in seen_ids:
1272 raise MKUserError(varprefix, _("Found multiple entries using for '%s'") % entry[0])
1273 seen_ids.append(entry[0])
1276 @rulespec_registry.register
1277 class RulespecServiceTags(ServiceRulespec):
1278 @property
1279 def group(self):
1280 return RulespecGroupMonitoringConfigurationServiceChecks
1282 @property
1283 def name(self):
1284 return "service_tag_rules"
1286 @property
1287 def match_type(self):
1288 return "all"
1290 @property
1291 def item_type(self):
1292 return "service"
1294 @property
1295 def valuespec(self):
1296 return ListOf(
1297 CascadingDropdown(
1298 choices=self._tag_group_choices(),
1299 orientation="horizontal",
1301 title=_("Service tags"),
1302 help=_("Use this ruleset to assign <a href=\"%s\">%s</a> to services.") %
1303 ("wato.py?mode=tags", _("Tags")),
1304 allow_empty=False,
1305 validate=self._validate_unique_entries,
1308 def _tag_group_choices(self):
1309 choices = []
1311 for tag_group in config.tags.tag_groups:
1312 choices.append((tag_group.id, tag_group.title,
1313 DropdownChoice(choices=tag_group.get_tag_choices(),)))
1315 return sorted(choices, key=lambda x: x[1])
1317 def _validate_unique_entries(self, value, varprefix):
1318 seen_ids = []
1319 for entry in value:
1320 if entry[0] in seen_ids:
1321 raise MKUserError(varprefix, _("Found multiple entries using for '%s'") % entry[0])
1322 seen_ids.append(entry[0])
1325 @rulespec_registry.register
1326 class RulespecServiceLabels(ServiceRulespec):
1327 @property
1328 def group(self):
1329 return RulespecGroupMonitoringConfigurationServiceChecks
1331 @property
1332 def name(self):
1333 return "service_label_rules"
1335 @property
1336 def match_type(self):
1337 return "dict"
1339 @property
1340 def item_type(self):
1341 return "service"
1343 @property
1344 def valuespec(self):
1345 return Labels(
1346 world=Labels.World.CONFIG,
1347 label_source=Labels.Source.RULESET,
1348 title=_("Service labels"),
1349 help=_("Use this ruleset to assign labels to service of your choice."),
1353 @rulespec_registry.register
1354 class RulespecHostLabels(HostRulespec):
1355 @property
1356 def group(self):
1357 return RulespecGroupMonitoringConfigurationHostChecks
1359 @property
1360 def name(self):
1361 return "host_label_rules"
1363 @property
1364 def match_type(self):
1365 return "dict"
1367 @property
1368 def valuespec(self):
1369 return Labels(
1370 world=Labels.World.CONFIG,
1371 label_source=Labels.Source.RULESET,
1372 title=_("Host labels"),
1373 help=_("Use this ruleset to assign labels to hosts of your choice."),
1377 @config_variable_registry.register
1378 class ConfigVariableUserDowntimeTimeranges(ConfigVariable):
1379 def group(self):
1380 return ConfigVariableGroupUserInterface
1382 def domain(self):
1383 return ConfigDomainGUI
1385 def ident(self):
1386 return "user_downtime_timeranges"
1388 def valuespec(self):
1389 return ListOf(
1390 Dictionary(
1391 elements=[('title', TextUnicode(title=_('Title'),)),
1392 ('end',
1393 Alternative(
1394 title=_("To"),
1395 elements=[
1396 Age(
1397 title=_("Duration"),
1398 display=["minutes", "hours", "days"],
1400 DropdownChoice(
1401 title=_("Until"),
1402 choices=[
1403 ('next_day', _("Start of next day")),
1404 ('next_week', _("Start of next week")),
1405 ('next_month', _("Start of next month")),
1406 ('next_year', _("Start of next year")),
1408 default_value="next_day",
1411 style="dropdown",
1412 default_value=24 * 60 * 60,
1413 ))],
1414 optional_keys=[],
1416 title=_("Custom Downtime Timeranges"),
1417 movable=True,
1418 totext=_("%d timeranges"),
1422 @config_variable_registry.register
1423 class ConfigVariableBuiltinIconVisibility(ConfigVariable):
1424 def group(self):
1425 return ConfigVariableGroupUserInterface
1427 def domain(self):
1428 return ConfigDomainGUI
1430 def ident(self):
1431 return "builtin_icon_visibility"
1433 def valuespec(self):
1434 return Transform(
1435 ListOf(
1436 Tuple(
1437 elements=[
1438 DropdownChoice(
1439 title=_("Icon"),
1440 choices=self._get_builtin_icons,
1441 sorted=True,
1443 Dictionary(
1444 elements=[
1445 ('toplevel',
1446 Checkbox(
1447 title=_('Show in column'),
1448 label=_('Directly show the action icon in the column'),
1449 help=_('Makes the icon appear in the column instead '
1450 'of the dropdown menu.'),
1451 default_value=True,
1453 ('sort_index',
1454 Integer(
1455 title=_('Sort index'),
1456 help=
1457 _('You can use the sort index to control the order of the '
1458 'elements in the column and the menu. The elements are sorted '
1459 'from smaller to higher numbers. The action menu icon '
1460 'has a sort index of <tt>10</tt>, the graph icon a sort index '
1461 'of <tt>20</tt>. All other default icons have a sort index of '
1462 '<tt>30</tt> configured.'),
1463 min_value=0,
1466 optional_keys=['toplevel', 'sort_index'],
1468 ],),
1469 title=_("Builtin icon visibility"),
1470 movable=False,
1471 totext=_("%d icons customized"),
1472 help=_("You can use this option to change the default visibility "
1473 "options of the builtin icons. You can change whether or not "
1474 "the icons are shown in the popup menu or on top level and "
1475 "change the sorting of the icons."),
1477 forth=lambda d: sorted(d.items()),
1478 back=dict,
1481 def _get_builtin_icons(self):
1482 return [(id_, id_) for id_ in icon_and_action_registry.keys()]
1485 @config_variable_registry.register
1486 class ConfigVariableServiceViewGrouping(ConfigVariable):
1487 def group(self):
1488 return ConfigVariableGroupUserInterface
1490 def domain(self):
1491 return ConfigDomainGUI
1493 def ident(self):
1494 return "service_view_grouping"
1496 def valuespec(self):
1497 return ListOf(
1498 Dictionary(
1499 elements=[
1500 ('title', TextUnicode(title=_('Title to show for the group'),)),
1501 ('pattern',
1502 RegExpUnicode(
1503 title=_('Grouping expression'),
1504 help=_('This regular expression is used to match the services to be put '
1505 'into this group. This is a prefix match regular expression.'),
1506 mode=RegExpUnicode.prefix,
1508 ('min_items',
1509 Integer(
1510 title=_('Minimum number of items to create a group'),
1511 help=_('When less than these items are found for a group, the services '
1512 'are not shown grouped together.'),
1513 min_value=2,
1514 default_value=2,
1517 optional_keys=[],
1519 title=_("Grouping of services in table views"),
1520 help=_(
1521 "You can use this option to make the service table views fold services matching "
1522 "the given patterns into groups. Only services in state <i>OK</i> will be folded "
1523 "together. Groups of only one service will not be rendered. If multiple patterns "
1524 "match a service, the service will be added to the first matching group."),
1525 add_label=_("Add new grouping definition"),
1529 @config_variable_registry.register
1530 class ConfigVariableTopologyDefaultFilterGroup(ConfigVariable):
1531 def group(self):
1532 return ConfigVariableGroupUserInterface
1534 def domain(self):
1535 return ConfigDomainGUI
1537 def ident(self):
1538 return "topology_default_filter_group"
1540 def valuespec(self):
1541 return Optional(
1542 DropdownChoice(
1543 choices=lambda: sites.all_groups("host"),
1544 sorted=True,
1546 title=_("Network Topology: Default Filter Group"),
1547 help=_(
1548 "By default the network topology view shows you the parent / child relations "
1549 "of all hosts within your local site. The list can be filtered based on hostgroup "
1550 "memberships by the users. You can define a default group to use for filtering "
1551 "which is used when a user opens the network topology view."),
1552 none_label=_("Show all hosts when opening the network topology view"),
1556 @config_variable_registry.register
1557 class ConfigVariableViewActionDefaults(ConfigVariable):
1558 def group(self):
1559 return ConfigVariableGroupUserInterface
1561 def domain(self):
1562 return ConfigDomainGUI
1564 def ident(self):
1565 return "view_action_defaults"
1567 def valuespec(self):
1568 return Dictionary(
1569 title=_("View action defaults"),
1570 elements=[
1571 ("ack_sticky", Checkbox(
1572 title=_("Sticky"),
1573 label=_("Enable"),
1574 default_value=True,
1576 ("ack_notify",
1577 Checkbox(
1578 title=_("Send notification"),
1579 label=_("Enable"),
1580 default_value=True,
1582 ("ack_persistent",
1583 Checkbox(
1584 title=_("Persistent comment"),
1585 label=_("Enable"),
1586 default_value=False,
1588 ("ack_expire",
1589 Age(
1590 title=_("Expire acknowledgement after"),
1591 display=["days", "hours", "minutes"],
1592 default_value=0,
1595 optional_keys=[],
1599 @config_variable_registry.register
1600 class ConfigVariableTrustedCertificateAuthorities(ConfigVariable):
1601 def group(self):
1602 return ConfigVariableGroupSiteManagement
1604 def domain(self):
1605 return ConfigDomainCACertificates
1607 def ident(self):
1608 return "trusted_certificate_authorities"
1610 def valuespec(self):
1611 return Dictionary(
1612 title=_("Trusted certificate authorities for SSL"),
1613 help=_("Whenever a server component of Check_MK opens a SSL connection it uses the "
1614 "certificate authorities configured here for verifying the SSL certificate of "
1615 "the destination server. This is used for example when performing WATO "
1616 "replication to slave sites or when special agents are communicating via HTTPS. "
1617 "The CA certificates configured here will be written to the CA bundle %s.") %
1618 site_neutral_path(ConfigDomainCACertificates.trusted_cas_file),
1619 elements=[
1620 ("use_system_wide_cas",
1621 Checkbox(
1622 title=_("Use system wide CAs"),
1623 help=_("All supported linux distributions provide a mechanism of managing "
1624 "trusted CAs. Depending on your linux distributions the paths where "
1625 "these CAs are stored and the commands to manage the CAs differ. "
1626 "Please checko out the documentation of your linux distribution "
1627 "in case you want to customize trusted CAs system wide. You can "
1628 "choose here to trust the system wide CAs here. Check_MK will search "
1629 "these directories for system wide CAs: %s") % ", ".join(
1630 ConfigDomainCACertificates.system_wide_trusted_ca_search_paths),
1631 label=_("Trust system wide configured CAs"),
1633 ("trusted_cas", ListOfCAs(
1634 title=_("Check_MK specific"),
1635 allow_empty=True,
1638 optional_keys=False,
1643 # .--WATO----------------------------------------------------------------.
1644 # | __ ___ _____ ___ |
1645 # | \ \ / / \|_ _/ _ \ |
1646 # | \ \ /\ / / _ \ | || | | | |
1647 # | \ V V / ___ \| || |_| | |
1648 # | \_/\_/_/ \_\_| \___/ |
1649 # | |
1650 # +----------------------------------------------------------------------+
1651 # | Global Configuration for WATO |
1652 # '----------------------------------------------------------------------'
1655 @config_variable_group_registry.register
1656 class ConfigVariableGroupWATO(ConfigVariableGroup):
1657 def title(self):
1658 return _("Administration Tool (WATO)")
1660 def sort_index(self):
1661 return 25
1664 @config_variable_registry.register
1665 class ConfigVariableWATOMaxSnapshots(ConfigVariable):
1666 def group(self):
1667 return ConfigVariableGroupWATO
1669 def domain(self):
1670 return ConfigDomainGUI
1672 def ident(self):
1673 return "wato_max_snapshots"
1675 def valuespec(self):
1676 return Integer(
1677 title=_("Number of configuration snapshots to keep"),
1678 help=_("Whenever you successfully activate changes a snapshot of the configuration "
1679 "will be created. You can also create snapshots manually. WATO will delete old "
1680 "snapshots when the maximum number of snapshots is reached."),
1681 minvalue=1,
1685 @config_variable_registry.register
1686 class ConfigVariableWATOActivationMethod(ConfigVariable):
1687 def group(self):
1688 return ConfigVariableGroupWATO
1690 def domain(self):
1691 return ConfigDomainGUI
1693 def ident(self):
1694 return "wato_activation_method"
1696 def valuespec(self):
1697 return DropdownChoice(
1698 title=_("WATO restart mode for Nagios"),
1699 help=_("Should WATO restart or reload Nagios when activating changes"),
1700 choices=[
1701 ('restart', _("Restart")),
1702 ('reload', _("Reload")),
1707 @config_variable_registry.register
1708 class ConfigVariableWATOLegacyEval(ConfigVariable):
1709 def group(self):
1710 return ConfigVariableGroupWATO
1712 def domain(self):
1713 return ConfigDomainGUI
1715 def ident(self):
1716 return "wato_legacy_eval"
1718 def valuespec(self):
1719 return Checkbox(
1720 title=_("Use unsafe legacy encoding for distributed WATO"),
1721 help=
1722 _("The current implementation of WATO uses a Python module called <tt>ast</tt> for the "
1723 "communication between sites. Previous versions of Check_MK used an insecure encoding "
1724 "named <tt>pickle</tt>. Even in the current version WATO falls back to <tt>pickle</tt> "
1725 "if your Python version is not recent enough. This is at least the case for RedHat/CentOS 5.X "
1726 "and Debian 5.0. In a mixed environment you can force using the legacy <tt>pickle</tt> format "
1727 "in order to create compatibility."),
1731 @config_variable_registry.register
1732 class ConfigVariableWATOHideFilenames(ConfigVariable):
1733 def group(self):
1734 return ConfigVariableGroupWATO
1736 def domain(self):
1737 return ConfigDomainGUI
1739 def ident(self):
1740 return "wato_hide_filenames"
1742 def valuespec(self):
1743 return Checkbox(
1744 title=_("Hide internal folder names in WATO"),
1745 label=_("hide folder names"),
1746 help=_("When enabled, then the internal names of WATO folder in the filesystem "
1747 "are not shown. They will automatically be derived from the name of the folder "
1748 "when a new folder is being created. Disable this option if you want to see and "
1749 "set the filenames manually."),
1753 @config_variable_registry.register
1754 class ConfigVariableWATOUploadInsecureSnapshots(ConfigVariable):
1755 def group(self):
1756 return ConfigVariableGroupWATO
1758 def domain(self):
1759 return ConfigDomainGUI
1761 def ident(self):
1762 return "wato_upload_insecure_snapshots"
1764 def valuespec(self):
1765 return Checkbox(
1766 title=_("Allow upload of insecure WATO snapshots"),
1767 label=_("upload insecure snapshots"),
1768 help=
1769 _("When enabled, insecure snapshots are allowed. Please keep in mind that the upload "
1770 "of unverified snapshots represents a security risk, since the content of a snapshot is executed "
1771 "during runtime. Any manipulations in the content - either willingly or unwillingly (XSS attack) "
1772 "- pose a serious security risk."),
1776 @config_variable_registry.register
1777 class ConfigVariableWATOHideHosttags(ConfigVariable):
1778 def group(self):
1779 return ConfigVariableGroupWATO
1781 def domain(self):
1782 return ConfigDomainGUI
1784 def ident(self):
1785 return "wato_hide_hosttags"
1787 def valuespec(self):
1788 return Checkbox(
1789 title=_("Hide hosttags in WATO folder view"),
1790 label=_("hide hosttags"),
1791 help=_("When enabled, hosttags are no longer shown within the WATO folder view"),
1795 @config_variable_registry.register
1796 class ConfigVariableWATOHideVarnames(ConfigVariable):
1797 def group(self):
1798 return ConfigVariableGroupWATO
1800 def domain(self):
1801 return ConfigDomainGUI
1803 def ident(self):
1804 return "wato_hide_varnames"
1806 def valuespec(self):
1807 return Checkbox(
1808 title=_("Hide names of configuration variables"),
1809 label=_("hide variable names"),
1810 help=_("When enabled, internal configuration variable names of Check_MK are hidden "
1811 "from the user (for example in the rule editor)"),
1815 @config_variable_registry.register
1816 class ConfigVariableHideHelpInLists(ConfigVariable):
1817 def group(self):
1818 return ConfigVariableGroupWATO
1820 def domain(self):
1821 return ConfigDomainGUI
1823 def ident(self):
1824 return "wato_hide_help_in_lists"
1826 def valuespec(self):
1827 return Checkbox(
1828 title=_("Hide help text of rules in list views"),
1829 label=_("hide help text"),
1830 help=_("When disabled, WATO shows the help texts of rules also in the list views."),
1834 @config_variable_registry.register
1835 class ConfigVariableWATOUseGit(ConfigVariable):
1836 def group(self):
1837 return ConfigVariableGroupWATO
1839 def domain(self):
1840 return ConfigDomainGUI
1842 def ident(self):
1843 return "wato_use_git"
1845 def valuespec(self):
1846 return Checkbox(
1847 title=_("Use GIT version control for WATO"),
1848 label=_("enable GIT version control"),
1849 help=_(
1850 "When enabled, all changes of configuration files are tracked with the "
1851 "version control system GIT. You need to make sure that git is installed "
1852 "on your monitoring server. The version history currently cannot be viewed "
1853 "via the web GUI. Please use git command line tools within your Check_MK "
1854 "configuration directory. If you want easier tracking of configuration file changes "
1855 "simply enable the global settings option <tt>Pretty print configuration files</tt>"
1860 @config_variable_registry.register
1861 class ConfigVariableWATOPrettyPrintConfig(ConfigVariable):
1862 def group(self):
1863 return ConfigVariableGroupWATO
1865 def domain(self):
1866 return ConfigDomainGUI
1868 def ident(self):
1869 return "wato_pprint_config"
1871 def valuespec(self):
1872 return Checkbox(
1873 title=_("Pretty-Print configuration files"),
1874 label=_("pretty-print configuration files"),
1875 help=
1876 _("When enabled, most of the configuration files are pretty printed and easier to read. "
1877 "On the downside, however, pretty printing bigger configurations can be quite slow - "
1878 "so the overall WATO GUI performance will decrease."),
1882 @config_variable_registry.register
1883 class ConfigVariableWATOHideFoldersWithoutReadPermissions(ConfigVariable):
1884 def group(self):
1885 return ConfigVariableGroupWATO
1887 def domain(self):
1888 return ConfigDomainGUI
1890 def ident(self):
1891 return "wato_hide_folders_without_read_permissions"
1893 def valuespec(self):
1894 return Checkbox(
1895 title=_("Hide folders without read permissions"),
1896 label=_("hide folders without read permissions"),
1897 help=_(
1898 "When enabled, a subfolder is not shown, when the user does not have sufficient "
1899 "permissions to this folder and all of its subfolders. However, the subfolder is "
1900 "shown if the user has permissions to any of its subfolder."),
1904 @config_variable_registry.register
1905 class ConfigVariableWATOIconCategories(ConfigVariable):
1906 def group(self):
1907 return ConfigVariableGroupWATO
1909 def domain(self):
1910 return ConfigDomainGUI
1912 def ident(self):
1913 return "wato_icon_categories"
1915 def valuespec(self):
1916 return ListOf(
1917 Tuple(
1918 elements=[
1919 ID(title=_("ID"),),
1920 TextUnicode(title=_("Title"),),
1922 orientation="horizontal",
1924 title=_("Icon categories"),
1925 help=_("You can customize the list of icon categories to be able to assign "
1926 "your <a href=\"?mode=icons\">custom icons</a> to these categories. "
1927 "They will then be shown under this category in the icon selector."),
1932 # .--User Management-----------------------------------------------------.
1933 # | _ _ __ __ _ |
1934 # | | | | |___ ___ _ __ | \/ | __ _ _ __ ___ | |_ |
1935 # | | | | / __|/ _ \ '__| | |\/| |/ _` | '_ ` _ \| __| |
1936 # | | |_| \__ \ __/ | | | | | (_| | | | | | | |_ |
1937 # | \___/|___/\___|_| |_| |_|\__, |_| |_| |_|\__| |
1938 # | |___/ |
1939 # +----------------------------------------------------------------------+
1940 # | Global settings for users and LDAP connector. |
1941 # '----------------------------------------------------------------------'
1944 @config_variable_group_registry.register
1945 class ConfigVariableGroupUserManagement(ConfigVariableGroup):
1946 def title(self):
1947 return _("User Management")
1949 def sort_index(self):
1950 return 40
1953 @config_variable_registry.register
1954 class ConfigVariableLockOnLogonFailures(ConfigVariable):
1955 def group(self):
1956 return ConfigVariableGroupUserManagement
1958 def domain(self):
1959 return ConfigDomainGUI
1961 def ident(self):
1962 return "lock_on_logon_failures"
1964 def valuespec(self):
1965 return Optional(
1966 Integer(
1967 label=_("Number of logon failures to lock the account"),
1968 default_value=3,
1969 minvalue=1,
1971 none_value=False,
1972 title=_("Lock user accounts after N logon failures"),
1973 label=_("Activate automatic locking of user accounts"),
1974 help=_("This options enables automatic locking of user accounts after "
1975 "the configured number of consecutive invalid login attempts. "
1976 "Once the account is locked only an admin user can unlock it. "
1977 "Beware: Also the admin users will be locked that way. You need "
1978 "to manually edit <tt>etc/htpasswd</tt> and remove the <tt>!</tt> "
1979 "in case you are locked out completely."),
1983 @config_variable_registry.register
1984 class ConfigVariablePasswordPolicy(ConfigVariable):
1985 def group(self):
1986 return ConfigVariableGroupUserManagement
1988 def domain(self):
1989 return ConfigDomainGUI
1991 def ident(self):
1992 return "password_policy"
1994 def valuespec(self):
1995 return Dictionary(
1996 title=_('Password policy for local accounts'),
1997 help=_(
1998 'You can define some rules to which each user password ahers. By default '
1999 'all passwords are accepted, even ones which are made of only a single character, '
2000 'which is obviously a bad idea. Using this option you can enforce your users '
2001 'to choose more secure passwords.'),
2002 elements=[
2003 ('min_length', Integer(
2004 title=_("Minimum password length"),
2005 minvalue=1,
2007 ('num_groups',
2008 Integer(
2009 title=_("Number of character groups to use"),
2010 minvalue=1,
2011 maxvalue=4,
2012 help=_(
2013 "Force the user to choose a password that contains characters from at least "
2014 "this number of different character groups. "
2015 "Character groups are: <ul>"
2016 "<li>lowercase letters</li>"
2017 "<li>uppercase letters</li>"
2018 "<li>digits</li>"
2019 "<li>special characters such as an underscore or dash</li>"
2020 "</ul>"),
2022 ('max_age',
2023 Age(
2024 title=_("Maximum age of passwords"),
2025 minvalue=1,
2026 display=["days"],
2027 default_value=365 * 86400,
2033 @config_variable_registry.register
2034 class ConfigVariableUserIdleTimeout(ConfigVariable):
2035 def group(self):
2036 return ConfigVariableGroupUserManagement
2038 def domain(self):
2039 return ConfigDomainGUI
2041 def ident(self):
2042 return "user_idle_timeout"
2044 def valuespec(self):
2045 return Optional(
2046 Age(
2047 title=None,
2048 display=["minutes", "hours", "days"],
2049 minvalue=60,
2050 default_value=3600,
2052 title=_("Login session idle timeout"),
2053 label=_("Enable a login session idle timeout"),
2054 help=_("Normally a user login session is valid until the password is changed or "
2055 "the user is locked. By enabling this option, you can apply a time limit "
2056 "to login sessions which is applied when the user stops interacting with "
2057 "the GUI for a given amount of time. When a user is exceeding the configured "
2058 "maximum idle time, the user will be logged out and redirected to the login "
2059 "screen to renew the login session. This setting can be overriden for each "
2060 "user individually in the profile of the users."),
2064 @config_variable_registry.register
2065 class ConfigVariableSingleUserSession(ConfigVariable):
2066 def group(self):
2067 return ConfigVariableGroupUserManagement
2069 def domain(self):
2070 return ConfigDomainGUI
2072 def ident(self):
2073 return "single_user_session"
2075 def valuespec(self):
2076 return Optional(
2077 Age(
2078 title=None,
2079 display=["minutes", "hours"],
2080 label=_("Session timeout:"),
2081 minvalue=30,
2082 default_value=60,
2084 title=_("Limit login to single session at a time"),
2085 label=_("Users can only login from one client at a time"),
2086 help=_("Normally a user can login to the GUI from unlimited number of clients at "
2087 "the same time. If you want to enforce your users to be able to login only once "
2088 " (from one client which means device and browser), you can enable this option. "
2089 "When the user logs out or is inactive for the configured amount of time, the "
2090 "session is invalidated automatically and the user has to log in again from the "
2091 "current or another device."),
2095 @config_variable_registry.register
2096 class ConfigVariableDefaultUserProfile(ConfigVariable):
2097 def group(self):
2098 return ConfigVariableGroupUserManagement
2100 def domain(self):
2101 return ConfigDomainGUI
2103 def ident(self):
2104 return "default_user_profile"
2106 def valuespec(self):
2107 return Dictionary(
2108 title=_("Default user profile"),
2109 help=_(
2110 "With this option you can specify the attributes a user which is created during "
2111 "its initial login gets added. For example, the default is to add the role \"user\" "
2112 "to all automatically created users."),
2113 elements=self._default_user_profile_elements,
2114 optional_keys=[],
2117 def _default_user_profile_elements(self):
2118 elements = []
2120 if cmk.is_managed_edition():
2121 import cmk.gui.cme.managed as managed
2122 elements += managed.customer_choice_element()
2124 return elements + [
2125 ('roles',
2126 ListChoice(
2127 title=_('User roles'),
2128 help=_('Specify the initial roles of an automatically created user.'),
2129 default_value=['user'],
2130 choices=self._list_roles,
2132 ('contactgroups',
2133 ListChoice(
2134 title=_('Contact groups'),
2135 help=_('Specify the initial contact groups of an automatically created user.'),
2136 default_value=[],
2137 choices=self._list_contactgroups,
2139 ("force_authuser",
2140 Checkbox(
2141 title=_("Visibility of Hosts/Services"),
2142 label=_("Only show hosts and services the user is a contact for"),
2143 help=_("Specifiy the initial setting for an automatically created user."),
2144 default_value=False,
2148 def _list_roles(self):
2149 roles = userdb.load_roles()
2150 return [(i, r["alias"]) for i, r in roles.items()]
2152 def _list_contactgroups(self):
2153 contact_groups = load_contact_group_information()
2154 entries = [(c, g['alias']) for c, g in contact_groups.items()]
2155 return sorted(entries)
2158 @config_variable_registry.register
2159 class ConfigVariableSaveUserAccessTimes(ConfigVariable):
2160 def group(self):
2161 return ConfigVariableGroupUserManagement
2163 def domain(self):
2164 return ConfigDomainGUI
2166 def ident(self):
2167 return "save_user_access_times"
2169 def valuespec(self):
2170 return Checkbox(
2171 title=_("Save last access times of users"),
2172 label=_("Save the time of the latest user activity"),
2173 help=_("When enabled, the time of the last access is stored for each user. The last "
2174 "activity is shown on the users page."),
2179 # .--Check_MK------------------------------------------------------------.
2180 # | ____ _ _ __ __ _ __ |
2181 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
2182 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
2183 # | | |___| | | | __/ (__| < | | | | . \ |
2184 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
2185 # | |_____| |
2186 # +----------------------------------------------------------------------+
2187 # | Operation mode of Check_MK |
2188 # '----------------------------------------------------------------------'
2191 @config_variable_group_registry.register
2192 class ConfigVariableGroupCheckExecution(ConfigVariableGroup):
2193 def title(self):
2194 return _("Execution of checks")
2196 def sort_index(self):
2197 return 10
2200 @config_variable_registry.register
2201 class ConfigVariableUseNewDescriptionsFor(ConfigVariable):
2202 def group(self):
2203 return ConfigVariableGroupCheckExecution
2205 def domain(self):
2206 return ConfigDomainCore
2208 def ident(self):
2209 return "use_new_descriptions_for"
2211 def valuespec(self):
2212 return ListChoice(
2213 title=_("Use new service descriptions"),
2214 help=_(
2215 "In order to make Check_MK more consistent, "
2216 "the descriptions of several services have been renamed in newer "
2217 "Check_MK versions. One example is the filesystem services that have "
2218 "been renamed from <tt>fs_</tt> into <tt>Filesystem</tt>. But since renaming "
2219 "of existing services has many implications - including existing rules, performance "
2220 "data and availability history - these renamings are disabled per default for "
2221 "existing installations. Here you can switch to the new descriptions for "
2222 "selected check types"),
2223 choices=[
2224 ("df", _("Used space in filesystems")),
2225 ("df_netapp", _("NetApp Filers: Used Space in Filesystems")),
2226 ("df_netapp32", _("NetApp Filers: Used space in Filesystem Using 32-Bit Counters")),
2227 ("esx_vsphere_datastores", _("VMWare ESX host systems: Used space")),
2228 ("hr_fs", _("Used space in filesystems via SNMP")),
2229 ("vms_diskstat.df", _("Disk space on OpenVMS")),
2230 ("zfsget", _("Used space in ZFS pools and filesystems")),
2231 ("ps", _("State and Count of Processes")),
2232 ("ps.perf", _("State and Count of Processes (with additional performance data)")),
2233 ("wmic_process", _("Resource consumption of windows processes")),
2234 ("services", _("Windows Services")),
2235 ("logwatch", _("Check logfiles for relevant new messages")),
2236 ("logwatch.groups", _("Check logfile groups")),
2237 ("cmk-inventory", _("Monitor hosts for unchecked services (Check_MK Discovery)")),
2238 ("hyperv_vms", _("Hyper-V Server: State of VMs")),
2239 ("ibm_svc_mdiskgrp",
2240 _("IBM SVC / Storwize V3700 / V7000: Status and Usage of MDisksGrps")),
2241 ("ibm_svc_system", _("IBM SVC / V7000: System Info")),
2242 ("ibm_svc_systemstats.diskio",
2243 _("IBM SVC / V7000: Disk Throughput for Drives/MDisks/VDisks in Total")),
2244 ("ibm_svc_systemstats.iops",
2245 _("IBM SVC / V7000: IO operations/sec for Drives/MDisks/VDisks in Total")),
2246 ("ibm_svc_systemstats.disk_latency",
2247 _("IBM SVC / V7000: Latency for Drives/MDisks/VDisks in Total")),
2248 ("ibm_svc_systemstats.cache", _("IBM SVC / V7000: Cache Usage in Total")),
2249 ("casa_cpu_temp", _("Casa module: CPU temperature")),
2250 ("cmciii.temp", _("Rittal CMC-III Units: Temperatures")),
2251 ("cmciii.psm_current", _("Rittal CMC-III Units: Current")),
2252 ("cmciii_lcp_airin", _("Rittal CMC-III LCP: Air In and Temperature")),
2253 ("cmciii_lcp_airout", _("Rittal CMC-III LCP: Air Out Temperature")),
2254 ("cmciii_lcp_water", _("Rittal CMC-III LCP: Water In/Out Temperature")),
2255 ("etherbox.temp", _("Etherbox / MessPC: Sensor Temperature")),
2256 ("liebert_bat_temp", _("Liebert UPS Device: Temperature sensor")),
2257 ("nvidia.temp", _("Temperatures of NVIDIA graphics card")),
2258 ("ups_bat_temp", _("Generic UPS Device: Temperature sensor")),
2259 ("innovaphone_temp", _("Innovaphone Gateway: Current Temperature")),
2260 ("enterasys_temp", _("Enterasys Switch: Temperature")),
2261 ("raritan_emx", _("Raritan EMX Rack: Temperature")),
2262 ("raritan_pdu_inlet", _("Raritan PDU: Input Phases")),
2263 ("mknotifyd", _("Notification Spooler")),
2264 ("mknotifyd.connection", _("Notification Spooler Connection")),
2265 ("postfix_mailq", _("Postfix: Mail Queue")),
2266 ("nullmailer_mailq", _("Nullmailer: Mail Queue")),
2267 ("barracuda_mailqueues", _("Barracuda: Mail Queue")),
2268 ("qmail_stats", _("Qmail: Mail Queue")),
2269 ("http", _("Check HTTP: Use HTTPS instead of HTTP for SSL/TLS connections")),
2270 ("mssql_backup", _("MSSQL Backup")),
2271 ("mssql_counters.cache_hits", _("MSSQL Cache Hits")),
2272 ("mssql_counters.transactions", _("MSSQL Transactions")),
2273 ("mssql_counters.locks", _("MSSQL Locks")),
2274 ("mssql_counters.sqlstats", _("MSSQL SQL Stats")),
2275 ("mssql_counters.pageactivity", _("MSSQL Page Activity")),
2276 ("mssql_counters.locks_per_batch", _("MSSQL Locks per Batch")),
2277 ("mssql_counters.file_sizes", _("MSSQL File Sizes")),
2278 ("mssql_databases", _("MSSQL Database")),
2279 ("mssql_datafiles", _("MSSQL Datafile")),
2280 ("mssql_tablespaces", _("MSSQL Tablespace")),
2281 ("mssql_transactionlogs", _("MSSQL Transactionlog")),
2282 ("mssql_versions", _("MSSQL Version")),
2283 ("mssql_blocked_sessions", _("MSSQL Blocked Sessions")),
2285 render_orientation="vertical",
2289 @config_variable_registry.register
2290 class ConfigVariableTCPConnectTimeout(ConfigVariable):
2291 def group(self):
2292 return ConfigVariableGroupCheckExecution
2294 def domain(self):
2295 return ConfigDomainCore
2297 def ident(self):
2298 return "tcp_connect_timeout"
2300 def valuespec(self):
2301 return Float(
2302 title=_("Agent TCP connect timeout"),
2303 help=_(
2304 "Timeout for TCP connect to agent in seconds. If the connection "
2305 "to the agent cannot be established within this time, it is considered to be unreachable. "
2306 "Note: This does <b>not</b> limit the time the agent needs to "
2307 "generate its output."),
2308 minvalue=1.0,
2309 unit="sec",
2313 @config_variable_registry.register
2314 class ConfigVariableSimulationMode(ConfigVariable):
2315 def group(self):
2316 return ConfigVariableGroupCheckExecution
2318 def domain(self):
2319 return ConfigDomainCore
2321 def ident(self):
2322 return "simulation_mode"
2324 def valuespec(self):
2325 return Checkbox(
2326 title=_("Simulation mode"),
2327 label=_("Run in simulation mode"),
2328 help=_("This boolean variable allows you to bring check_mk into a dry run mode. "
2329 "No hosts will be contacted, no DNS lookups will take place and data is read "
2330 "from cache files that have been created during normal operation or have "
2331 "been copied here from another monitoring site."),
2335 @config_variable_registry.register
2336 class ConfigVariableRestartLocking(ConfigVariable):
2337 def group(self):
2338 return ConfigVariableGroupCheckExecution
2340 def domain(self):
2341 return ConfigDomainCore
2343 def ident(self):
2344 return "restart_locking"
2346 def valuespec(self):
2347 return DropdownChoice(
2348 title=_("Simultanous activation of changes"),
2349 help=_("When two users simultanously try to activate the changes then "
2350 "you can decide to abort with an error (default) or have the requests "
2351 "serialized. It is also possible - but not recommended - to turn "
2352 "off locking altogether."),
2353 choices=[
2354 ('abort', _("Abort with an error")),
2355 ('wait', _("Wait until the other has finished")),
2356 (None, _("Disable locking")),
2361 @config_variable_registry.register
2362 class ConfigVariableAgentSimulator(ConfigVariable):
2363 def group(self):
2364 return ConfigVariableGroupCheckExecution
2366 def domain(self):
2367 return ConfigDomainCore
2369 def ident(self):
2370 return "agent_simulator"
2372 def valuespec(self):
2373 return Checkbox(
2374 title=_("SNMP Agent Simulator"),
2375 label=_("Process stored SNMP walks with agent simulator"),
2376 help=_("When using stored SNMP walks you can place inline code generating "
2377 "dynamic simulation data. This feature can be activated here. There "
2378 "is a big chance that you will never need this feature..."),
2382 @config_variable_registry.register
2383 class ConfigVariableDelayPrecompile(ConfigVariable):
2384 def group(self):
2385 return ConfigVariableGroupCheckExecution
2387 def domain(self):
2388 return ConfigDomainCore
2390 def ident(self):
2391 return "delay_precompile"
2393 def valuespec(self):
2394 return Checkbox(
2395 title=_("Delay precompiling of host checks"),
2396 label=_("delay precompiling"),
2397 help=_(
2398 "If you enable this option, then Check_MK will not directly Python-bytecompile "
2399 "all host checks when activating the configuration and restarting Nagios. "
2400 "Instead it will delay this to the first "
2401 "time the host is actually checked being by Nagios.<p>This reduces the time needed "
2402 "for the operation, but on the other hand will lead to a slightly higher load "
2403 "of Nagios for the first couple of minutes after the restart. "),
2407 @config_variable_registry.register
2408 class ConfigVariableClusterMaxCachefileAge(ConfigVariable):
2409 def group(self):
2410 return ConfigVariableGroupCheckExecution
2412 def domain(self):
2413 return ConfigDomainCore
2415 def ident(self):
2416 return "cluster_max_cachefile_age"
2418 def valuespec(self):
2419 return Integer(
2420 title=_("Maximum cache file age for clusters"),
2421 label=_("seconds"),
2422 help=_("The number of seconds a cache file may be old if check_mk should "
2423 "use it instead of getting information from the target hosts while "
2424 "checking a cluster. Per default this is enabled and set to 90 seconds. "
2425 "If your check cycle is set to a larger value than one minute then "
2426 "you should increase this accordingly."),
2430 @config_variable_registry.register
2431 class ConfigVariablePiggybackMaxCachefileAge(ConfigVariable):
2432 def group(self):
2433 return ConfigVariableGroupCheckExecution
2435 def domain(self):
2436 return ConfigDomainCore
2438 def ident(self):
2439 return "piggyback_max_cachefile_age"
2441 def valuespec(self):
2442 return Age(
2443 title=_("Maximum age for piggyback files"),
2444 help=_(
2445 "The maximum age for piggy back data from another host to be valid for monitoring. "
2446 "Older files are deleted before processing them. Please make sure that this age is "
2447 "at least as large as you normal check interval for piggy hosts."),
2451 @config_variable_registry.register
2452 class ConfigVariableCheckMKPerfdataWithTimes(ConfigVariable):
2453 def group(self):
2454 return ConfigVariableGroupCheckExecution
2456 def domain(self):
2457 return ConfigDomainCore
2459 def ident(self):
2460 return "check_mk_perfdata_with_times"
2462 def valuespec(self):
2463 return Checkbox(
2464 title=_("Check_MK with times performance data"),
2465 label=_("Return process times within performance data"),
2466 help=_("Enabling this option results in additional performance data "
2467 "for the Check_MK output, giving information regarding the process times. "
2468 "It provides the following fields: user_time, system_time, children_user_time "
2469 "and children_system_time"),
2473 @config_variable_registry.register
2474 class ConfigVariableUseDNSCache(ConfigVariable):
2475 def group(self):
2476 return ConfigVariableGroupCheckExecution
2478 def domain(self):
2479 return ConfigDomainCore
2481 def ident(self):
2482 return "use_dns_cache"
2484 def valuespec(self):
2485 return Checkbox(
2486 title=_("Use DNS lookup cache"),
2487 label=_("Prevent DNS lookups by use of a cache file"),
2488 help=_(
2489 "When this option is enabled (which is the default), then Check_MK tries to "
2490 "prevent IP address lookups during the configuration generation. This can speed "
2491 "up this process greatly when you have a larger number of hosts. The cache is stored "
2492 "in a simple file. Note: when the cache is enabled then changes of the IP address "
2493 "of a host in your name server will not be detected immediately. If you need an "
2494 "immediate update then simply disable the cache once, activate the changes and "
2495 "enabled it again. OMD based installations automatically update the cache once "
2496 "a day."),
2500 @config_variable_registry.register
2501 class ConfigVariableUseInlineSNMP(ConfigVariable):
2502 def group(self):
2503 return ConfigVariableGroupCheckExecution
2505 def domain(self):
2506 return ConfigDomainCore
2508 def ident(self):
2509 return "use_inline_snmp"
2511 def valuespec(self):
2512 return Checkbox(
2513 title=_("Use Inline SNMP"),
2514 label=_("Enable inline SNMP (directly use net-snmp libraries)"),
2515 help=_(
2516 "By default Check_MK uses command line calls of Net-SNMP tools like snmpget or "
2517 "snmpwalk to gather SNMP information. For each request a new command line "
2518 "program is being executed. It is now possible to use the inline SNMP implementation "
2519 "which calls the net-snmp libraries directly via its python bindings. This "
2520 "should increase the performance of SNMP checks in a significant way. The inline "
2521 "SNMP mode is a feature which improves the performance for large installations and "
2522 "only available via our subscription."),
2526 @config_variable_registry.register
2527 class ConfigVariableRecordInlineSNMPStats(ConfigVariable):
2528 def group(self):
2529 return ConfigVariableGroupCheckExecution
2531 def domain(self):
2532 return ConfigDomainCore
2534 def ident(self):
2535 return "record_inline_snmp_stats"
2537 def valuespec(self):
2538 return Checkbox(
2539 title=_("Record statistics of Inline SNMP"),
2540 label=_("Enable recording of Inline SNMP statistics"),
2541 help=_(
2542 "When you have enabled Inline SNMP, you can use this flag to enable recording of "
2543 "some performance related values. The recorded values are stored in a single file "
2544 "at <tt>var/check_mk/snmp.stats</tt>.<br><br>"
2545 "<i>Please note:</i> Only enable this for a short period, because it will "
2546 "decrease the performance of your monitoring."),
2550 @config_variable_registry.register
2551 class ConfigVariableHTTPProxies(ConfigVariable):
2552 def group(self):
2553 return ConfigVariableGroupCheckExecution
2555 def domain(self):
2556 return ConfigDomainCore
2558 def ident(self):
2559 return "http_proxies"
2561 def valuespec(self):
2562 return Transform(
2563 ListOf(
2564 Dictionary(
2565 title=_("HTTP proxy"),
2566 elements=[
2567 ("ident",
2569 title=_("Unique ID"),
2570 help=_(
2571 "The ID must be a unique text. It will be used as an internal key "
2572 "when objects refer to this object."),
2573 allow_empty=False,
2575 ("title",
2576 TextUnicode(
2577 title=_("Title"),
2578 help=_("The title of the %s. It will be used as display name.") %
2579 _("HTTP proxy"),
2580 allow_empty=False,
2581 size=80,
2583 ("proxy_url", HTTPProxyInput()),
2585 optional_keys=None,
2587 title=_("HTTP proxies"),
2588 movable=False,
2589 totext=_("%d HTTP proxy servers configured"),
2590 help=_("Use this option to configure one or several proxy servers that can then be "
2591 "used in different places to establish connections to services using these "
2592 "HTTP proxies."),
2593 validate=self._validate_proxies,
2595 forth=lambda v: v.values(),
2596 back=lambda v: {p["ident"]: p for p in v},
2599 def _validate_proxies(self, value, varprefix):
2600 seen_idents, seen_titles = [], []
2601 for http_proxy in value:
2602 if http_proxy["ident"] in seen_idents:
2603 raise MKUserError(
2604 varprefix,
2605 _("Found multiple proxies using the ID '%s'") % http_proxy["ident"])
2606 seen_idents.append(http_proxy["ident"])
2608 if http_proxy["title"] in seen_titles:
2609 raise MKUserError(
2610 varprefix,
2611 _("Found multiple proxies using the title '%s'") % http_proxy["title"])
2612 seen_titles.append(http_proxy["title"])
2615 @config_variable_group_registry.register
2616 class ConfigVariableGroupServiceDiscovery(ConfigVariableGroup):
2617 def title(self):
2618 return _("Service discovery")
2620 def sort_index(self):
2621 return 4
2624 @config_variable_registry.register
2625 class ConfigVariableInventoryCheckInterval(ConfigVariable):
2626 def group(self):
2627 return ConfigVariableGroupServiceDiscovery
2629 def domain(self):
2630 return ConfigDomainCore
2632 def ident(self):
2633 return "inventory_check_interval"
2635 def valuespec(self):
2636 return Optional(
2637 Integer(
2638 title=_("Perform service discovery check every"),
2639 unit=_("minutes"),
2640 min_value=1,
2641 default_value=720),
2642 title=_("Enable regular service discovery checks (deprecated)"),
2643 help=_("If enabled, Check_MK will create one additional service per host "
2644 "that does a regular check, if the service discovery would find new services "
2645 "currently un-monitored. <b>Note:</b> This option is deprecated and has been "
2646 "replaced by the rule set <a href='%s'>Periodic Service Discovery</a>, "
2647 "which allows a per-host configuration and additional features such as "
2648 "automatic rediscovery. Rules in that rule set will override the global "
2649 "settings done here.") % "wato.py?mode=edit_ruleset&varname=periodic_discovery",
2653 @config_variable_registry.register
2654 class ConfigVariableInventoryCheckSeverity(ConfigVariable):
2655 def group(self):
2656 return ConfigVariableGroupServiceDiscovery
2658 def domain(self):
2659 return ConfigDomainCore
2661 def ident(self):
2662 return "inventory_check_severity"
2664 def valuespec(self):
2665 return DropdownChoice(
2666 title=_("Severity of failed service discovery check"),
2667 help=_("Please select which alarm state the service discovery check services "
2668 "shall assume in case that un-monitored services are found."),
2669 choices=[
2670 (0, _("OK - do not alert, just display")),
2671 (1, _("Warning")),
2672 (2, _("Critical")),
2673 (3, _("Unknown")),
2678 @config_variable_registry.register
2679 class ConfigVariableInventoryCheckDoScan(ConfigVariable):
2680 def group(self):
2681 return ConfigVariableGroupServiceDiscovery
2683 def domain(self):
2684 return ConfigDomainCore
2686 def ident(self):
2687 return "inventory_check_do_scan"
2689 def valuespec(self):
2690 return DropdownChoice(
2691 title=_("Service discovery check for SNMP devices"),
2692 choices=[
2693 (True, _("Perform full SNMP scan always, detect new check types")),
2694 (False, _("Just rely on existing check files, detect new items only")),
2699 @config_variable_registry.register
2700 class ConfigVariableInventoryCheckAutotrigger(ConfigVariable):
2701 def group(self):
2702 return ConfigVariableGroupServiceDiscovery
2704 def domain(self):
2705 return ConfigDomainCore
2707 def ident(self):
2708 return "inventory_check_autotrigger"
2710 def valuespec(self):
2711 return Checkbox(
2712 title=_("Service discovery triggers service discovery check"),
2713 label=_(
2714 "Automatically schedule service discovery check after service configuration changes"
2716 help=_("When this option is enabled then after each change of the service "
2717 "configuration of a host via WATO - may it be via manual changes or a bulk "
2718 "discovery - the service discovery check is automatically rescheduled in order "
2719 "to reflect the new service state correctly immediately."),
2724 # .--Rulesets------------------------------------------------------------.
2725 # | ____ _ _ |
2726 # | | _ \ _ _| | ___ ___ ___| |_ ___ |
2727 # | | |_) | | | | |/ _ \/ __|/ _ \ __/ __| |
2728 # | | _ <| |_| | | __/\__ \ __/ |_\__ \ |
2729 # | |_| \_\\__,_|_|\___||___/\___|\__|___/ |
2730 # | |
2731 # +----------------------------------------------------------------------+
2732 # | Rulesets for hosts and services except check parameter rules. |
2733 # '----------------------------------------------------------------------'
2736 @rulespec_group_registry.register
2737 class RulespecGroupGrouping(RulespecGroup):
2738 @property
2739 def name(self):
2740 return "grouping"
2742 @property
2743 def title(self):
2744 return _("Grouping")
2746 @property
2747 def help(self):
2748 return _("Assignment of host & services to host, service and contacts groups.")
2751 @rulespec_registry.register
2752 class RulespecHostGroups(HostRulespec):
2753 @property
2754 def group(self):
2755 return RulespecGroupGrouping
2757 @property
2758 def name(self):
2759 return "host_groups"
2761 @property
2762 def match_type(self):
2763 return "all"
2765 @property
2766 def valuespec(self):
2767 return HostGroupSelection(
2768 title=_("Assignment of hosts to host groups"),
2769 help=_("Hosts can be grouped together into host groups. The most common use case "
2770 "is to put hosts which belong together in a host group to make it possible "
2771 "to get them listed together in the status GUI."),
2775 @rulespec_registry.register
2776 class RulespecServiceGroups(ServiceRulespec):
2777 @property
2778 def group(self):
2779 return RulespecGroupGrouping
2781 @property
2782 def name(self):
2783 return "service_groups"
2785 @property
2786 def match_type(self):
2787 return "all"
2789 @property
2790 def item_type(self):
2791 return "service"
2793 @property
2794 def valuespec(self):
2795 return ServiceGroupSelection(title=_("Assignment of services to service groups"),)
2798 @rulespec_registry.register
2799 class RulespecHostContactgroups(HostRulespec):
2800 @property
2801 def group(self):
2802 return RulespecGroupGrouping
2804 @property
2805 def name(self):
2806 return "host_contactgroups"
2808 @property
2809 def match_type(self):
2810 return "all"
2812 @property
2813 def valuespec(self):
2814 return ContactGroupSelection(title=_("Assignment of hosts to contact groups"),)
2817 @rulespec_registry.register
2818 class RulespecServiceContactgroups(ServiceRulespec):
2819 @property
2820 def group(self):
2821 return RulespecGroupGrouping
2823 @property
2824 def name(self):
2825 return "service_contactgroups"
2827 @property
2828 def match_type(self):
2829 return "all"
2831 @property
2832 def item_type(self):
2833 return "service"
2835 @property
2836 def valuespec(self):
2837 return ContactGroupSelection(title=_("Assignment of services to contact groups"),)
2840 @rulespec_group_registry.register
2841 class RulespecGroupMonitoringConfiguration(RulespecGroup):
2842 @property
2843 def name(self):
2844 return "monconf"
2846 @property
2847 def title(self):
2848 return _("Monitoring Configuration")
2850 @property
2851 def help(self):
2852 return _(
2853 "Intervals for checking, retries, clustering, configuration for inventory and similar")
2856 @rulespec_group_registry.register
2857 class RulespecGroupMonitoringConfigurationServiceChecks(RulespecSubGroup):
2858 @property
2859 def main_group(self):
2860 return RulespecGroupMonitoringConfiguration
2862 @property
2863 def sub_group_name(self):
2864 return "service_checks"
2866 @property
2867 def title(self):
2868 return _("Service Checks")
2871 @rulespec_registry.register
2872 class RulespecExtraServiceConfMaxCheckAttempts(ServiceRulespec):
2873 @property
2874 def group(self):
2875 return RulespecGroupMonitoringConfigurationServiceChecks
2877 @property
2878 def name(self):
2879 return "extra_service_conf:max_check_attempts"
2881 @property
2882 def item_type(self):
2883 return "service"
2885 @property
2886 def valuespec(self):
2887 return Integer(
2888 title=_("Maximum number of check attempts for service"),
2889 help=_("The maximum number of failed checks until a service problem state will "
2890 "be considered as <u>hard</u>. Only hard state trigger notifications. "),
2891 minvalue=1,
2895 @rulespec_registry.register
2896 class RulespecExtraServiceConfCheckInterval(ServiceRulespec):
2897 @property
2898 def group(self):
2899 return RulespecGroupMonitoringConfigurationServiceChecks
2901 @property
2902 def name(self):
2903 return "extra_service_conf:check_interval"
2905 @property
2906 def item_type(self):
2907 return "service"
2909 @property
2910 def valuespec(self):
2911 return Transform(
2912 Age(minvalue=1, default_value=60),
2913 forth=lambda v: int(v * 60),
2914 back=lambda v: float(v) / 60.0,
2915 title=_("Normal check interval for service checks"),
2916 help=_("Check_MK usually uses an interval of one minute for the active Check_MK "
2917 "check and for legacy checks. Here you can specify a larger interval. Please "
2918 "note, that this setting only applies to active checks (those with the "
2919 "reschedule button). If you want to change the check interval of "
2920 "the Check_MK service only, specify <tt><b>Check_MK$</b></tt> in the list "
2921 "of services."),
2925 @rulespec_registry.register
2926 class RulespecExtraServiceConfRetryInterval(ServiceRulespec):
2927 @property
2928 def group(self):
2929 return RulespecGroupMonitoringConfigurationServiceChecks
2931 @property
2932 def name(self):
2933 return "extra_service_conf:retry_interval"
2935 @property
2936 def item_type(self):
2937 return "service"
2939 @property
2940 def valuespec(self):
2941 return Transform(
2942 Age(minvalue=1, default_value=60),
2943 forth=lambda v: int(v * 60),
2944 back=lambda v: float(v) / 60.0,
2945 title=_("Retry check interval for service checks"),
2946 help=_("This setting is relevant if you have set the maximum number of check "
2947 "attempts to a number greater than one. In case a service check is not OK "
2948 "and the maximum number of check attempts is not yet reached, it will be "
2949 "rescheduled with this interval. The retry interval is usually set to a smaller "
2950 "value than the normal interval.<br><br>This setting only applies to "
2951 "active checks."),
2955 @rulespec_registry.register
2956 class RulespecExtraServiceConfCheckPeriod(ServiceRulespec):
2957 @property
2958 def group(self):
2959 return RulespecGroupMonitoringConfigurationServiceChecks
2961 @property
2962 def name(self):
2963 return "extra_service_conf:check_period"
2965 @property
2966 def item_type(self):
2967 return "service"
2969 @property
2970 def valuespec(self):
2971 return TimeperiodSelection(
2972 title=_("Check period for active services"),
2973 help=_("If you specify a notification period for a service then active checks "
2974 "of that service will only be done in that period. Please note, that the "
2975 "checks driven by Check_MK are passive checks and are not affected by this "
2976 "rule. You can use the rule for the active Check_MK check, however."),
2980 @rulespec_registry.register
2981 class RulespecCheckPeriods(ServiceRulespec):
2982 @property
2983 def group(self):
2984 return RulespecGroupMonitoringConfigurationServiceChecks
2986 @property
2987 def name(self):
2988 return "check_periods"
2990 @property
2991 def item_type(self):
2992 return "service"
2994 @property
2995 def valuespec(self):
2996 return TimeperiodSelection(
2997 title=_("Check period for passive Check_MK services"),
2998 help=_("If you specify a notification period for a Check_MK service then "
2999 "results will be processed only within this period."),
3003 @rulespec_registry.register
3004 class RulespecExtraServiceConfProcessPerfData(ServiceRulespec):
3005 @property
3006 def group(self):
3007 return RulespecGroupMonitoringConfigurationServiceChecks
3009 @property
3010 def name(self):
3011 return "extra_service_conf:process_perf_data"
3013 @property
3014 def item_type(self):
3015 return "service"
3017 @property
3018 def valuespec(self):
3019 return DropdownChoice(
3020 title=_("Enable/disable processing of perfdata for services"),
3021 help=_("This setting allows you to disable the processing of perfdata for a "
3022 "service completely."),
3023 choices=[("1", _("Enable processing of perfdata")),
3024 ("0", _("Disable processing of perfdata"))],
3028 @rulespec_registry.register
3029 class RulespecExtraServiceConfPassiveChecksEnabled(ServiceRulespec):
3030 @property
3031 def group(self):
3032 return RulespecGroupMonitoringConfigurationServiceChecks
3034 @property
3035 def name(self):
3036 return "extra_service_conf:passive_checks_enabled"
3038 @property
3039 def item_type(self):
3040 return "service"
3042 @property
3043 def valuespec(self):
3044 return DropdownChoice(
3045 title=_("Enable/disable passive checks for services"),
3046 help=_(
3047 "This setting allows you to disable the processing of passiv check results for a "
3048 "service."),
3049 choices=[("1", _("Enable processing of passive check results")),
3050 ("0", _("Disable processing of passive check results"))],
3054 @rulespec_registry.register
3055 class RulespecExtraServiceConfActiveChecksEnabled(ServiceRulespec):
3056 @property
3057 def group(self):
3058 return RulespecGroupMonitoringConfigurationServiceChecks
3060 @property
3061 def name(self):
3062 return "extra_service_conf:active_checks_enabled"
3064 @property
3065 def item_type(self):
3066 return "service"
3068 @property
3069 def valuespec(self):
3070 return DropdownChoice(
3071 title=_("Enable/disable active checks for services"),
3072 help=_("This setting allows you to disable or enable "
3073 "active checks for a service."),
3074 choices=[("1", _("Enable active checks")), ("0", _("Disable active checks"))],
3078 @rulespec_group_registry.register
3079 class RulespecGroupMonitoringConfigurationHostChecks(RulespecSubGroup):
3080 @property
3081 def main_group(self):
3082 return RulespecGroupMonitoringConfiguration
3084 @property
3085 def sub_group_name(self):
3086 return "host_checks"
3088 @property
3089 def title(self):
3090 return _("Host Checks")
3093 @rulespec_registry.register
3094 class RulespecExtraHostConfMaxCheckAttempts(HostRulespec):
3095 @property
3096 def group(self):
3097 return RulespecGroupMonitoringConfigurationHostChecks
3099 @property
3100 def name(self):
3101 return "extra_host_conf:max_check_attempts"
3103 @property
3104 def valuespec(self):
3105 return Integer(
3106 title=_("Maximum number of check attempts for host"),
3107 help=_("The maximum number of failed host checks until the host will be considered "
3108 "in a hard down state"),
3109 minvalue=1,
3113 @rulespec_registry.register
3114 class RulespecExtraHostConfCheckInterval(HostRulespec):
3115 @property
3116 def group(self):
3117 return RulespecGroupMonitoringConfigurationHostChecks
3119 @property
3120 def name(self):
3121 return "extra_host_conf:check_interval"
3123 @property
3124 def valuespec(self):
3125 return Transform(
3126 Age(minvalue=1, default_value=60),
3127 forth=lambda v: int(v * 60),
3128 back=lambda v: float(v) / 60.0,
3129 title=_("Normal check interval for host checks"),
3130 help=
3131 _("The default interval is set to 6 seconds for smart ping and one minute for all other. Here you can specify a larger "
3132 "interval. The host is contacted in this interval on a regular base. The host "
3133 "check is also being executed when a problematic service state is detected to check "
3134 "wether or not the service problem is resulting from a host problem."),
3138 @rulespec_registry.register
3139 class RulespecExtraHostConfRetryInterval(HostRulespec):
3140 @property
3141 def group(self):
3142 return RulespecGroupMonitoringConfigurationHostChecks
3144 @property
3145 def name(self):
3146 return "extra_host_conf:retry_interval"
3148 @property
3149 def valuespec(self):
3150 return Transform(
3151 Age(minvalue=1, default_value=60),
3152 forth=lambda v: int(v * 60),
3153 back=lambda v: float(v) / 60.0,
3154 title=_("Retry check interval for host checks"),
3155 help=_(
3156 "This setting is relevant if you have set the maximum number of check "
3157 "attempts to a number greater than one. In case a host check is not UP "
3158 "and the maximum number of check attempts is not yet reached, it will be "
3159 "rescheduled with this interval. The retry interval is usually set to a smaller "
3160 "value than the normal interval. The default is 6 seconds for smart ping and 60 seconds for all other."
3165 @rulespec_registry.register
3166 class RulespecExtraHostConfCheckPeriod(HostRulespec):
3167 @property
3168 def group(self):
3169 return RulespecGroupMonitoringConfigurationHostChecks
3171 @property
3172 def name(self):
3173 return "extra_host_conf:check_period"
3175 @property
3176 def valuespec(self):
3177 return TimeperiodSelection(
3178 title=_("Check period for hosts"),
3179 help=_("If you specify a check period for a host then active checks of that "
3180 "host will only take place within that period. In the rest of the time "
3181 "the state of the host will stay at its last status."),
3185 @rulespec_registry.register
3186 class RulespecHostCheckCommands(HostRulespec):
3187 @property
3188 def group(self):
3189 return RulespecGroupMonitoringConfigurationHostChecks
3191 @property
3192 def name(self):
3193 return "host_check_commands"
3195 @property
3196 def valuespec(self):
3197 return CascadingDropdown(
3198 title=_("Host Check Command"),
3199 help=_(
3200 "Usually Check_MK uses a series of PING (ICMP echo request) in order to determine "
3201 "whether a host is up. In some cases this is not possible, however. With this rule "
3202 "you can specify an alternative way of determining the host's state.") + _(
3203 "The option to use a custom command can only be configured with the permission "
3204 "\"Can add or modify executables\"."),
3205 choices=self._host_check_command_choices,
3206 default_value="ping",
3207 orientation="horizontal",
3210 def _host_check_command_choices(self):
3211 if config.user.may('wato.add_or_modify_executables'):
3212 custom_choice = [
3213 ("custom", _("Use a custom check plugin..."), PluginCommandLine()),
3215 else:
3216 custom_choice = []
3218 return [
3219 ("ping", _("PING (active check with ICMP echo request)")),
3220 ("smart", _("Smart PING (only with Check_MK Micro Core)")),
3221 ("tcp", _("TCP Connect"),
3222 Integer(label=_("to port:"), minvalue=1, maxvalue=65535, default_value=80)),
3223 ("ok", _("Always assume host to be up")),
3224 ("agent", _("Use the status of the Check_MK Agent")),
3225 ("service", _("Use the status of the service..."),
3226 TextUnicode(
3227 size=45,
3228 allow_empty=False,
3229 attrencode=True,
3230 help=_("You can use the macro <tt>$HOSTNAME$</tt> here. It will be replaced "
3231 "with the name of the current host."),
3233 ] + custom_choice
3236 @rulespec_group_registry.register
3237 class RulespecGroupMonitoringConfigurationNotifications(RulespecSubGroup):
3238 @property
3239 def main_group(self):
3240 return RulespecGroupMonitoringConfiguration
3242 @property
3243 def sub_group_name(self):
3244 return "notifications"
3246 @property
3247 def title(self):
3248 return _("Notifications")
3251 @rulespec_registry.register
3252 class RulespecExtraHostConfNotificationsEnabled(HostRulespec):
3253 @property
3254 def group(self):
3255 return RulespecGroupMonitoringConfigurationNotifications
3257 @property
3258 def name(self):
3259 return "extra_host_conf:notifications_enabled"
3261 @property
3262 def valuespec(self):
3263 return DropdownChoice(
3264 title=_("Enable/disable notifications for hosts"),
3265 help=_("This setting allows you to disable notifications about problems of a "
3266 "host completely. Per default all notifications are enabled. Sometimes "
3267 "it is more convenient to just disable notifications then to remove a "
3268 "host completely from the monitoring. Note: this setting has no effect "
3269 "on the notifications of service problems of a host."),
3270 choices=[
3271 ("1", _("Enable host notifications")),
3272 ("0", _("Disable host notifications")),
3277 @rulespec_registry.register
3278 class RulespecExtraServiceConfNotificationsEnabled(ServiceRulespec):
3279 @property
3280 def group(self):
3281 return RulespecGroupMonitoringConfigurationNotifications
3283 @property
3284 def name(self):
3285 return "extra_service_conf:notifications_enabled"
3287 @property
3288 def item_type(self):
3289 return "service"
3291 @property
3292 def valuespec(self):
3293 return DropdownChoice(
3294 title=_("Enable/disable notifications for services"),
3295 help=_("This setting allows you to disable notifications about problems of a "
3296 "service completely. Per default all notifications are enabled."),
3297 choices=[
3298 ("1", _("Enable service notifications")),
3299 ("0", _("Disable service notifications")),
3304 @rulespec_registry.register
3305 class RulespecExtraHostConfNotificationOptions(HostRulespec):
3306 @property
3307 def group(self):
3308 return RulespecGroupMonitoringConfigurationNotifications
3310 @property
3311 def name(self):
3312 return "extra_host_conf:notification_options"
3314 @property
3315 def valuespec(self):
3316 return Transform(
3317 ListChoice(
3318 choices=[
3319 ("d", _("Host goes down")),
3320 ("u", _("Host gets unreachble")),
3321 ("r", _("Host goes up again")),
3322 ("f", _("Start or end of flapping state")),
3323 ("s", _("Start or end of a scheduled downtime")),
3325 default_value=["d", "r", "f", "s"],
3327 title=_("Notified events for hosts"),
3328 help=_(
3329 "This ruleset allows you to restrict notifications of host problems to certain "
3330 "states, e.g. only notify on DOWN, but not on UNREACHABLE. Please select the types "
3331 "of events that should initiate notifications. Please note that several other "
3332 "filters must also be passed in order for notifications to finally being sent out."
3333 "<br><br>"
3334 "Please note: There is a difference between the Microcore and Nagios when you have "
3335 "a host that has no matching rule in this ruleset. In this case the Microcore will "
3336 "not send out UNREACHABLE notifications while the Nagios core would send out "
3337 "UNREACHABLE notifications. To align this behaviour, create a rule matching "
3338 "all your hosts and configure it to either send UNREACHABLE notifications or not."),
3339 forth=lambda x: x != 'n' and x.split(",") or [],
3340 back=lambda x: ",".join(x) or "n",
3344 @rulespec_registry.register
3345 class RulespecExtraServiceConfNotificationOptions(ServiceRulespec):
3346 @property
3347 def group(self):
3348 return RulespecGroupMonitoringConfigurationNotifications
3350 @property
3351 def name(self):
3352 return "extra_service_conf:notification_options"
3354 @property
3355 def item_type(self):
3356 return "service"
3358 @property
3359 def valuespec(self):
3360 return Transform(
3361 ListChoice(
3362 choices=[
3363 ("w", _("Service goes into warning state")),
3364 ("u", _("Service goes into unknown state")),
3365 ("c", _("Service goes into critical state")),
3366 ("r", _("Service recovers to OK")),
3367 ("f", _("Start or end of flapping state")),
3368 ("s", _("Start or end of a scheduled downtime")),
3370 default_value=["w", "u", "c", "r", "f", "s"],
3372 title=_("Notified events for services"),
3373 help=_(
3374 "This ruleset allows you to restrict notifications of service problems to certain "
3375 "states, e.g. only notify on CRIT, but not on WARN. Please select the types "
3376 "of events that should initiate notifications. Please note that several other "
3377 "filters must also be passed in order for notifications to finally being sent out."
3379 forth=lambda x: x != 'n' and x.split(",") or [],
3380 back=lambda x: ",".join(x) or "n",
3384 @rulespec_registry.register
3385 class RulespecExtraHostConfNotificationPeriod(HostRulespec):
3386 @property
3387 def group(self):
3388 return RulespecGroupMonitoringConfigurationNotifications
3390 @property
3391 def name(self):
3392 return "extra_host_conf:notification_period"
3394 @property
3395 def valuespec(self):
3396 return TimeperiodSelection(
3397 title=_("Notification period for hosts"),
3398 help=_("If you specify a notification period for a host then notifications "
3399 "about problems of that host (not of its services!) will only be sent "
3400 "if those problems occur within the notification period. Also you can "
3401 "filter out problems in the problems views for objects not being in "
3402 "their notification period (you can think of the notification period "
3403 "as the 'service time')."),
3407 @rulespec_registry.register
3408 class RulespecExtraServiceConfNotificationPeriod(ServiceRulespec):
3409 @property
3410 def group(self):
3411 return RulespecGroupMonitoringConfigurationNotifications
3413 @property
3414 def name(self):
3415 return "extra_service_conf:notification_period"
3417 @property
3418 def item_type(self):
3419 return "service"
3421 @property
3422 def valuespec(self):
3423 return TimeperiodSelection(
3424 title=_("Notification period for services"),
3425 help=_("If you specify a notification period for a service then notifications "
3426 "about that service will only be sent "
3427 "if those problems occur within the notification period. Also you can "
3428 "filter out problems in the problems views for objects not being in "
3429 "their notification period (you can think of the notification period "
3430 "as the 'service time')."),
3434 def transform_float_minutes_to_age(float_minutes):
3435 return int(float_minutes * 60)
3438 def transform_age_to_float_minutes(age):
3439 return float(age) / 60.0
3442 @rulespec_registry.register
3443 class RulespecExtraHostConfFirstNotificationDelay(HostRulespec):
3444 @property
3445 def group(self):
3446 return RulespecGroupMonitoringConfigurationNotifications
3448 @property
3449 def name(self):
3450 return "extra_host_conf:first_notification_delay"
3452 @property
3453 def factory_default(self):
3454 return 0.0
3456 @property
3457 def valuespec(self):
3458 return Transform(
3459 Age(
3460 minvalue=0,
3461 default_value=300,
3462 label=_("Delay:"),
3463 title=_("Delay host notifications"),
3464 help=_("This setting delays notifications about host problems by the "
3465 "specified amount of time. If the host is up again within that "
3466 "time, no notification will be sent out."),
3468 forth=transform_float_minutes_to_age,
3469 back=transform_age_to_float_minutes,
3473 @rulespec_registry.register
3474 class RulespecExtraServiceConfFirstNotificationDelay(ServiceRulespec):
3475 @property
3476 def group(self):
3477 return RulespecGroupMonitoringConfigurationNotifications
3479 @property
3480 def name(self):
3481 return "extra_service_conf:first_notification_delay"
3483 @property
3484 def item_type(self):
3485 return "service"
3487 @property
3488 def factory_default(self):
3489 return 0.0
3491 @property
3492 def valuespec(self):
3493 return Transform(
3494 Age(
3495 minvalue=0,
3496 default_value=300,
3497 label=_("Delay:"),
3498 unit=_("minutes"),
3499 title=_("Delay service notifications"),
3500 help=_("This setting delays notifications about service problems by the "
3501 "specified amount of time. If the service is OK again within that "
3502 "time, no notification will be sent out."),
3504 forth=transform_float_minutes_to_age,
3505 back=transform_age_to_float_minutes,
3509 @rulespec_registry.register
3510 class RulespecExtraHostConfNotificationInterval(HostRulespec):
3511 @property
3512 def group(self):
3513 return RulespecGroupMonitoringConfigurationNotifications
3515 @property
3516 def name(self):
3517 return "extra_host_conf:notification_interval"
3519 @property
3520 def valuespec(self):
3521 return Optional(
3522 Transform(
3523 Float(
3524 minvalue=0.05,
3525 default_value=120.0,
3526 label=_("Interval:"),
3527 unit=_("minutes"),
3529 forth=float,
3531 title=_("Periodic notifications during host problems"),
3532 help=_("If you enable periodic notifications, then during a problem state "
3533 "of the host notifications will be sent out in regular intervals "
3534 "until the problem is acknowledged."),
3535 label=_("Enable periodic notifications"),
3536 none_label=_("disabled"),
3537 none_value=0.0,
3541 @rulespec_registry.register
3542 class RulespecExtraServiceConfNotificationInterval(ServiceRulespec):
3543 @property
3544 def group(self):
3545 return RulespecGroupMonitoringConfigurationNotifications
3547 @property
3548 def name(self):
3549 return "extra_service_conf:notification_interval"
3551 @property
3552 def item_type(self):
3553 return "service"
3555 @property
3556 def valuespec(self):
3557 return Optional(
3558 Transform(
3559 Float(minvalue=0.05, default_value=120.0, label=_("Interval:"), unit=_("minutes")),
3560 forth=float,
3562 title=_("Periodic notifications during service problems"),
3563 help=_("If you enable periodic notifications, then during a problem state "
3564 "of the service notifications will be sent out in regular intervals "
3565 "until the problem is acknowledged."),
3566 label=_("Enable periodic notifications"),
3567 none_label=_("disabled"),
3568 none_value=0.0,
3572 @rulespec_registry.register
3573 class RulespecExtraHostConfFlapDetectionEnabled(HostRulespec):
3574 @property
3575 def group(self):
3576 return RulespecGroupMonitoringConfigurationNotifications
3578 @property
3579 def name(self):
3580 return "extra_host_conf:flap_detection_enabled"
3582 @property
3583 def valuespec(self):
3584 return DropdownChoice(
3585 title=_("Enable/disable flapping detection for hosts"),
3586 help=_("This setting allows you to disable the flapping detection for a "
3587 "host completely."),
3588 choices=[
3589 ("1", _("Enable flap detection")),
3590 ("0", _("Disable flap detection")),
3595 @rulespec_registry.register
3596 class RulespecExtraServiceConfFlapDetectionEnabled(ServiceRulespec):
3597 @property
3598 def group(self):
3599 return RulespecGroupMonitoringConfigurationNotifications
3601 @property
3602 def name(self):
3603 return "extra_service_conf:flap_detection_enabled"
3605 @property
3606 def item_type(self):
3607 return "service"
3609 @property
3610 def valuespec(self):
3611 return DropdownChoice(
3612 title=_("Enable/disable flapping detection for services"),
3613 help=_("This setting allows you to disable the flapping detection for a "
3614 "service completely."),
3615 choices=[
3616 ("1", _("Enable flap detection")),
3617 ("0", _("Disable flap detection")),
3622 @rulespec_registry.register
3623 class RulespecExtraServiceConfNotesUrl(ServiceRulespec):
3624 @property
3625 def group(self):
3626 return RulespecGroupMonitoringConfigurationNotifications
3628 @property
3629 def name(self):
3630 return "extra_service_conf:notes_url"
3632 @property
3633 def item_type(self):
3634 return "service"
3636 @property
3637 def valuespec(self):
3638 return TextAscii(
3639 label=_("URL:"),
3640 title=_("Notes URL for Services"),
3641 help=_("With this setting you can set links to documentations "
3642 "for each service"),
3643 attrencode=True,
3644 size=80,
3648 @rulespec_registry.register
3649 class RulespecExtraHostConfNotesUrl(HostRulespec):
3650 @property
3651 def group(self):
3652 return RulespecGroupMonitoringConfigurationNotifications
3654 @property
3655 def name(self):
3656 return "extra_host_conf:notes_url"
3658 @property
3659 def valuespec(self):
3660 return TextAscii(
3661 label=_("URL:"),
3662 title=_("Notes URL for Hosts"),
3663 help=_("With this setting you can set links to documentations "
3664 "for Hosts"),
3665 attrencode=True,
3666 size=80,
3670 @rulespec_registry.register
3671 class RulespecExtraServiceConfDisplayName(ServiceRulespec):
3672 @property
3673 def group(self):
3674 return RulespecGroupMonitoringConfigurationNotifications
3676 @property
3677 def name(self):
3678 return "extra_service_conf:display_name"
3680 @property
3681 def item_type(self):
3682 return "service"
3684 @property
3685 def valuespec(self):
3686 return TextUnicode(
3687 title=_("Alternative display name for Services"),
3688 help=_("This rule set allows you to specify an alternative name "
3689 "to be displayed for certain services. This name is available as "
3690 "a column when creating new views or modifying existing ones. "
3691 "It is always visible in the details view of a service. In the "
3692 "availability reporting there is an option for using that name "
3693 "instead of the normal service description. It does <b>not</b> automatically "
3694 "replace the normal service name in all views.<br><br><b>Note</b>: The "
3695 "purpose of this rule set is to define unique names for several well-known "
3696 "services. It cannot rename services in general."),
3697 size=64,
3698 attrencode=True,
3702 @rulespec_group_registry.register
3703 class RulespecGroupMonitoringConfigurationInventoryAndCMK(RulespecSubGroup):
3704 @property
3705 def main_group(self):
3706 return RulespecGroupMonitoringConfiguration
3708 @property
3709 def sub_group_name(self):
3710 return "inventory_and_check_mk_settings"
3712 @property
3713 def title(self):
3714 return _("Inventory and Check_MK settings")
3717 @rulespec_registry.register
3718 class RulespecOnlyHosts(BinaryHostRulespec):
3719 @property
3720 def group(self):
3721 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3723 @property
3724 def name(self):
3725 return "only_hosts"
3727 @property
3728 def title(self):
3729 return _("Hosts to be monitored")
3731 @property
3732 def help(self):
3733 return _("By adding rules to this ruleset you can define a subset of your hosts "
3734 "to be actually monitored. As long as the rule set is empty "
3735 "all configured hosts will be monitored. As soon as you add at least one "
3736 "rule, only hosts with a matching rule will be monitored.")
3738 @property
3739 def is_optional(self):
3740 return True
3743 @rulespec_registry.register
3744 class RulespecIgnoredServices(BinaryServiceRulespec):
3745 @property
3746 def group(self):
3747 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3749 @property
3750 def name(self):
3751 return "ignored_services"
3753 @property
3754 def title(self):
3755 return _("Disabled services")
3757 @property
3758 def help(self):
3759 return _("Services that are declared as <u>disabled</u> by this rule set will not be added "
3760 "to a host during discovery (automatic service detection). Services that already "
3761 "exist will continued to be monitored but be marked as obsolete in the service "
3762 "list of a host.")
3764 @property
3765 def item_type(self):
3766 return "service"
3769 @rulespec_registry.register
3770 class RulespecIgnoredChecks(HostRulespec):
3771 @property
3772 def group(self):
3773 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3775 @property
3776 def name(self):
3777 return "ignored_checks"
3779 @property
3780 def valuespec(self):
3781 return CheckTypeSelection(
3782 title=_("Disabled checks"),
3783 help=_(
3784 "This ruleset is similar to 'Disabled services', but selects checks to be disabled "
3785 "by their <b>type</b>. This allows you to disable certain technical implementations "
3786 "such as filesystem checks via SNMP on hosts that also have the Check_MK agent "
3787 "installed."),
3791 @rulespec_registry.register
3792 class RulespecClusteredServices(BinaryServiceRulespec):
3793 @property
3794 def group(self):
3795 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3797 @property
3798 def name(self):
3799 return "clustered_services"
3801 @property
3802 def title(self):
3803 return _("Clustered services")
3805 @property
3806 def help(self):
3807 return _("When you define HA clusters in WATO then you also have to specify which services "
3808 "of a node should be assigned to the cluster and which services to the physical "
3809 "node. This is done by this ruleset. Please note that the rule will be applied to "
3810 "the <i>nodes</i>, not to the cluster.<br><br>Please make sure that you re-"
3811 "inventorize the cluster and the physical nodes after changing this ruleset.")
3813 @property
3814 def item_type(self):
3815 return "service"
3818 @rulespec_registry.register
3819 class RulespecPeriodicDiscovery(HostRulespec):
3820 @property
3821 def group(self):
3822 return RulespecGroupMonitoringConfigurationInventoryAndCMK
3824 @property
3825 def name(self):
3826 return "periodic_discovery"
3828 @property
3829 def valuespec(self):
3830 return Alternative(
3831 title=_("Periodic service discovery"),
3832 style="dropdown",
3833 default_value={
3834 "check_interval": 2 * 60,
3835 "severity_unmonitored": 1,
3836 "severity_vanished": 0,
3837 "inventory_check_do_scan": True,
3839 elements=[
3840 FixedValue(
3841 None,
3842 title=_("Do not perform periodic service discovery check"),
3843 totext=_("no discovery check"),
3845 Dictionary(
3846 title=_("Perform periodic service discovery check"),
3847 help=_(
3848 "If enabled, Check_MK will create one additional service per host "
3849 "that does a periodic check, if the service discovery would find new services "
3850 "that are currently not monitored."),
3851 elements=[
3852 ("check_interval",
3853 Transform(
3854 Age(minvalue=1, display=["days", "hours", "minutes"]),
3855 forth=lambda v: int(v * 60),
3856 back=lambda v: float(v) / 60.0,
3857 title=_("Perform service discovery every"),
3859 ("severity_unmonitored",
3860 DropdownChoice(
3861 title=_("Severity of unmonitored services"),
3862 help=_(
3863 "Please select which alarm state the service discovery check services "
3864 "shall assume in case that un-monitored services are found."),
3865 choices=[
3866 (0, _("OK - do not alert, just display")),
3867 (1, _("Warning")),
3868 (2, _("Critical")),
3869 (3, _("Unknown")),
3872 ("severity_vanished",
3873 DropdownChoice(
3874 title=_("Severity of vanished services"),
3875 help=
3876 _("Please select which alarm state the service discovery check services "
3877 "shall assume in case that non-existing services are being monitored."
3879 choices=[
3880 (0, _("OK - do not alert, just display")),
3881 (1, _("Warning")),
3882 (2, _("Critical")),
3883 (3, _("Unknown")),
3886 ("inventory_check_do_scan",
3887 DropdownChoice(
3888 title=_("Service discovery check for SNMP devices"),
3889 choices=[
3890 (True, _("Perform full SNMP scan always, detect new check types")),
3891 (False,
3892 _("Just rely on existing check files, detect new items only"))
3893 ])),
3894 ("inventory_rediscovery",
3895 Dictionary(
3896 title=_("Automatically update service configuration"),
3897 help=_(
3898 "If active the check will not only notify about un-monitored services, "
3899 "it will also automatically add/remove them as neccessary."),
3900 elements=[
3901 ("mode",
3902 DropdownChoice(
3903 title=_("Mode"),
3904 choices=[(0, _("Add unmonitored services")),
3905 (1, _("Remove vanished services")),
3906 (2, _("Add unmonitored & remove vanished services")),
3907 (3, _("Refresh all services (tabula rasa)"))],
3908 orientation="vertical",
3909 default_value=0,
3911 ("group_time",
3912 Age(title=_("Group discovery and activation for up to"),
3913 help=_(
3914 "A delay can be configured here so that multiple "
3915 "discoveries can be activated in one go. This avoids frequent core "
3916 "restarts in situations with frequent services changes."),
3917 default_value=15 * 60,
3918 display=["hours", "minutes"])),
3919 ("excluded_time",
3920 ListOfTimeRanges(
3921 title=
3922 _("Never do discovery or activate changes in the following time ranges"
3924 help=_("This avoids automatic changes during these times so "
3925 "that the automatic system doesn't interfere with "
3926 "user activity."),
3928 ("activation",
3929 DropdownChoice(
3930 title=_("Automatic activation"),
3931 choices=[
3932 (True, _("Automatically activate changes")),
3933 (False, _("Do not activate changes")),
3935 default_value=True,
3936 help=_(
3937 "Here you can have the changes activated whenever services "
3938 "have been added or removed."),
3940 ("service_whitelist",
3941 ListOfStrings(
3942 title=_("Activate only services matching"),
3943 allow_empty=False,
3944 help=
3945 _("Set service names or regular expression patterns here to "
3946 "allow only matching services to be activated automatically. "
3947 "If you set both this and \'Don't activate services matching\', "
3948 "both rules have to apply for a service to be activated."),
3950 ("service_blacklist",
3951 ListOfStrings(
3952 title=_("Don't activate services matching"),
3953 allow_empty=False,
3954 help=
3955 _("Set service names or regular expression patterns here to "
3956 "prevent matching services from being activated automatically. "
3957 "If you set both this and \'Activate only services matching\', "
3958 "both rules have to apply for a service to be activated."),
3961 optional_keys=["service_whitelist", "service_blacklist"],
3964 optional_keys=["inventory_rediscovery"],
3969 @rulespec_group_registry.register
3970 class RulespecGroupMonitoringConfigurationVarious(RulespecSubGroup):
3971 @property
3972 def main_group(self):
3973 return RulespecGroupMonitoringConfiguration
3975 @property
3976 def sub_group_name(self):
3977 return "various"
3979 @property
3980 def title(self):
3981 return _("Various")
3984 @rulespec_registry.register
3985 class RulespecClusteredServicesMapping(ServiceRulespec):
3986 @property
3987 def group(self):
3988 return RulespecGroupMonitoringConfigurationVarious
3990 @property
3991 def name(self):
3992 return "clustered_services_mapping"
3994 @property
3995 def item_type(self):
3996 return "service"
3998 @property
3999 def valuespec(self):
4000 return TextAscii(
4001 title=_("Clustered services for overlapping clusters"),
4002 label=_("Assign services to the following cluster:"),
4003 help=_("It's possible to have clusters that share nodes. You could say that "
4004 "such clusters &quot;overlap&quot;. In such a case using the ruleset "
4005 "<i>Clustered services</i> is not sufficient since it would not be clear "
4006 "to which of the several possible clusters a service found on such a shared "
4007 "node should be assigned to. With this ruleset you can assign services and "
4008 "explicitely specify which cluster assign them to."),
4012 @rulespec_registry.register
4013 class RulespecExtraHostConfServicePeriod(HostRulespec):
4014 @property
4015 def group(self):
4016 return RulespecGroupMonitoringConfigurationVarious
4018 @property
4019 def name(self):
4020 return "extra_host_conf:service_period"
4022 @property
4023 def valuespec(self):
4024 return TimeperiodSelection(
4025 title=_("Service period for hosts"),
4026 help=_(
4027 "When it comes to availability reporting, you might want the report "
4028 "to cover only certain time periods, e.g. only Monday to Friday "
4029 "from 8:00 to 17:00. You can do this by specifying a service period "
4030 "for hosts or services. In the reporting you can then decide to "
4031 "include, exclude or ignore such periods und thus e.g. create a report "
4032 "of the availability just within or without these times. <b>Note</b>: Changes in the "
4033 "actual <i>definition</i> of a time period will only be reflected in "
4034 "times <i>after</i> that change. Selecting a different service period "
4035 "will also be reflected in the past."),
4039 @rulespec_registry.register
4040 class RulespecExtraServiceConfServicePeriod(ServiceRulespec):
4041 @property
4042 def group(self):
4043 return RulespecGroupMonitoringConfigurationVarious
4045 @property
4046 def name(self):
4047 return "extra_service_conf:service_period"
4049 @property
4050 def item_type(self):
4051 return "service"
4053 @property
4054 def valuespec(self):
4055 return TimeperiodSelection(
4056 title=_("Service period for services"),
4057 help=_(
4058 "When it comes to availability reporting, you might want the report "
4059 "to cover only certain time periods, e.g. only Monday to Friday "
4060 "from 8:00 to 17:00. You can do this by specifying a service period "
4061 "for hosts or services. In the reporting you can then decide to "
4062 "include, exclude or ignore such periods und thus e.g. create a report "
4063 "of the availability just within or without these times. <b>Note</b>: Changes in the "
4064 "actual <i>definition</i> of a time period will only be reflected in "
4065 "times <i>after</i> that change. Selecting a different service period "
4066 "will also be reflected in the past."),
4071 # .--User Interface------------------------------------------------------.
4072 # | _ _ ___ _ __ |
4073 # | | | | |___ ___ _ __ |_ _|_ __ | |_ ___ _ __ / _| __ _ ___ ___ |
4074 # | | | | / __|/ _ \ '__| | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \ |
4075 # | | |_| \__ \ __/ | | || | | | || __/ | | _| (_| | (_| __/ |
4076 # | \___/|___/\___|_| |___|_| |_|\__\___|_| |_| \__,_|\___\___| |
4077 # | |
4078 # +----------------------------------------------------------------------+
4079 # | User interface specific rule sets |
4080 # '----------------------------------------------------------------------'
4083 @rulespec_group_registry.register
4084 class RulespecGroupUserInterface(RulespecGroup):
4085 @property
4086 def name(self):
4087 return "user_interface"
4089 @property
4090 def title(self):
4091 return _("User Interface")
4093 @property
4094 def help(self):
4095 return _("Settings concerning the user interface of Check_MK")
4098 @rulespec_registry.register
4099 class RulespecExtraHostConfIconImage(HostRulespec):
4100 @property
4101 def group(self):
4102 return RulespecGroupUserInterface
4104 @property
4105 def name(self):
4106 return "extra_host_conf:icon_image"
4108 @property
4109 def valuespec(self):
4110 return Transform(
4111 IconSelector(
4112 title=_("Icon image for hosts in status GUI"),
4113 help=_("You can assign icons to hosts for the status GUI. "
4114 "Put your images into <tt>%s</tt>. ") %
4115 (cmk.utils.paths.omd_root + "/local/share/check_mk/web/htdocs/images/icons"),
4117 forth=lambda v: v and (v.endswith('.png') and v[:-4]) or v,
4121 @rulespec_registry.register
4122 class RulespecExtraServiceConfIconImage(ServiceRulespec):
4123 @property
4124 def group(self):
4125 return RulespecGroupUserInterface
4127 @property
4128 def name(self):
4129 return "extra_service_conf:icon_image"
4131 @property
4132 def item_type(self):
4133 return "service"
4135 @property
4136 def valuespec(self):
4137 return Transform(
4138 IconSelector(
4139 title=_("Icon image for services in status GUI"),
4140 help=_("You can assign icons to services for the status GUI. "
4141 "Put your images into <tt>%s</tt>. ") %
4142 (cmk.utils.paths.omd_root + "/local/share/check_mk/web/htdocs/images/icons"),
4144 forth=lambda v: v and (v.endswith('.png') and v[:-4]) or v,
4148 @rulespec_registry.register
4149 class RulespecHostIconsAndActions(HostRulespec):
4150 @property
4151 def group(self):
4152 return RulespecGroupUserInterface
4154 @property
4155 def name(self):
4156 return "host_icons_and_actions"
4158 @property
4159 def match_type(self):
4160 return "all"
4162 @property
4163 def valuespec(self):
4164 return UserIconOrAction(
4165 title=_("Custom icons or actions for hosts in status GUI"),
4166 help=_("You can assign icons or actions to hosts for the status GUI."),
4170 @rulespec_registry.register
4171 class RulespecServiceIconsAndActions(ServiceRulespec):
4172 @property
4173 def group(self):
4174 return RulespecGroupUserInterface
4176 @property
4177 def name(self):
4178 return "service_icons_and_actions"
4180 @property
4181 def match_type(self):
4182 return "all"
4184 @property
4185 def item_type(self):
4186 return "service"
4188 @property
4189 def valuespec(self):
4190 return UserIconOrAction(
4191 title=_("Custom icons or actions for services in status GUI"),
4192 help=_("You can assign icons or actions to services for the status GUI."),
4196 @rulespec_registry.register
4197 class RulespecExtraHostConfEscapePluginOutput(HostRulespec):
4198 @property
4199 def group(self):
4200 return RulespecGroupUserInterface
4202 @property
4203 def name(self):
4204 return "extra_host_conf:_ESCAPE_PLUGIN_OUTPUT"
4206 @property
4207 def valuespec(self):
4208 return DropdownChoice(
4209 title=_("Escape HTML codes in host output"),
4210 help=_("By default, for security reasons, the GUI does not interpret any HTML "
4211 "code received from external sources, like plugin output or log messages. "
4212 "If you are really sure what you are doing and need to have HTML codes, like "
4213 "links rendered, disable this option. Be aware, you might open the way "
4214 "for several injection attacks.") + _(
4215 "This setting can either be set globally or individually for selected hosts "
4216 "or services using the host or service rulesets."),
4217 choices=[
4218 ("1", _("Escape HTML codes")),
4219 ("0", _("Don't escape HTML codes (insecure)")),
4221 default_value="1",
4225 @rulespec_registry.register
4226 class RulespecExtraServiceConfEscapePluginOutput(ServiceRulespec):
4227 @property
4228 def group(self):
4229 return RulespecGroupUserInterface
4231 @property
4232 def name(self):
4233 return "extra_service_conf:_ESCAPE_PLUGIN_OUTPUT"
4235 @property
4236 def item_type(self):
4237 return "service"
4239 @property
4240 def valuespec(self):
4241 return DropdownChoice(
4242 title=_("Escape HTML codes in service output"),
4243 help=_("By default, for security reasons, the GUI does not interpret any HTML "
4244 "code received from external sources, like plugin output or log messages. "
4245 "If you are really sure what you are doing and need to have HTML codes, like "
4246 "links rendered, disable this option. Be aware, you might open the way "
4247 "for several injection attacks.") + _(
4248 "This setting can either be set globally or individually for selected hosts "
4249 "or services using the host or service rulesets."),
4250 choices=[
4251 ("1", _("Escape HTML codes")),
4252 ("0", _("Don't escape HTML codes (insecure)")),
4254 default_value="1",
4258 @rulespec_group_registry.register
4259 class RulespecGroupAgent(RulespecGroup):
4260 @property
4261 def name(self):
4262 return "agent"
4264 @property
4265 def title(self):
4266 return _("Access to Agents")
4268 @property
4269 def help(self):
4270 return _("Settings concerning the connection to the Check_MK and SNMP agents")
4273 @rulespec_group_registry.register
4274 class RulespecGroupAgentGeneralSettings(RulespecSubGroup):
4275 @property
4276 def main_group(self):
4277 return RulespecGroupAgent
4279 @property
4280 def sub_group_name(self):
4281 return "general_settings"
4283 @property
4284 def title(self):
4285 return _("General Settings")
4288 @rulespec_registry.register
4289 class RulespecDyndnsHosts(BinaryHostRulespec):
4290 @property
4291 def group(self):
4292 return RulespecGroupAgentGeneralSettings
4294 @property
4295 def name(self):
4296 return "dyndns_hosts"
4298 @property
4299 def title(self):
4300 return _("Hosts with dynamic DNS lookup during monitoring")
4302 @property
4303 def help(self):
4304 return _("This ruleset selects host for dynamic DNS lookup during monitoring. Normally the "
4305 "IP addresses of hosts are statically configured or looked up when you activate "
4306 "the changes. In some rare cases DNS lookups must be done each time a host is "
4307 "connected to, e.g. when the IP address of the host is dynamic and can change.")
4310 @rulespec_registry.register
4311 class RulespecPrimaryAddressFamily(HostRulespec):
4312 @property
4313 def group(self):
4314 return RulespecGroupAgentGeneralSettings
4316 @property
4317 def name(self):
4318 return "primary_address_family"
4320 @property
4321 def valuespec(self):
4322 return DropdownChoice(
4323 choices=[
4324 ("ipv4", _("IPv4")),
4325 ("ipv6", _("IPv6")),
4327 title=_("Primary IP address family of dual-stack hosts"),
4328 help=_("When you configure dual-stack host (IPv4 + IPv6) monitoring in Check_MK, "
4329 "normally IPv4 is used as primary address family to communicate with this "
4330 "host. The other family, IPv6, is just being pinged. You can use this rule "
4331 "to invert this behaviour to use IPv6 as primary address family."),
4335 @rulespec_group_registry.register
4336 class RulespecGroupAgentSNMP(RulespecSubGroup):
4337 @property
4338 def main_group(self):
4339 return RulespecGroupAgent
4341 @property
4342 def sub_group_name(self):
4343 return "snmp"
4345 @property
4346 def title(self):
4347 return _("SNMP")
4350 @rulespec_registry.register
4351 class RulespecSnmpCommunities(HostRulespec):
4352 @property
4353 def group(self):
4354 return RulespecGroupAgentSNMP
4356 @property
4357 def name(self):
4358 return "snmp_communities"
4360 @property
4361 def valuespec(self):
4362 return SNMPCredentials(
4363 title=_("SNMP credentials of monitored hosts"),
4364 help=
4365 _("By default Check_MK uses the community \"public\" to contact hosts via SNMP v1/v2. This rule "
4366 "can be used to customize the the credentials to be used when contacting hosts via SNMP."
4371 @rulespec_registry.register
4372 class RulespecManagementBoardConfig(HostRulespec):
4373 @property
4374 def group(self):
4375 return RulespecGroupAgentSNMP
4377 @property
4378 def name(self):
4379 return "management_board_config"
4381 @property
4382 def valuespec(self):
4383 return CascadingDropdown(
4384 title=_("Management board config"),
4385 choices=[
4386 ("snmp", _("SNMP"), SNMPCredentials()),
4387 ("ipmi", _("IPMI"), IPMIParameters()),
4392 @rulespec_registry.register
4393 class RulespecSnmpCharacterEncodings(HostRulespec):
4394 @property
4395 def group(self):
4396 return RulespecGroupAgentSNMP
4398 @property
4399 def name(self):
4400 return "snmp_character_encodings"
4402 @property
4403 def valuespec(self):
4404 return DropdownChoice(
4405 title=_("Output text encoding settings for SNMP devices"),
4406 help=_("Some devices send texts in non-ASCII characters. Check_MK"
4407 " always assumes UTF-8 encoding. You can declare other "
4408 " other encodings here"),
4409 choices=[
4410 ("utf-8", _("UTF-8")),
4411 ("latin1", _("latin1")),
4412 ("cp437", _("cp437")),
4417 @rulespec_registry.register
4418 class RulespecBulkwalkHosts(BinaryHostRulespec):
4419 @property
4420 def group(self):
4421 return RulespecGroupAgentSNMP
4423 @property
4424 def name(self):
4425 return "bulkwalk_hosts"
4427 @property
4428 def title(self):
4429 return _("Bulk walk: Hosts using bulk walk (enforces SNMP v2c)")
4431 @property
4432 def help(self):
4433 return _("Most SNMP hosts support SNMP version 2c. However, Check_MK defaults to version "
4434 "1, in order to support as many devices as possible. Please use this ruleset in "
4435 "order to configure SNMP v2c for as many hosts as possible. That version has two "
4436 "advantages: it supports 64 bit counters, which avoids problems with wrapping "
4437 "counters at too much traffic. And it supports bulk walk, which saves much CPU "
4438 "and network resources. Please be aware, however, that there are some broken "
4439 "devices out there, that support bulk walk but behave very bad when it is used. "
4440 "When you want to enable v2c while not using bulk walk, please use the rule set "
4441 "snmpv2c_hosts instead.")
4444 @rulespec_registry.register
4445 class RulespecSnmpBulkSize(HostRulespec):
4446 @property
4447 def group(self):
4448 return RulespecGroupAgentSNMP
4450 @property
4451 def name(self):
4452 return "snmp_bulk_size"
4454 @property
4455 def valuespec(self):
4456 return Integer(
4457 title=_("Bulk walk: Number of OIDs per bulk"),
4458 label=_("Number of OIDs to request per bulk: "),
4459 minvalue=1,
4460 maxvalue=100,
4461 default_value=10,
4462 help=_(
4463 "This variable allows you to configure the numbr of OIDs Check_MK should request "
4464 "at once. This rule only applies to SNMP hosts that are configured to be bulk "
4465 "walk hosts.You may want to use this rule to tune SNMP performance. Be aware: A "
4466 "higher value is not always better. It may decrease the transactions between "
4467 "Check_MK and the target system, but may increase the OID overhead in case you "
4468 "only need a small amount of OIDs."),
4472 @rulespec_registry.register
4473 class RulespecSnmpWithoutSysDescr(BinaryHostRulespec):
4474 @property
4475 def group(self):
4476 return RulespecGroupAgentSNMP
4478 @property
4479 def name(self):
4480 return "snmp_without_sys_descr"
4482 @property
4483 def title(self):
4484 return _("Hosts without system description OID")
4486 @property
4487 def help(self):
4488 return _("Devices which do not publish the system description OID .1.3.6.1.2.1.1.1.0 are "
4489 "normally ignored by the SNMP inventory. Use this ruleset to select hosts which "
4490 "should nevertheless be checked.")
4493 @rulespec_registry.register
4494 class RulespecSnmpv2CHosts(BinaryHostRulespec):
4495 @property
4496 def group(self):
4497 return RulespecGroupAgentSNMP
4499 @property
4500 def name(self):
4501 return "snmpv2c_hosts"
4503 @property
4504 def title(self):
4505 return _("Legacy SNMP devices using SNMP v2c")
4507 @property
4508 def help(self):
4509 return _("There exist a few devices out there that behave very badly when using SNMP v2c "
4510 "and bulk walk. If you want to use SNMP v2c on those devices, nevertheless, you "
4511 "need to configure this device as legacy snmp device and upgrade it to SNMP v2c "
4512 "(without bulk walk) with this rule set. One reason is enabling 64 bit counters. "
4513 "Note: This rule won't apply if the device is already configured as SNMP v2c "
4514 "device.")
4517 @rulespec_registry.register
4518 class RulespecSnmpTiming(HostRulespec):
4519 @property
4520 def group(self):
4521 return RulespecGroupAgentSNMP
4523 @property
4524 def name(self):
4525 return "snmp_timing"
4527 @property
4528 def match_type(self):
4529 return "dict"
4531 @property
4532 def factory_default(self):
4533 return {'retries': 5, 'timeout': 1}
4535 @property
4536 def valuespec(self):
4537 return Dictionary(
4538 title=_("Timing settings for SNMP access"),
4539 help=_("This rule decides about the number of retries and timeout values "
4540 "for the SNMP access to devices."),
4541 elements=[
4543 "timeout",
4544 Float(
4545 title=_("Response timeout for a single query"),
4546 help=_(
4547 "After a request is sent to the remote SNMP agent we will wait up to this "
4548 "number of seconds until assuming the answer get lost and retrying."),
4549 default_value=1,
4550 minvalue=0.1,
4551 maxvalue=60,
4552 allow_int=True,
4553 unit=_("sec"),
4554 size=6,
4557 ("retries",
4558 Integer(
4559 title=_("Number of retries"),
4560 default_value=5,
4561 minvalue=0,
4562 maxvalue=50,
4568 @rulespec_registry.register
4569 class RulespecNonInlineSnmpHosts(BinaryHostRulespec):
4570 @property
4571 def group(self):
4572 return RulespecGroupAgentSNMP
4574 @property
4575 def name(self):
4576 return "non_inline_snmp_hosts"
4578 @property
4579 def title(self):
4580 return _("Hosts not using Inline-SNMP")
4582 @property
4583 def help(self):
4584 return _("Check_MK has an efficient SNMP implementation called Inline SNMP which reduces "
4585 "the load produced by SNMP monitoring on the monitoring host significantly. This "
4586 "option is enabled by default for all SNMP hosts and it is a good idea to keep "
4587 "this default setting. However, there are SNMP devices which have problems with "
4588 "this SNMP implementation. You can use this rule to disable Inline SNMP for these "
4589 "hosts.")
4592 @rulespec_registry.register
4593 class RulespecUsewalkHosts(BinaryHostRulespec):
4594 @property
4595 def group(self):
4596 return RulespecGroupAgentSNMP
4598 @property
4599 def name(self):
4600 return "usewalk_hosts"
4602 @property
4603 def title(self):
4604 return _("Simulating SNMP by using a stored SNMP walk")
4606 @property
4607 def help(self):
4608 return _("This ruleset helps in test and development. You can create stored SNMP walks on "
4609 "the command line with cmk --snmpwalk HOSTNAME. A host that is configured with "
4610 "this ruleset will then use the information from that file instead of using real "
4611 "SNMP.")
4614 @rulespec_registry.register
4615 class RulespecSnmpPorts(HostRulespec):
4616 @property
4617 def group(self):
4618 return RulespecGroupAgentSNMP
4620 @property
4621 def name(self):
4622 return "snmp_ports"
4624 @property
4625 def valuespec(self):
4626 return Integer(
4627 minvalue=1,
4628 maxvalue=65535,
4629 default_value=161,
4630 title=_("UDP port used for SNMP"),
4631 help=_("This variable allows you to customize the UDP port to be used to "
4632 "communicate via SNMP on a per-host-basis."),
4636 @rulespec_group_registry.register
4637 class RulespecGroupAgentCMKAgent(RulespecSubGroup):
4638 @property
4639 def main_group(self):
4640 return RulespecGroupAgent
4642 @property
4643 def sub_group_name(self):
4644 return "check_mk_agent"
4646 @property
4647 def title(self):
4648 return _("Check_MK Agent")
4651 @rulespec_registry.register
4652 class RulespecAgentPorts(HostRulespec):
4653 @property
4654 def group(self):
4655 return RulespecGroupAgentCMKAgent
4657 @property
4658 def name(self):
4659 return "agent_ports"
4661 @property
4662 def valuespec(self):
4663 return Integer(
4664 minvalue=1,
4665 maxvalue=65535,
4666 default_value=6556,
4667 title=_("TCP port for connection to Check_MK agent"),
4668 help=_("This variable allows to specify the TCP port to "
4669 "be used to connect to the agent on a per-host-basis. "),
4673 @rulespec_registry.register
4674 class RulespecTcpConnectTimeouts(HostRulespec):
4675 @property
4676 def group(self):
4677 return RulespecGroupAgentCMKAgent
4679 @property
4680 def name(self):
4681 return "tcp_connect_timeouts"
4683 @property
4684 def valuespec(self):
4685 return Float(
4686 minvalue=1.0,
4687 default_value=5.0,
4688 unit="sec",
4689 title=_("Agent TCP connect timeout"),
4690 help=_(
4691 "Timeout for TCP connect to the Check_MK agent in seconds. If the connection "
4692 "to the agent cannot be established within this time, it is considered to be unreachable. "
4693 "Note: This does <b>not</b> limit the time the agent needs to "
4694 "generate its output. "
4695 "This rule can be used to specify a timeout on a per-host-basis."),
4699 @rulespec_registry.register
4700 class RulespecAgentEncryption(HostRulespec):
4701 @property
4702 def group(self):
4703 return RulespecGroupAgentCMKAgent
4705 @property
4706 def name(self):
4707 return "agent_encryption"
4709 @property
4710 def valuespec(self):
4711 return Dictionary(
4712 elements=[
4713 ("passphrase", PasswordSpec(title=_("Encryption secret"), allow_empty=False)),
4714 ("use_regular",
4715 DropdownChoice(
4716 title=_("Encryption for Agent"),
4717 help=_("Choose if the agent agents encrypt packages. This controls whether "
4718 "baked agents encrypt their output and whether check_mk expects "
4719 "encrypted output. "
4720 "Please note: If you opt to enforce encryption, "
4721 "agents that don't support encryption will not work any more. "
4722 "Further note: This only affects regular agents, not special agents "
4723 "aka datasource programs."),
4724 default_value="disable",
4725 choices=[("enforce", _("Enforce (drop unencrypted data)")),
4726 ("allow", _("Enable (accept encrypted and unencrypted data)")),
4727 ("disable", _("Disable (drop encrypted data)"))])),
4728 ("use_realtime",
4729 DropdownChoice(
4730 title=_("Encryption for Realtime Updates"),
4731 help=_("Choose if realtime updates are sent/expected encrypted"),
4732 default_value="enforce",
4733 choices=[("enforce", _("Enforce (drop unencrypted data)")),
4734 ("allow", _("Enable (accept encrypted and unencrypted data)")),
4735 ("disable", _("Disable (drop encrypted data)"))])),
4737 optional_keys=[],
4738 title=_("Encryption"),
4739 help=_("Control encryption of data sent from agent to host."),
4743 def _common_check_mk_exit_status_elements():
4744 return [
4746 "empty_output",
4747 MonitoringState(default_value=2, title=_("State in case of empty output")),
4750 "connection",
4751 MonitoringState(default_value=2, title=_("State in case of connection problems")),
4754 "timeout",
4755 MonitoringState(default_value=2, title=_("State in case of a timeout")),
4758 "exception",
4759 MonitoringState(default_value=3, title=_("State in case of unhandled exception")),
4764 def transform_exit_code_spec(p):
4765 if "overall" in p:
4766 return p
4767 return {"overall": p}
4770 @rulespec_registry.register
4771 class RulespecCheckMkExitStatus(HostRulespec):
4772 @property
4773 def group(self):
4774 return RulespecGroupAgentCMKAgent
4776 @property
4777 def name(self):
4778 return "check_mk_exit_status"
4780 @property
4781 def match_type(self):
4782 return "dict"
4784 @property
4785 def factory_default(self):
4786 return {
4787 'connection': 2,
4788 'wrong_version': 1,
4789 'exception': 3,
4790 'empty_output': 2,
4791 'missing_sections': 1
4794 @property
4795 def valuespec(self):
4796 return Transform(
4797 Dictionary(
4798 elements=[
4799 ("overall",
4800 Dictionary(
4801 title=_("Overall status"),
4802 elements=_common_check_mk_exit_status_elements() + [
4804 "wrong_version",
4805 MonitoringState(
4806 default_value=1,
4807 title=_("State in case of wrong agent version")),
4810 "missing_sections",
4811 MonitoringState(
4812 default_value=1,
4813 title=_(
4814 "State if just <i>some</i> agent sections are missing")),
4817 "specific_missing_sections",
4818 ListOf(
4819 Tuple(
4820 elements=[
4821 RegExpUnicode(
4822 help=
4823 _('Beside of setting the generic "Missing sections" state above '
4824 'you can specify a regex pattern to match specific section names and '
4825 'give them an individual state in case they are missing. '
4826 'Note that the first match is used.'),
4827 mode=RegExpUnicode.prefix),
4828 MonitoringState(),
4830 orientation="horizontal"),
4831 title=_("State if specific sections are missing"),
4834 ])),
4835 ("individual",
4836 Dictionary(
4837 title=_("Individual states per data source"),
4838 elements=[
4839 ("agent",
4840 Dictionary(
4841 title=_("Agent"),
4842 elements=_common_check_mk_exit_status_elements() + [
4844 "wrong_version",
4845 MonitoringState(
4846 default_value=1,
4847 title=_("State in case of wrong agent version")),
4849 ])),
4850 ("programs",
4851 Dictionary(
4852 title=_("Programs"),
4853 elements=_common_check_mk_exit_status_elements())),
4854 ("special",
4855 Dictionary(
4856 title=_("Programs"),
4857 elements=_common_check_mk_exit_status_elements())),
4858 ("snmp",
4859 Dictionary(
4860 title=_("SNMP"),
4861 elements=_common_check_mk_exit_status_elements())),
4862 ("mgmt_snmp",
4863 Dictionary(
4864 title=_("SNMP Management Board"),
4865 elements=_common_check_mk_exit_status_elements())),
4866 ("mgmt_ipmi",
4867 Dictionary(
4868 title=_("IPMI Management Board"),
4869 elements=_common_check_mk_exit_status_elements())),
4870 ("piggyback",
4871 Dictionary(
4872 title=_("Piggyback"),
4873 elements=_common_check_mk_exit_status_elements())),
4874 ])),
4876 optional_keys=["individual"],
4878 forth=transform_exit_code_spec,
4879 title=_("Status of the Check_MK services"),
4880 help=_(
4881 "This ruleset specifies the total status of the Check_MK services <i>Check_MK</i>, "
4882 "<i>Check_MK Discovery</i> and <i>Check_MK HW/SW Inventory</i> in case of various "
4883 "error situations. One use case is the monitoring of hosts that are not always up. "
4884 "You can have Check_MK an OK status here if the host is not reachable. Note: the "
4885 "<i>Timeout</i> setting only works when using the Check_MK Micro Core."),
4889 @rulespec_registry.register
4890 class RulespecCheckMkAgentTargetVersions(HostRulespec):
4891 @property
4892 def group(self):
4893 return RulespecGroupAgentCMKAgent
4895 @property
4896 def name(self):
4897 return "check_mk_agent_target_versions"
4899 @property
4900 def valuespec(self):
4901 return Transform(
4902 CascadingDropdown(
4903 title=_("Check for correct version of Check_MK agent"),
4904 help=_("Here you can make sure that all of your Check_MK agents are running"
4905 " one specific version. Agents running "
4906 " a different version return a non-OK state."),
4907 choices=[
4908 ("ignore", _("Ignore the version")),
4909 ("site", _("Same version as the monitoring site")),
4910 ("specific", _("Specific version"), TextAscii(allow_empty=False,)),
4911 ("at_least", _("At least"),
4912 Dictionary(elements=[
4913 ('release',
4914 TextAscii(
4915 title=_('Official Release version'),
4916 allow_empty=False,
4918 ('daily_build', TextAscii(
4919 title=_('Daily build'),
4920 allow_empty=False,
4922 ])),
4924 default_value="ignore",
4926 # In the past, this was a OptionalDropdownChoice() which values could be strings:
4927 # ignore, site or a custom string representing a version number.
4928 forth=lambda x: isinstance(x, str) and x not in ["ignore", "site"] and ("specific", x)
4929 or x,
4933 @rulespec_group_registry.register
4934 class RulespecGroupMonitoringAgents(RulespecGroup):
4935 @property
4936 def name(self):
4937 return "agents"
4939 @property
4940 def title(self):
4941 return _("Monitoring Agents")
4943 @property
4944 def help(self):
4945 return _("Configuration of monitoring agents for Linux, Windows and Unix")
4948 @rulespec_group_registry.register
4949 class RulespecGroupMonitoringAgentsGenericOptions(RulespecSubGroup):
4950 @property
4951 def main_group(self):
4952 return RulespecGroupMonitoringAgents
4954 @property
4955 def sub_group_name(self):
4956 return "generic_options"
4958 @property
4959 def title(self):
4960 return _("Generic Options")
4963 @rulespec_registry.register
4964 class RulespecAgentConfigOnlyFrom(HostRulespec):
4965 @property
4966 def group(self):
4967 return RulespecGroupMonitoringAgentsGenericOptions
4969 @property
4970 def name(self):
4971 return "agent_config:only_from"
4973 @property
4974 def valuespec(self):
4975 return ListOfStrings(
4976 valuespec=IPNetwork(),
4977 title=_("Allowed agent access via IP address"),
4978 help=_("This rule allows you to restrict the access to the "
4979 "Check_MK agent to certain IP addresses and networks. "
4980 "Usually you configure just the IP addresses of your "
4981 "Check_MK servers here. You can enter either IP addresses "
4982 "in the form <tt>1.2.3.4</tt> or networks in the style "
4983 "<tt>1.2.0.0/16</tt>. If you leave this configuration empty "
4984 "or create no rule then <b>all</b> addresses are allowed to "
4985 "access the agent. IPv6 addresses and networks are also allowed."),
4989 @rulespec_registry.register
4990 class RulespecPiggybackTranslation(HostRulespec):
4991 @property
4992 def group(self):
4993 return RulespecGroupAgentGeneralSettings
4995 @property
4996 def name(self):
4997 return "piggyback_translation"
4999 @property
5000 def match_type(self):
5001 return "dict"
5003 @property
5004 def valuespec(self):
5005 return HostnameTranslation(
5006 title=_("Hostname translation for piggybacked hosts"),
5007 help=
5008 _("Some agents or agent plugins send data not only for the queried host but also "
5009 "for other hosts &quot;piggyback&quot; with their own data. This is the case "
5010 "for the vSphere special agent and the SAP R/3 plugin, for example. The hostnames "
5011 "that these agents send must match your hostnames in your monitoring configuration. "
5012 "If that is not the case, then with this rule you can define a hostname translation. "
5013 "Note: This rule must be configured for the &quot;pig&quot; - i.e. the host that the "
5014 "agent is running on. It is not applied to the translated piggybacked hosts."),
5018 @rulespec_registry.register
5019 class RulespecServiceDescriptionTranslation(HostRulespec):
5020 @property
5021 def group(self):
5022 return RulespecGroupAgentGeneralSettings
5024 @property
5025 def name(self):
5026 return "service_description_translation"
5028 @property
5029 def valuespec(self):
5030 return ServiceDescriptionTranslation(
5031 title=_("Translation of service descriptions"),
5032 help=
5033 _("Within this ruleset service descriptions can be translated similar to the ruleset "
5034 "<tt>Hostname translation for piggybacked hosts</tt>. Services such as "
5035 "<tt>Check_MK</tt>, <tt>Check_MK Agent</tt>, <tt>Check_MK Discovery</tt>, "
5036 "<tt>Check_MK inventory</tt>, and <tt>Check_MK HW/SW Inventory</tt> are excluded. "
5037 "<b>Attention:</b><ul>"
5038 "<li>Downtimes and other configured rules which match these "
5039 "services have to be adapted.</li>"
5040 "<li>Performance data and graphs will begin from scratch for translated services.</li>"
5041 "<li>Especially configured check parameters keep their functionality further on.</li>"
5042 "<li>This new ruleset translates also the item part of a service description. "
5043 "This means that after such a translation the item may be gone but is used in the "
5044 "conditions of the parameters further on if any parameters are configured. "
5045 "This might be confusing.</li></ul>"
5046 "This rule should only be configured in the early stages."),
5050 def get_snmp_checktypes():
5051 checks = watolib.check_mk_local_automation("get-check-information")
5052 types = [(cn, (c['title'] != cn and '%s: ' % cn or '') + c['title'])
5053 for (cn, c) in checks.items()
5054 if c['snmp']]
5055 types.sort()
5056 return [(None, _('All SNMP Checks'))] + types
5059 def get_snmp_section_names():
5060 checks = watolib.check_mk_local_automation("get-check-information")
5061 snmp_section_names = set(cn.split(".", 1)[0] for (cn, c) in checks.items() if c['snmp'])
5062 section_choices = [(sn, sn) for sn in snmp_section_names]
5063 return [(None, _('All SNMP Checks'))] + sorted(section_choices)
5066 @rulespec_registry.register
5067 class RulespecSnmpCheckInterval(HostRulespec):
5068 @property
5069 def group(self):
5070 return RulespecGroupAgentSNMP
5072 @property
5073 def name(self):
5074 return "snmp_check_interval"
5076 @property
5077 def valuespec(self):
5078 return Tuple(
5079 title=_('Check intervals for SNMP checks'),
5080 help=_(
5081 'This rule can be used to customize the check interval of each SNMP based check. '
5082 'With this option it is possible to configure a longer check interval for specific '
5083 'checks, than then normal check interval.'),
5084 elements=[
5085 Transform(
5086 DropdownChoice(
5087 title=_("Check"),
5088 help=_("You can only configure \"section names\" here and not choose all "
5089 "individual SNMP based checks here. It is only possible to define "
5090 "SNMP check intervals for main checks and all the related sub "
5091 "checks together. The reason for this is that the data of the "
5092 "main check and it's sub checks is defined for the whole group "
5093 "of checks in the main check and also fetched for all these "
5094 "checks together."),
5095 choices=get_snmp_section_names,
5097 # Transform check types to section names
5098 forth=lambda e: e.split(".")[0] if e is not None else None,
5100 Integer(
5101 title=_("Do check every"),
5102 unit=_("minutes"),
5103 min_value=1,
5104 default_value=1,
5109 @rulespec_registry.register
5110 class RulespecSNMPv3Contexts(HostRulespec):
5111 @property
5112 def group(self):
5113 return RulespecGroupAgentSNMP
5115 @property
5116 def name(self):
5117 return "snmpv3_contexts"
5119 @property
5120 def valuespec(self):
5121 return Tuple(
5122 title=_('SNMPv3 contexts to use in requests'),
5123 help=_(
5124 'By default Check_MK does not use a specific context during SNMPv3 queries, '
5125 'but some devices are offering their information in different SNMPv3 contexts. '
5126 'This rule can be used to configure, based on hosts and check type, which SNMPv3 '
5127 'contexts Check_MK should ask for when getting information via SNMPv3.'),
5128 elements=[
5129 DropdownChoice(
5130 title=_("Checktype"),
5131 choices=get_snmp_checktypes,
5133 ListOfStrings(
5134 title=_("SNMP Context IDs"),
5135 allow_empty=False,