Module: check_mk
Branch: master
Commit: 202144b4532742aae36ef6551e5d4892ccff076c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=202144b4532742…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 27 14:21:09 2011 +0100
oracle_logswitches: new check for oracle logswitches
---
ChangeLog | 2 +
checkman/oracle_logswitches | 41 +++++++++++++++++++++++++++++++++
checks/oracle_logswitches | 53 +++++++++++++++++++++++++++++++++++++++++++
checks/oracle_sessions | 4 +-
4 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e6dd36f..2f81b6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,8 @@
on Linux, but easily portable to other Unices)
* oracle_sessions: new check for monitoring the current number of active
database sessions.
+ * oracle_logswitches: new check for monitoring the number of logswitches
+ of an ORACLE instances in the last 60 minutes.
1.1.9i5:
Multisite:
diff --git a/checkman/oracle_logswitches b/checkman/oracle_logswitches
new file mode 100644
index 0000000..77623db
--- /dev/null
+++ b/checkman/oracle_logswitches
@@ -0,0 +1,41 @@
+title: Check log switch activity of ORACLE database
+agents: linux
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the number of log switches of an ORACLE
+ database instance in the last 60 minutes. You can set levels
+ for upper and lower bounds.
+
+ This check needs the Check_MK {mk_oracle}-plugin installed in
+ the agent. Please refer to the online documentation
+ for how to install that plugin.
+
+item:
+ The SID of the database (as appearing in the process
+ name of the pmon_... process).
+
+examples:
+ # Set global default values. Make it critical if there
+ # is only 1 or 0 logswitches or 100 or more in the last
+ # hour.
+ oracle_logswitches_default_levels = (1, 3, 30 100)
+
+perfdata:
+ One value: the number of log switches in the last 60 minutes.
+
+inventory:
+ One separate check for each database found running will
+ be created.
+
+[parameters]
+lo_crit(int): The check will get critical if only that many (or fewer) log switches
appeared in the
+ last 60 minutes. Set this to {-1} in order to disable this bound.
+lo_warn(int): Lower warning level.
+hi_warn(int): Make the check warn if there were at least that many log switches in the
last 60 minutes.
+hi_crit(int): Upper critical level.
+
+[configuration]
+oracle_logswitches_default_levels(int, int, int, int): Global default levels used for all
checks which have no specific configuration. This is preset to {(-1, -1, 50, 100)}.
+
diff --git a/checks/oracle_logswitches b/checks/oracle_logswitches
new file mode 100644
index 0000000..a1d524d
--- /dev/null
+++ b/checks/oracle_logswitches
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)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-
+# ails. 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.
+
+# <<<oracle_logswitches>>>
+# pengt 15
+# hirni 22
+
+oracle_logswitches_default_levels = (-1, -1, 50, 100)
+
+def inventory_oracle_logswitches(checkname, info):
+ return [ (line[0], "oracle_logswitches_default_levels") for line in info if
len(line) >= 2 ]
+
+def check_oracle_logswitches(item, params, info):
+ for line in info:
+ if line[0] == item:
+ locrit, lowarn, warn, crit = params
+ logswitches = int(line[1])
+ infotext = " - %d log switches in the last 60 minutes (levels at %d/%d
.. %d/%d)" \
+ % (logswitches, locrit, lowarn, warn, crit)
+ perfdata = [("logswitches", logswitches, warn, crit)]
+ if logswitches >= crit or logswitches <= locrit:
+ return (2, "CRIT" + infotext, perfdata)
+ elif logswitches >= warn or logswitches <= lowarn:
+ return (1, "WARN" + infotext, perfdata)
+ else:
+ return (0, "OK" + infotext, perfdata)
+ return (2, "UNKNOWN - Database not existing or not running")
+
+check_info['oracle_logswitches'] = (check_oracle_logswitches, "ORA %s
Logswitches", 1, inventory_oracle_logswitches )
+
diff --git a/checks/oracle_sessions b/checks/oracle_sessions
index 706f211..d71a67d 100644
--- a/checks/oracle_sessions
+++ b/checks/oracle_sessions
@@ -38,7 +38,7 @@ def check_oracle_sessions(item, params, info):
if line[0] == item:
warn, crit = params
sessions = int(line[1])
- infotext = " - %d active sessions" % sessions
+ infotext = " - %d active sessions (levels at %d/%d)" % (sessions,
warn, crit)
perfdata = [("sessions", sessions, warn, crit)]
if sessions >= crit:
return (2, "CRIT" + infotext, perfdata)
@@ -46,7 +46,7 @@ def check_oracle_sessions(item, params, info):
return (1, "WARN" + infotext, perfdata)
else:
return (0, "OK" + infotext, perfdata)
- return (2, "UNKNOWN - Database not existant or not running")
+ return (2, "UNKNOWN - Database not existing or not running")
check_info['oracle_sessions'] = (check_oracle_sessions, "ORA %s
Sessions", 1, inventory_oracle_sessions )