From fa370de947ae294d27686a47e2101a9fce0ef722 Mon Sep 17 00:00:00 2001 From: Kenneth Okoh Date: Thu, 17 Jan 2019 14:11:13 +0100 Subject: [PATCH] Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393) Change-Id: I7441e9762ea13a5edaa132797f485ae06d8212db --- .../plugins/wato/check_parameters/asm_diskgroup.py | 63 +++ .../plugins/wato/check_parameters/mssql_backup.py | 93 +++++ .../wato/check_parameters/mssql_backup_per_type.py | 47 +++ .../wato/check_parameters/mssql_file_sizes.py | 76 ++++ .../wato/check_parameters/mssql_page_activity.py | 69 ++++ .../wato/check_parameters/mssql_tablespaces.py | 140 +++++++ .../wato/check_parameters/oracle_instance.py | 107 +++++ .../plugins/wato/check_parameters/oracle_jobs.py | 83 ++++ .../check_parameters/oracle_recovery_status.py | 62 +++ .../plugins/wato/check_parameters/oracle_rman.py | 52 +++ .../wato/check_parameters/oracle_undostat.py | 62 +++ cmk/gui/plugins/wato/check_parameters/unsorted.py | 436 --------------------- 12 files changed, 854 insertions(+), 436 deletions(-) create mode 100644 cmk/gui/plugins/wato/check_parameters/asm_diskgroup.py create mode 100644 cmk/gui/plugins/wato/check_parameters/mssql_backup.py create mode 100644 cmk/gui/plugins/wato/check_parameters/mssql_backup_per_type.py create mode 100644 cmk/gui/plugins/wato/check_parameters/mssql_file_sizes.py create mode 100644 cmk/gui/plugins/wato/check_parameters/mssql_page_activity.py create mode 100644 cmk/gui/plugins/wato/check_parameters/mssql_tablespaces.py create mode 100644 cmk/gui/plugins/wato/check_parameters/oracle_instance.py create mode 100644 cmk/gui/plugins/wato/check_parameters/oracle_jobs.py create mode 100644 cmk/gui/plugins/wato/check_parameters/oracle_recovery_status.py create mode 100644 cmk/gui/plugins/wato/check_parameters/oracle_rman.py create mode 100644 cmk/gui/plugins/wato/check_parameters/oracle_undostat.py diff --git a/cmk/gui/plugins/wato/check_parameters/asm_diskgroup.py b/cmk/gui/plugins/wato/check_parameters/asm_diskgroup.py new file mode 100644 index 0000000000..b0356db9b0 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/asm_diskgroup.py @@ -0,0 +1,63 @@ +#!/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, + DropdownChoice, + TextAscii, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) +from cmk.gui.plugins.wato.check_parameters.utils import filesystem_elements + +register_check_parameters( + RulespecGroupCheckParametersApplications, "asm_diskgroup", + _("ASM Disk Group (used space and growth)"), + Dictionary( + elements=filesystem_elements + [ + ("req_mir_free", + DropdownChoice( + title=_("Handling for required mirror space"), + totext="", + choices=[ + (False, _("Do not regard required mirror space as free space")), + (True, _("Regard required mirror space as free space")), + ], + help=_( + "ASM calculates the free space depending on free_mb or required mirror " + "free space. Enable this option to set the check against required " + "mirror free space. This only works for normal or high redundancy Disk Groups." + ))), + ], + hidden_keys=["flex_levels"], + ), + TextAscii( + title=_("ASM Disk Group"), + help=_("Specify the name of the ASM Disk Group "), + allow_empty=False), "dict") diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_backup.py b/cmk/gui/plugins/wato/check_parameters/mssql_backup.py new file mode 100644 index 0000000000..736ed413fb --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/mssql_backup.py @@ -0,0 +1,93 @@ +#!/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 ( + Age, + Alternative, + Dictionary, + FixedValue, + MonitoringState, + TextAscii, + Transform, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + + +def _vs_mssql_backup_age(title): + return Alternative( + title=_("%s" % title), + style="dropdown", + elements=[ + Tuple( + title=_("Set levels"), + elements=[ + Age(title=_("Warning if older than")), + Age(title=_("Critical if older than")), + ]), + Tuple( + title=_("No levels"), + elements=[ + FixedValue(None, totext=""), + FixedValue(None, totext=""), + ]), + ]) + + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "mssql_backup", + _("MSSQL Backup summary"), + Transform( + Dictionary( + help = _("This rule allows you to set limits on the age of backups for " + "different backup types. If your agent does not support " + "backup types (e.g. Log Backup, Database Diff " + "Backup, etc.) you can use the option Database Backup" + " to set a general limit"), + elements = [ + ("database", _vs_mssql_backup_age("Database backup")), + ("database_diff", _vs_mssql_backup_age("Database diff backup")), + ("log", _vs_mssql_backup_age("Log backup")), + ("file_or_filegroup", _vs_mssql_backup_age("File or filegroup backup")), + ("file_diff", _vs_mssql_backup_age("File diff backup")), + ("partial", _vs_mssql_backup_age("Partial backup")), + ("partial_diff", _vs_mssql_backup_age("Partial diff backup")), + ("unspecific", _vs_mssql_backup_age("Unspecific backup")), + ("not_found", MonitoringState(title=_("State if no backup found"))), + ] + ), + forth = lambda params: (params if isinstance(params, dict) + else {'database': (params[0], params[1])}) + ), + TextAscii( + title = _("Service descriptions"), + allow_empty = False), + "first",) diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_backup_per_type.py b/cmk/gui/plugins/wato/check_parameters/mssql_backup_per_type.py new file mode 100644 index 0000000000..8e7d4e9082 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/mssql_backup_per_type.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, + TextAscii, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) +from cmk.gui.plugins.wato.check_parameters.mssql_backup import _vs_mssql_backup_age + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "mssql_backup_per_type", + _("MSSQL Backup"), + Dictionary(elements=[ + ("levels", _vs_mssql_backup_age("Upper levels for the backup age")), + ]), + TextAscii(title=_("Backup name"), allow_empty=False), + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_file_sizes.py b/cmk/gui/plugins/wato/check_parameters/mssql_file_sizes.py new file mode 100644 index 0000000000..0422cd32f5 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/mssql_file_sizes.py @@ -0,0 +1,76 @@ +#!/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 ( + Alternative, + Dictionary, + Filesize, + Percentage, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, "mssql_file_sizes", + _("MSSQL Log and Data File Sizes"), + Dictionary( + title=_("File Size Levels"), + elements=[ + ("data_files", + Tuple( + title=_("Levels for Datafiles"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")), + ])), + ("log_files", + Tuple( + title=_("Log files: Absolute upper thresholds"), + elements=[Filesize(title=_("Warning at")), + Filesize(title=_("Critical at"))])), + ("log_files_used", + Alternative( + title=_("Levels for log files used"), + elements=[ + Tuple( + title=_("Upper absolute levels"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")) + ]), + Tuple( + title=_("Upper percentage levels"), + elements=[ + Percentage(title=_("Warning at")), + Percentage(title=_("Critical at")) + ]), + ])), + ]), TextAscii(title=_("Service descriptions"), allow_empty=False), "dict") diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_page_activity.py b/cmk/gui/plugins/wato/check_parameters/mssql_page_activity.py new file mode 100644 index 0000000000..4d27a46ae8 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/mssql_page_activity.py @@ -0,0 +1,69 @@ +#!/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, + Float, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "mssql_page_activity", + _("MSSQL Page Activity"), + Dictionary( + title=_("Page Activity Levels"), + elements=[ + ("page_reads/sec", + Tuple( + title=_("Reads/sec"), + elements=[ + Float(title=_("warning at"), unit=_("/sec")), + Float(title=_("critical at"), unit=_("/sec")), + ])), + ("page_writes/sec", + Tuple( + title=_("Writes/sec"), + elements=[ + Float(title=_("warning at"), unit=_("/sec")), + Float(title=_("critical at"), unit=_("/sec")), + ])), + ("page_lookups/sec", + Tuple( + title=_("Lookups/sec"), + elements=[ + Float(title=_("warning at"), unit=_("/sec")), + Float(title=_("critical at"), unit=_("/sec")), + ])), + ]), + TextAscii(title=_("Service descriptions"), allow_empty=False), + match_type="dict") diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_tablespaces.py b/cmk/gui/plugins/wato/check_parameters/mssql_tablespaces.py new file mode 100644 index 0000000000..6b6062fba2 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/mssql_tablespaces.py @@ -0,0 +1,140 @@ +#!/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 ( + Alternative, + Dictionary, + Filesize, + Percentage, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "mssql_tablespaces", + _("MSSQL Size of Tablespace"), + Dictionary( + elements=[ + ("size", + Tuple( + title=_("Upper levels for size"), + elements=[Filesize(title=_("Warning at")), + Filesize(title=_("Critical at"))])), + ("reserved", + Alternative( + title=_("Upper levels for reserved space"), + elements=[ + Tuple( + title=_("Absolute levels"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")) + ]), + Tuple( + title=_("Percentage levels"), + elements=[ + Percentage(title=_("Warning at")), + Percentage(title=_("Critical at")) + ]), + ])), + ("data", + Alternative( + title=_("Upper levels for data"), + elements=[ + Tuple( + title=_("Absolute levels"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")) + ]), + Tuple( + title=_("Percentage levels"), + elements=[ + Percentage(title=_("Warning at")), + Percentage(title=_("Critical at")) + ]), + ])), + ("indexes", + Alternative( + title=_("Upper levels for indexes"), + elements=[ + Tuple( + title=_("Absolute levels"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")) + ]), + Tuple( + title=_("Percentage levels"), + elements=[ + Percentage(title=_("Warning at")), + Percentage(title=_("Critical at")) + ]), + ])), + ("unused", + Alternative( + title=_("Upper levels for unused space"), + elements=[ + Tuple( + title=_("Absolute levels"), + elements=[ + Filesize(title=_("Warning at")), + Filesize(title=_("Critical at")) + ]), + Tuple( + title=_("Percentage levels"), + elements=[ + Percentage(title=_("Warning at")), + Percentage(title=_("Critical at")) + ]), + ])), + ("unallocated", + Alternative( + title=_("Lower levels for unallocated space"), + elements=[ + Tuple( + title=_("Absolute levels"), + elements=[ + Filesize(title=_("Warning below")), + Filesize(title=_("Critical below")) + ]), + Tuple( + title=_("Percentage levels"), + elements=[ + Percentage(title=_("Warning below")), + Percentage(title=_("Critical below")) + ]), + ])), + ],), + TextAscii(title=_("Tablespace name"), allow_empty=False), + match_type="dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/oracle_instance.py b/cmk/gui/plugins/wato/check_parameters/oracle_instance.py new file mode 100644 index 0000000000..5819e3c6b7 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/oracle_instance.py @@ -0,0 +1,107 @@ +#!/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 ( + Age, + Checkbox, + Dictionary, + MonitoringState, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "oracle_instance", + _("Oracle Instance"), + Dictionary( + title=_("Consider state of Archivelogmode: "), + elements=[ + ('archivelog', + MonitoringState( + default_value=0, + title=_("State in case of Archivelogmode is enabled: "), + )), + ( + 'noarchivelog', + MonitoringState( + default_value=1, + title=_("State in case of Archivelogmode is disabled: "), + ), + ), + ( + 'forcelogging', + MonitoringState( + default_value=0, + title=_("State in case of Force Logging is enabled: "), + ), + ), + ( + 'noforcelogging', + MonitoringState( + default_value=1, + title=_("State in case of Force Logging is disabled: "), + ), + ), + ( + 'logins', + MonitoringState( + default_value=2, + title=_("State in case of logins are not possible: "), + ), + ), + ( + 'primarynotopen', + MonitoringState( + default_value=2, + title=_("State in case of Database is PRIMARY and not OPEN: "), + ), + ), + ('uptime_min', + Tuple( + title=_("Minimum required uptime"), + elements=[ + Age(title=_("Warning if below")), + Age(title=_("Critical if below")), + ])), + ('ignore_noarchivelog', + Checkbox( + title=_("Ignore state of no-archive log"), + label=_("Enable"), + help=_("If active, only a single summary item is displayed. The summary " + "will explicitly mention sensors in warn/crit state but the " + "sensors that are ok are aggregated."), + default_value=False)), + ], + ), + TextAscii(title=_("Database SID"), size=12, allow_empty=False), + match_type="dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/oracle_jobs.py b/cmk/gui/plugins/wato/check_parameters/oracle_jobs.py new file mode 100644 index 0000000000..04fe0303a4 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/oracle_jobs.py @@ -0,0 +1,83 @@ +#!/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 ( + Age, + Dictionary, + DropdownChoice, + MonitoringState, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "oracle_jobs", + _("Oracle Scheduler Job"), + Dictionary( + help=_("A scheduler job is an object in an ORACLE database which could be " + "compared to a cron job on Unix. "), + elements=[ + ("run_duration", + Tuple( + title=_("Maximum run duration for last execution"), + help=_("Here you can define an upper limit for the run duration of " + "last execution of the job."), + elements=[ + Age(title=_("warning at")), + Age(title=_("critical at")), + ])), + ("disabled", + DropdownChoice( + title=_("Job State"), + help=_("The state of the job is ignored per default."), + totext="", + choices=[ + (True, _("Ignore the state of the Job")), + (False, _("Consider the state of the job")), + ], + )), + ("status_disabled_jobs", + MonitoringState(title="Status of service in case of disabled job", default_value=0)), + ("status_missing_jobs", + MonitoringState( + title=_("Status of service in case of missing job."), + default_value=2, + )), + ]), + TextAscii( + title=_("Scheduler Job Name"), + help=_("Here you can set explicit Scheduler-Jobs by defining them via SID, Job-Owner " + "and Job-Name, separated by a dot, for example TUX12C.SYS.PURGE_LOG"), + regex=r'.+\..+', + allow_empty=False), + match_type="dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/oracle_recovery_status.py b/cmk/gui/plugins/wato/check_parameters/oracle_recovery_status.py new file mode 100644 index 0000000000..a1d20a56c3 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/oracle_recovery_status.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 ( + Age, + Dictionary, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "oracle_recovery_status", + _("Oracle Recovery Status"), + Dictionary(elements=[("levels", + Tuple( + title=_("Levels for checkpoint time"), + elements=[ + Age(title=_("warning if higher then"), default_value=1800), + Age(title=_("critical if higher then"), default_value=3600), + ])), + ("backup_age", + Tuple( + title=_("Levels for user managed backup files"), + help=_("Important! This checks is only for monitoring of datafiles " + "who were left in backup mode. " + "(alter database datafile ... begin backup;) "), + elements=[ + Age(title=_("warning if higher then"), default_value=1800), + Age(title=_("critical if higher then"), default_value=3600), + ]))]), + TextAscii(title=_("Database SID"), size=12, allow_empty=False), + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/oracle_rman.py b/cmk/gui/plugins/wato/check_parameters/oracle_rman.py new file mode 100644 index 0000000000..001b731b60 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/oracle_rman.py @@ -0,0 +1,52 @@ +#!/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 ( + Age, + Dictionary, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "oracle_rman", + _("Oracle RMAN Backups"), + Dictionary(elements=[("levels", + Tuple( + title=_("Maximum Age for RMAN backups"), + elements=[ + Age(title=_("warning if older than"), default_value=1800), + Age(title=_("critical if older than"), default_value=3600), + ]))]), + TextAscii(title=_("Database SID"), size=12, allow_empty=False), + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/oracle_undostat.py b/cmk/gui/plugins/wato/check_parameters/oracle_undostat.py new file mode 100644 index 0000000000..7b3df00ec4 --- /dev/null +++ b/cmk/gui/plugins/wato/check_parameters/oracle_undostat.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 ( + Age, + Dictionary, + MonitoringState, + TextAscii, + Tuple, +) +from cmk.gui.plugins.wato import ( + RulespecGroupCheckParametersApplications, + register_check_parameters, +) + +register_check_parameters( + RulespecGroupCheckParametersApplications, + "oracle_undostat", + _("Oracle Undo Retention"), + Dictionary(elements=[ + ("levels", + Tuple( + title=_("Levels for remaining undo retention"), + elements=[ + Age(title=_("warning if less then"), default_value=600), + Age(title=_("critical if less then"), default_value=300), + ])), + ( + 'nospaceerrcnt_state', + MonitoringState( + default_value=2, + title=_("State in case of non space error count is greater then 0: "), + ), + ), + ]), + TextAscii(title=_("Database SID"), size=12, allow_empty=False), + "dict", +) diff --git a/cmk/gui/plugins/wato/check_parameters/unsorted.py b/cmk/gui/plugins/wato/check_parameters/unsorted.py index 9d05dc35ef..c1725cd93f 100644 --- a/cmk/gui/plugins/wato/check_parameters/unsorted.py +++ b/cmk/gui/plugins/wato/check_parameters/unsorted.py @@ -77,7 +77,6 @@ from cmk.gui.plugins.wato.check_parameters.utils import ( match_dual_level_type, get_free_used_dynamic_valuespec, transform_filesystem_free, - filesystem_elements, ) # TODO: Sort all rules and check parameters into the figlet header sections. @@ -1246,441 +1245,6 @@ register_rule( match='all', ) -register_check_parameters( - RulespecGroupCheckParametersApplications, - "oracle_undostat", - _("Oracle Undo Retention"), - Dictionary(elements=[ - ("levels", - Tuple( - title=_("Levels for remaining undo retention"), - elements=[ - Age(title=_("warning if less then"), default_value=600), - Age(title=_("critical if less then"), default_value=300), - ])), - ( - 'nospaceerrcnt_state', - MonitoringState( - default_value=2, - title=_("State in case of non space error count is greater then 0: "), - ), - ), - ]), - TextAscii(title=_("Database SID"), size=12, allow_empty=False), - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "oracle_rman", - _("Oracle RMAN Backups"), - Dictionary(elements=[("levels", - Tuple( - title=_("Maximum Age for RMAN backups"), - elements=[ - Age(title=_("warning if older than"), default_value=1800), - Age(title=_("critical if older than"), default_value=3600), - ]))]), - TextAscii(title=_("Database SID"), size=12, allow_empty=False), - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "oracle_recovery_status", - _("Oracle Recovery Status"), - Dictionary(elements=[("levels", - Tuple( - title=_("Levels for checkpoint time"), - elements=[ - Age(title=_("warning if higher then"), default_value=1800), - Age(title=_("critical if higher then"), default_value=3600), - ])), - ("backup_age", - Tuple( - title=_("Levels for user managed backup files"), - help=_("Important! This checks is only for monitoring of datafiles " - "who were left in backup mode. " - "(alter database datafile ... begin backup;) "), - elements=[ - Age(title=_("warning if higher then"), default_value=1800), - Age(title=_("critical if higher then"), default_value=3600), - ]))]), - TextAscii(title=_("Database SID"), size=12, allow_empty=False), - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "oracle_jobs", - _("Oracle Scheduler Job"), - Dictionary( - help=_("A scheduler job is an object in an ORACLE database which could be " - "compared to a cron job on Unix. "), - elements=[ - ("run_duration", - Tuple( - title=_("Maximum run duration for last execution"), - help=_("Here you can define an upper limit for the run duration of " - "last execution of the job."), - elements=[ - Age(title=_("warning at")), - Age(title=_("critical at")), - ])), - ("disabled", - DropdownChoice( - title=_("Job State"), - help=_("The state of the job is ignored per default."), - totext="", - choices=[ - (True, _("Ignore the state of the Job")), - (False, _("Consider the state of the job")), - ], - )), - ("status_disabled_jobs", - MonitoringState(title="Status of service in case of disabled job", default_value=0)), - ("status_missing_jobs", - MonitoringState( - title=_("Status of service in case of missing job."), - default_value=2, - )), - ]), - TextAscii( - title=_("Scheduler Job Name"), - help=_("Here you can set explicit Scheduler-Jobs by defining them via SID, Job-Owner " - "and Job-Name, separated by a dot, for example TUX12C.SYS.PURGE_LOG"), - regex=r'.+\..+', - allow_empty=False), - match_type="dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "oracle_instance", - _("Oracle Instance"), - Dictionary( - title=_("Consider state of Archivelogmode: "), - elements=[ - ('archivelog', - MonitoringState( - default_value=0, - title=_("State in case of Archivelogmode is enabled: "), - )), - ( - 'noarchivelog', - MonitoringState( - default_value=1, - title=_("State in case of Archivelogmode is disabled: "), - ), - ), - ( - 'forcelogging', - MonitoringState( - default_value=0, - title=_("State in case of Force Logging is enabled: "), - ), - ), - ( - 'noforcelogging', - MonitoringState( - default_value=1, - title=_("State in case of Force Logging is disabled: "), - ), - ), - ( - 'logins', - MonitoringState( - default_value=2, - title=_("State in case of logins are not possible: "), - ), - ), - ( - 'primarynotopen', - MonitoringState( - default_value=2, - title=_("State in case of Database is PRIMARY and not OPEN: "), - ), - ), - ('uptime_min', - Tuple( - title=_("Minimum required uptime"), - elements=[ - Age(title=_("Warning if below")), - Age(title=_("Critical if below")), - ])), - ('ignore_noarchivelog', - Checkbox( - title=_("Ignore state of no-archive log"), - label=_("Enable"), - help=_("If active, only a single summary item is displayed. The summary " - "will explicitly mention sensors in warn/crit state but the " - "sensors that are ok are aggregated."), - default_value=False)), - ], - ), - TextAscii(title=_("Database SID"), size=12, allow_empty=False), - match_type="dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, "asm_diskgroup", - _("ASM Disk Group (used space and growth)"), - Dictionary( - elements=filesystem_elements + [ - ("req_mir_free", - DropdownChoice( - title=_("Handling for required mirror space"), - totext="", - choices=[ - (False, _("Do not regard required mirror space as free space")), - (True, _("Regard required mirror space as free space")), - ], - help=_( - "ASM calculates the free space depending on free_mb or required mirror " - "free space. Enable this option to set the check against required " - "mirror free space. This only works for normal or high redundancy Disk Groups." - ))), - ], - hidden_keys=["flex_levels"], - ), - TextAscii( - title=_("ASM Disk Group"), - help=_("Specify the name of the ASM Disk Group "), - allow_empty=False), "dict") - - -def _vs_mssql_backup_age(title): - return Alternative( - title=_("%s" % title), - style="dropdown", - elements=[ - Tuple( - title=_("Set levels"), - elements=[ - Age(title=_("Warning if older than")), - Age(title=_("Critical if older than")), - ]), - Tuple( - title=_("No levels"), - elements=[ - FixedValue(None, totext=""), - FixedValue(None, totext=""), - ]), - ]) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "mssql_backup", - _("MSSQL Backup summary"), - Transform( - Dictionary( - help = _("This rule allows you to set limits on the age of backups for " - "different backup types. If your agent does not support " - "backup types (e.g. Log Backup, Database Diff " - "Backup, etc.) you can use the option Database Backup" - " to set a general limit"), - elements = [ - ("database", _vs_mssql_backup_age("Database backup")), - ("database_diff", _vs_mssql_backup_age("Database diff backup")), - ("log", _vs_mssql_backup_age("Log backup")), - ("file_or_filegroup", _vs_mssql_backup_age("File or filegroup backup")), - ("file_diff", _vs_mssql_backup_age("File diff backup")), - ("partial", _vs_mssql_backup_age("Partial backup")), - ("partial_diff", _vs_mssql_backup_age("Partial diff backup")), - ("unspecific", _vs_mssql_backup_age("Unspecific backup")), - ("not_found", MonitoringState(title=_("State if no backup found"))), - ] - ), - forth = lambda params: (params if isinstance(params, dict) - else {'database': (params[0], params[1])}) - ), - TextAscii( - title = _("Service descriptions"), - allow_empty = False), - "first", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "mssql_backup_per_type", - _("MSSQL Backup"), - Dictionary(elements=[ - ("levels", _vs_mssql_backup_age("Upper levels for the backup age")), - ]), - TextAscii(title=_("Backup name"), allow_empty=False), - "dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, "mssql_file_sizes", - _("MSSQL Log and Data File Sizes"), - Dictionary( - title=_("File Size Levels"), - elements=[ - ("data_files", - Tuple( - title=_("Levels for Datafiles"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")), - ])), - ("log_files", - Tuple( - title=_("Log files: Absolute upper thresholds"), - elements=[Filesize(title=_("Warning at")), - Filesize(title=_("Critical at"))])), - ("log_files_used", - Alternative( - title=_("Levels for log files used"), - elements=[ - Tuple( - title=_("Upper absolute levels"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")) - ]), - Tuple( - title=_("Upper percentage levels"), - elements=[ - Percentage(title=_("Warning at")), - Percentage(title=_("Critical at")) - ]), - ])), - ]), TextAscii(title=_("Service descriptions"), allow_empty=False), "dict") - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "mssql_tablespaces", - _("MSSQL Size of Tablespace"), - Dictionary( - elements=[ - ("size", - Tuple( - title=_("Upper levels for size"), - elements=[Filesize(title=_("Warning at")), - Filesize(title=_("Critical at"))])), - ("reserved", - Alternative( - title=_("Upper levels for reserved space"), - elements=[ - Tuple( - title=_("Absolute levels"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")) - ]), - Tuple( - title=_("Percentage levels"), - elements=[ - Percentage(title=_("Warning at")), - Percentage(title=_("Critical at")) - ]), - ])), - ("data", - Alternative( - title=_("Upper levels for data"), - elements=[ - Tuple( - title=_("Absolute levels"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")) - ]), - Tuple( - title=_("Percentage levels"), - elements=[ - Percentage(title=_("Warning at")), - Percentage(title=_("Critical at")) - ]), - ])), - ("indexes", - Alternative( - title=_("Upper levels for indexes"), - elements=[ - Tuple( - title=_("Absolute levels"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")) - ]), - Tuple( - title=_("Percentage levels"), - elements=[ - Percentage(title=_("Warning at")), - Percentage(title=_("Critical at")) - ]), - ])), - ("unused", - Alternative( - title=_("Upper levels for unused space"), - elements=[ - Tuple( - title=_("Absolute levels"), - elements=[ - Filesize(title=_("Warning at")), - Filesize(title=_("Critical at")) - ]), - Tuple( - title=_("Percentage levels"), - elements=[ - Percentage(title=_("Warning at")), - Percentage(title=_("Critical at")) - ]), - ])), - ("unallocated", - Alternative( - title=_("Lower levels for unallocated space"), - elements=[ - Tuple( - title=_("Absolute levels"), - elements=[ - Filesize(title=_("Warning below")), - Filesize(title=_("Critical below")) - ]), - Tuple( - title=_("Percentage levels"), - elements=[ - Percentage(title=_("Warning below")), - Percentage(title=_("Critical below")) - ]), - ])), - ],), - TextAscii(title=_("Tablespace name"), allow_empty=False), - match_type="dict", -) - -register_check_parameters( - RulespecGroupCheckParametersApplications, - "mssql_page_activity", - _("MSSQL Page Activity"), - Dictionary( - title=_("Page Activity Levels"), - elements=[ - ("page_reads/sec", - Tuple( - title=_("Reads/sec"), - elements=[ - Float(title=_("warning at"), unit=_("/sec")), - Float(title=_("critical at"), unit=_("/sec")), - ])), - ("page_writes/sec", - Tuple( - title=_("Writes/sec"), - elements=[ - Float(title=_("warning at"), unit=_("/sec")), - Float(title=_("critical at"), unit=_("/sec")), - ])), - ("page_lookups/sec", - Tuple( - title=_("Lookups/sec"), - elements=[ - Float(title=_("warning at"), unit=_("/sec")), - Float(title=_("critical at"), unit=_("/sec")), - ])), - ]), - TextAscii(title=_("Service descriptions"), allow_empty=False), - match_type="dict") - def levels_absolute_or_dynamic(name, value): return Alternative( -- 2.11.4.GIT