From c16e3471c1abd6d9fb6e564403de9a59c91d9654 Mon Sep 17 00:00:00 2001 From: Kenneth Okoh Date: Fri, 11 Jan 2019 17:55:38 +0100 Subject: [PATCH] Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393) Change-Id: I71e503a89f7682286a375da6476dd34232104711 --- .../wato/check_parameters/esx_host_memory.py | 49 ++++ .../wato/check_parameters/esx_vsphere_objects.py | 89 +++++++ .../check_parameters/esx_vsphere_objects_count.py | 65 +++++ .../wato/check_parameters/services_summary.py | 62 +++++ .../check_parameters/solaris_services_summary.py | 47 ++++ cmk/gui/plugins/wato/check_parameters/unsorted.py | 277 --------------------- .../wato/check_parameters/vm_guest_tools.py | 67 +++++ .../plugins/wato/check_parameters/vm_heartbeat.py | 71 ++++++ .../check_parameters/windows_printer_queues.py | 116 +++++++++ 9 files changed, 566 insertions(+), 277 deletions(-) create mode 100644 cmk/gui/plugins/wato/check_parameters/esx_host_memory.py create mode 100644 cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects.py create mode 100644 cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects_count.py create mode 100644 cmk/gui/plugins/wato/check_parameters/services_summary.py create mode 100644 cmk/gui/plugins/wato/check_parameters/solaris_services_summary.py create mode 100644 cmk/gui/plugins/wato/check_parameters/vm_guest_tools.py create mode 100644 cmk/gui/plugins/wato/check_parameters/vm_heartbeat.py create mode 100644 cmk/gui/plugins/wato/check_parameters/windows_printer_queues.py diff --git a/cmk/gui/plugins/wato/check_parameters/esx_host_memory.py b/cmk/gui/plugins/wato/check_parameters/esx_host_memory.py new file mode 100644 index 0000000000..d74154342c --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/esx_host_memory.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Percentage, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersOperatingSystem, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersOperatingSystem, + "esx_host_memory", + _("Main memory usage of ESX host system"), + Tuple( + title=_("Specify levels in percentage of total RAM"), + elements=[ + Percentage(title=_("Warning at a RAM usage of"), default_value=80.0), + Percentage(title=_("Critical at a RAM usage of"), default_value=90.0), + ]), + None, + match_type="first", +) diff --git a/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects.py b/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects.py new file mode 100644 index 0000000000..64071cae62 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects.py @@ -0,0 +1,89 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + MonitoringState, + TextAscii, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "esx_vsphere_objects", + _("State of ESX hosts and virtual machines"), + Dictionary( + help=_("Usually the check goes to WARN if a VM or host is powered off and OK otherwise. " + "You can change this behaviour on a per-state-basis here."), + optional_keys=False, + elements=[ + ("states", + Dictionary( + title=_("Target states"), + optional_keys=False, + elements=[ + ("poweredOn", + MonitoringState( + title=_("Powered ON"), + help=_("Check result if the host or VM is powered on"), + default_value=0, + )), + ("poweredOff", + MonitoringState( + title=_("Powered OFF"), + help=_("Check result if the host or VM is powered off"), + default_value=1, + )), + ("suspended", + MonitoringState( + title=_("Suspended"), + help=_("Check result if the host or VM is suspended"), + default_value=1, + )), + ("unknown", + MonitoringState( + title=_("Unknown"), + help=_( + "Check result if the host or VM state is reported as unknown"), + default_value=3, + )), + ])), + ]), + TextAscii( + title=_("Name of the VM/HostSystem"), + help=_( + "Please do not forget to specify either VM or HostSystem. Example: VM abcsrv123. Also note, " + "that we match the beginning of the name."), + regex="(^VM|HostSystem)( .*|$)", + regex_error=_("The name of the system must begin with VM or HostSystem."), + allow_empty=False, + ), + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects_count.py b/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects_count.py new file mode 100644 index 0000000000..5c1ed38ad7 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/esx_vsphere_objects_count.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Integer, + ListOf, + ListOfStrings, + MonitoringState, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "esx_vsphere_objects_count", + _("Distribution of virtual machines over ESX hosts"), + Dictionary( + optional_keys=False, + elements=[ + ("distribution", + ListOf( + Dictionary( + optional_keys=False, + elements=[("vm_names", ListOfStrings(title=_("VMs"))), + ("hosts_count", Integer(title=_("Number of hosts"), + default_value=2)), + ("state", + MonitoringState(title=_("State if violated"), default_value=1))]), + title=_("VM distribution"), + help=_( + "You can specify lists of VM names and a number of hosts," + " to make sure the specfied VMs are distributed across at least so many hosts." + " E.g. provide two VM names and set 'Number of hosts' to two," + " to make sure those VMs are not running on the same host."))), + ]), + None, + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/services_summary.py b/cmk/gui/plugins/wato/check_parameters/services_summary.py new file mode 100644 index 0000000000..57ad6eb171 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/services_summary.py @@ -0,0 +1,62 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + ListOfStrings, + MonitoringState, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, "services_summary", _("Windows Service Summary"), + Dictionary( + title=_('Autostart Services'), + elements=[ + ('ignored', + ListOfStrings( + title=_("Ignored autostart services"), + help=_('Regular expressions matching the begining of the internal name ' + 'or the description of the service. ' + 'If no name is given then this rule will match all services. The ' + 'match is done on the beginning of the service name. It ' + 'is done case sensitive. You can do a case insensitive match ' + 'by prefixing the regular expression with (?i). Example: ' + '(?i).*mssql matches all services which contain MSSQL ' + 'or MsSQL or mssql or...'), + orientation="horizontal", + )), + ('state_if_stopped', + MonitoringState( + title=_("Default state if stopped autostart services are found"), + default_value=0, + )), + ], + ), None, "dict") diff --git a/cmk/gui/plugins/wato/check_parameters/solaris_services_summary.py b/cmk/gui/plugins/wato/check_parameters/solaris_services_summary.py new file mode 100644 index 0000000000..fbbf91a956 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/solaris_services_summary.py @@ -0,0 +1,47 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + MonitoringState, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, "solaris_services_summary", + _("Solaris Services Summary"), + Dictionary( + elements=[ + ('maintenance_state', + MonitoringState( + title=_("State if 'maintenance' services are found"), + default_value=0, + )), + ],), None, "dict") diff --git a/cmk/gui/plugins/wato/check_parameters/unsorted.py b/cmk/gui/plugins/wato/check_parameters/unsorted.py index f5738fd151..7121a7cb97 100644 --- a/cmk/gui/plugins/wato/check_parameters/unsorted.py +++ b/cmk/gui/plugins/wato/check_parameters/unsorted.py @@ -65,7 +65,6 @@ from cmk.gui.plugins.wato import ( RulespecGroupCheckParametersHardware, RulespecGroupCheckParametersNetworking, RulespecGroupCheckParametersOperatingSystem, - RulespecGroupCheckParametersPrinters, RulespecGroupCheckParametersStorage, RulespecGroupCheckParametersVirtualization, register_rule, @@ -1249,282 +1248,6 @@ register_rule( register_check_parameters( RulespecGroupCheckParametersOperatingSystem, - "esx_host_memory", - _("Main memory usage of ESX host system"), - Tuple( - title=_("Specify levels in percentage of total RAM"), - elements=[ - Percentage(title=_("Warning at a RAM usage of"), default_value=80.0), - Percentage(title=_("Critical at a RAM usage of"), default_value=90.0), - ]), - None, - match_type="first", -) - -register_check_parameters( - RulespecGroupCheckParametersOperatingSystem, - "vm_guest_tools", - _("Virtual machine (for example ESX) guest tools status"), - Dictionary( - optional_keys=False, - elements=[ - ("guestToolsCurrent", - MonitoringState( - title=_("VMware Tools is installed, and the version is current"), - default_value=0, - )), - ("guestToolsNeedUpgrade", - MonitoringState( - title=_("VMware Tools is installed, but the version is not current"), - default_value=1, - )), - ("guestToolsNotInstalled", - MonitoringState( - title=_("VMware Tools have never been installed"), - default_value=2, - )), - ("guestToolsUnmanaged", - MonitoringState( - title=_("VMware Tools is installed, but it is not managed by VMWare"), - default_value=1, - )), - ]), - None, - "dict", -) -register_check_parameters( - RulespecGroupCheckParametersOperatingSystem, - "vm_heartbeat", - _("Virtual machine (for example ESX) heartbeat status"), - Dictionary( - optional_keys=False, - elements=[ - ("heartbeat_missing", - MonitoringState( - title=_("No heartbeat"), - help=_("Guest operating system may have stopped responding."), - default_value=2, - )), - ("heartbeat_intermittend", - MonitoringState( - title=_("Intermittent heartbeat"), - help=_("May be due to high guest load."), - default_value=1, - )), - ("heartbeat_no_tools", - MonitoringState( - title=_("Heartbeat tools missing or not installed"), - help=_("No VMWare Tools installed."), - default_value=1, - )), - ("heartbeat_ok", - MonitoringState( - title=_("Heartbeat OK"), - help=_("Guest operating system is responding normally."), - default_value=0, - )), - ]), - None, - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, "services_summary", _("Windows Service Summary"), - Dictionary( - title=_('Autostart Services'), - elements=[ - ('ignored', - ListOfStrings( - title=_("Ignored autostart services"), - help=_('Regular expressions matching the begining of the internal name ' - 'or the description of the service. ' - 'If no name is given then this rule will match all services. The ' - 'match is done on the beginning of the service name. It ' - 'is done case sensitive. You can do a case insensitive match ' - 'by prefixing the regular expression with (?i). Example: ' - '(?i).*mssql matches all services which contain MSSQL ' - 'or MsSQL or mssql or...'), - orientation="horizontal", - )), - ('state_if_stopped', - MonitoringState( - title=_("Default state if stopped autostart services are found"), - default_value=0, - )), - ], - ), None, "dict") - -register_check_parameters( - RulespecGroupCheckParametersApplications, "solaris_services_summary", - _("Solaris Services Summary"), - Dictionary( - elements=[ - ('maintenance_state', - MonitoringState( - title=_("State if 'maintenance' services are found"), - default_value=0, - )), - ],), None, "dict") - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "esx_vsphere_objects", - _("State of ESX hosts and virtual machines"), - Dictionary( - help=_("Usually the check goes to WARN if a VM or host is powered off and OK otherwise. " - "You can change this behaviour on a per-state-basis here."), - optional_keys=False, - elements=[ - ("states", - Dictionary( - title=_("Target states"), - optional_keys=False, - elements=[ - ("poweredOn", - MonitoringState( - title=_("Powered ON"), - help=_("Check result if the host or VM is powered on"), - default_value=0, - )), - ("poweredOff", - MonitoringState( - title=_("Powered OFF"), - help=_("Check result if the host or VM is powered off"), - default_value=1, - )), - ("suspended", - MonitoringState( - title=_("Suspended"), - help=_("Check result if the host or VM is suspended"), - default_value=1, - )), - ("unknown", - MonitoringState( - title=_("Unknown"), - help=_( - "Check result if the host or VM state is reported as unknown"), - default_value=3, - )), - ])), - ]), - TextAscii( - title=_("Name of the VM/HostSystem"), - help=_( - "Please do not forget to specify either VM or HostSystem. Example: VM abcsrv123. Also note, " - "that we match the beginning of the name."), - regex="(^VM|HostSystem)( .*|$)", - regex_error=_("The name of the system must begin with VM or HostSystem."), - allow_empty=False, - ), - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "esx_vsphere_objects_count", - _("Distribution of virtual machines over ESX hosts"), - Dictionary( - optional_keys=False, - elements=[ - ("distribution", - ListOf( - Dictionary( - optional_keys=False, - elements=[("vm_names", ListOfStrings(title=_("VMs"))), - ("hosts_count", Integer(title=_("Number of hosts"), - default_value=2)), - ("state", - MonitoringState(title=_("State if violated"), default_value=1))]), - title=_("VM distribution"), - help=_( - "You can specify lists of VM names and a number of hosts," - " to make sure the specfied VMs are distributed across at least so many hosts." - " E.g. provide two VM names and set 'Number of hosts' to two," - " to make sure those VMs are not running on the same host."))), - ]), - None, - "dict", -) - - -def windows_printer_queues_forth(old): - default = { - "warn_states": [8, 11], - "crit_states": [9, 10], - } - if isinstance(old, tuple): - default['levels'] = old - if isinstance(old, dict): - return old - return default - - -register_check_parameters( - RulespecGroupCheckParametersPrinters, - "windows_printer_queues", - _("Number of open jobs of a printer on windows"), - Transform( - Dictionary( - title=_("Windows Printer Configuration"), - elements=[ - ( - "levels", - Tuple( - title=_("Levels for the number of print jobs"), - help=_("This rule is applied to the number of print jobs " - "currently waiting in windows printer queue."), - elements=[ - Integer(title=_("Warning at"), unit=_("jobs"), default_value=40), - Integer(title=_("Critical at"), unit=_("jobs"), default_value=60), - ]), - ), - ("crit_states", - ListChoice( - title=_("States who should lead to critical"), - choices=[ - (0, "Unkown"), - (1, "Other"), - (2, "No Error"), - (3, "Low Paper"), - (4, "No Paper"), - (5, "Low Toner"), - (6, "No Toner"), - (7, "Door Open"), - (8, "Jammed"), - (9, "Offline"), - (10, "Service Requested"), - (11, "Output Bin Full"), - ], - default_value=[9, 10], - )), - ("warn_states", - ListChoice( - title=_("States who should lead to warning"), - choices=[ - (0, "Unkown"), - (1, "Other"), - (2, "No Error"), - (3, "Low Paper"), - (4, "No Paper"), - (5, "Low Toner"), - (6, "No Toner"), - (7, "Door Open"), - (8, "Jammed"), - (9, "Offline"), - (10, "Service Requested"), - (11, "Output Bin Full"), - ], - default_value=[8, 11], - )), - ]), - forth=windows_printer_queues_forth, - ), - TextAscii(title=_("Printer Name"), allow_empty=True), - match_type="first", -) - -register_check_parameters( - RulespecGroupCheckParametersOperatingSystem, "cpu_load", _("CPU load (not utilization!)"), Levels( diff --git a/cmk/gui/plugins/wato/check_parameters/vm_guest_tools.py b/cmk/gui/plugins/wato/check_parameters/vm_guest_tools.py new file mode 100644 index 0000000000..4f94bf47bc --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/vm_guest_tools.py @@ -0,0 +1,67 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + MonitoringState, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersOperatingSystem, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersOperatingSystem, + "vm_guest_tools", + _("Virtual machine (for example ESX) guest tools status"), + Dictionary( + optional_keys=False, + elements=[ + ("guestToolsCurrent", + MonitoringState( + title=_("VMware Tools is installed, and the version is current"), + default_value=0, + )), + ("guestToolsNeedUpgrade", + MonitoringState( + title=_("VMware Tools is installed, but the version is not current"), + default_value=1, + )), + ("guestToolsNotInstalled", + MonitoringState( + title=_("VMware Tools have never been installed"), + default_value=2, + )), + ("guestToolsUnmanaged", + MonitoringState( + title=_("VMware Tools is installed, but it is not managed by VMWare"), + default_value=1, + )), + ]), + None, + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/vm_heartbeat.py b/cmk/gui/plugins/wato/check_parameters/vm_heartbeat.py new file mode 100644 index 0000000000..fd2871e8f7 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/vm_heartbeat.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + MonitoringState, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersOperatingSystem, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersOperatingSystem, + "vm_heartbeat", + _("Virtual machine (for example ESX) heartbeat status"), + Dictionary( + optional_keys=False, + elements=[ + ("heartbeat_missing", + MonitoringState( + title=_("No heartbeat"), + help=_("Guest operating system may have stopped responding."), + default_value=2, + )), + ("heartbeat_intermittend", + MonitoringState( + title=_("Intermittent heartbeat"), + help=_("May be due to high guest load."), + default_value=1, + )), + ("heartbeat_no_tools", + MonitoringState( + title=_("Heartbeat tools missing or not installed"), + help=_("No VMWare Tools installed."), + default_value=1, + )), + ("heartbeat_ok", + MonitoringState( + title=_("Heartbeat OK"), + help=_("Guest operating system is responding normally."), + default_value=0, + )), + ]), + None, + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/windows_printer_queues.py b/cmk/gui/plugins/wato/check_parameters/windows_printer_queues.py new file mode 100644 index 0000000000..b8d1036a1c --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/windows_printer_queues.py @@ -0,0 +1,116 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +from cmk.gui.i18n import _ +from cmk.gui.valuespec import ( + Dictionary, + Integer, + ListChoice, + TextAscii, + Transform, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersPrinters, + register_check_parameters, +) + + +def windows_printer_queues_forth(old): + default = { + "warn_states": [8, 11], + "crit_states": [9, 10], + } + if isinstance(old, tuple): + default['levels'] = old + if isinstance(old, dict): + return old + return default + + +register_check_parameters( + RulespecGroupCheckParametersPrinters, + "windows_printer_queues", + _("Number of open jobs of a printer on windows"), + Transform( + Dictionary( + title=_("Windows Printer Configuration"), + elements=[ + ( + "levels", + Tuple( + title=_("Levels for the number of print jobs"), + help=_("This rule is applied to the number of print jobs " + "currently waiting in windows printer queue."), + elements=[ + Integer(title=_("Warning at"), unit=_("jobs"), default_value=40), + Integer(title=_("Critical at"), unit=_("jobs"), default_value=60), + ]), + ), + ("crit_states", + ListChoice( + title=_("States who should lead to critical"), + choices=[ + (0, "Unkown"), + (1, "Other"), + (2, "No Error"), + (3, "Low Paper"), + (4, "No Paper"), + (5, "Low Toner"), + (6, "No Toner"), + (7, "Door Open"), + (8, "Jammed"), + (9, "Offline"), + (10, "Service Requested"), + (11, "Output Bin Full"), + ], + default_value=[9, 10], + )), + ("warn_states", + ListChoice( + title=_("States who should lead to warning"), + choices=[ + (0, "Unkown"), + (1, "Other"), + (2, "No Error"), + (3, "Low Paper"), + (4, "No Paper"), + (5, "Low Toner"), + (6, "No Toner"), + (7, "Door Open"), + (8, "Jammed"), + (9, "Offline"), + (10, "Service Requested"), + (11, "Output Bin Full"), + ], + default_value=[8, 11], + )), + ]), + forth=windows_printer_queues_forth, + ), + TextAscii(title=_("Printer Name"), allow_empty=True), + match_type="first", +) -- 2.11.4.GIT