Module: check_mk
Branch: master
Commit: c73e1f218bd7dbfd08c7a83a803be5675b8f65e0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c73e1f218bd7db…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 09:42:58 2011 +0100
Updated bug entries
---
.bugs/113 | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/.bugs/113 b/.bugs/113
new file mode 100644
index 0000000..54d7495
--- /dev/null
+++ b/.bugs/113
@@ -0,0 +1,12 @@
+Title: Scale down PNP graphs to 50% as display option
+Component: multisite
+Benefit: 2
+State: open
+Cost: 1
+Date: 2011-01-28 09:41:38
+Class: feature
+
+We could introduce a display option for the PNP inline graphs, that
+scales down the graph by 25%, 50%, 66% or whatever percent, so that
+more graphs can be displayed on a one screen. The question is: can
+an <img> tag have a relative size option, like 50%?
Module: check_mk
Branch: master
Commit: 88d580b7f1b92053631069c623d43e98e731f04b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=88d580b7f1b920…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 10:18:32 2011 +0100
Fix bug 109: Nagios does not any longer inherit FDs from Apache
So a restart of Apache after a WATO reload is possible again
in OMD.
---
.bugs/109 | 11 ++++++++---
modules/check_mk.py | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.bugs/109 b/.bugs/109
index 3540e9b..47e3e8d 100644
--- a/.bugs/109
+++ b/.bugs/109
@@ -1,10 +1,11 @@
Title: Restart of Nagios makes Nagios inherit TCP port
Component: wato
+State: done
+Class: bug
+Date: 2011-01-26 09:12:21
Benefit: 4
-State: open
Cost: 2
-Date: 2011-01-26 09:12:21
-Class: bug
+Fun: 0
If you restart Nagios via WATO, then Apache restarts Nagios
und the new Nagios process inherits the open files of Apache.
@@ -14,3 +15,7 @@ makes it impossible to restart apache later.
Solution unclear. Either user reload instead of restart or
try to explicitely close all filedescriptors after forking.
But how can we do that?
+
+2011-01-28 10:18:26: changed state open -> done
+Fixed in modules/check_mk.py. We close all filedescriptors from 3..256 before
+restarting Nagios.
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 755bc6e..208307b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3654,8 +3654,23 @@ def automation_delete_host(args):
os.system("rm -rf '%s'" % path)
def automation_restart():
+ # make sure, Nagios does not inherit any open
+ # filedescriptors. This really happens, e.g. if
+ # check_mk is called by WATO via Apache. Nagios inherits
+ # the open file where Apache is listening for incoming
+ # HTTP connections. Really.
+ os.closerange(3, 256)
+
+ class fake_file():
+ def write(self, stuff):
+ pass
+ def flush(self):
+ pass
+
+ # Deactivate stdout by introducing fake file without filedescriptor
old_stdout = sys.stdout
- sys.stdout = file('/dev/null', 'w')
+ sys.stdout = fake_file()
+
try:
if os.path.exists(nagios_objects_file):
backup_path = nagios_objects_file + ".save"
Module: check_mk
Branch: master
Commit: 77c2883368881528b81bf618ceb441943dcf1b93
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=77c28833688815…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 11:55:18 2011 +0100
oracle_tablespaces: refined check logic
---
checkman/oracle_tablespaces | 49 ++++++++++++++++++++++-----
checks/oracle_tablespaces | 79 +++++++++++++++++++++++++++++-------------
2 files changed, 94 insertions(+), 34 deletions(-)
diff --git a/checkman/oracle_tablespaces b/checkman/oracle_tablespaces
index 3df7638..f94aa09 100644
--- a/checkman/oracle_tablespaces
+++ b/checkman/oracle_tablespaces
@@ -1,4 +1,4 @@
-title: Check size, state and auto extension of ORACLE tablespaces
+title: Check various aspects of ORACLE tablespaces
agents: linux
author: Mathias Kettner <mk(a)mathias-kettner.de>
license: GPL
@@ -6,7 +6,8 @@ distribution: check_mk
description:
This check monitors the state of ORACLE tablespaces. It
checks the current and maximum size, the online state
- and the autoextension.
+ and the autoextension and optionally the setting of
+ the increment size.
{Autoextension}: During inventory the autoextension
setting is determined and frozen into the check parameter.
@@ -15,18 +16,31 @@ description:
consist of several data files with different settings.
If at least one data file has auto extension turned on,
the table space is considered to have auto extension
- turned on.
+ turned on. You can turn off auto extension checking
+ by setting the first check parameter to {None} rather
+ then to {True} or {False}. Inventory will do this for
+ you if you set {oracle_tablespaces_check_autoext} to {False}.
- {State}: Only table spaces in state {ONLINE} will be
- found by inventory and monitored. If the state changes
- later, the check will get critical.
+ {Increment size}: If the configuration parameter
+ {oracle_tablespaces_check_default_increment} is set to
+ {True} (which is the defaut), then the check will warn
+ you, if the increment size is set to the ORACLE default
+ value of {1} (which is generally considered as a non-optimal
+ setting).
+
+ {State}: Only table spaces in state {ONLINE} and {READONLY}
+ will be found by inventory and monitored. If the state changes
+ later, the check will {not} get critical. The state will
+ just be displayed. We assume that state changes are due
+ to normal operations.
{Size}: The logic of the size check depends on whether
autoextend is on or off. If auto extension is on, then
the still possible extensions are accounted for as free
spaces as well as the space currently free in the
data files. If auto extension is off, only the currently
- free space will be honored.
+ free space will be honored. Table spaces in state {READONLY}
+ will {not} be checked for the size.
This check needs the Check_MK {mk_oracle}-plugin installed in
the agent. Please refer to the online documentation
@@ -52,9 +66,26 @@ inventory:
[parameters]
autoextend(bool): Either {True} or {False} - depending on
wether auto extension is expected to be on or off.
-warn(int / float): Warning level for free space. If this is a float, it is considered as percentage of the maximum size of the tablespace. If it is an integer, it is considered to be MB of free space. If the space drops to this level or below, the check will get into warning state.
+warn(int / float): Warning level for free space. If this is a float,
+ it is considered as percentage of the maximum size of the tablespace.
+ If it is an integer, it is considered to be MB of free space. If the
+ space drops to this level or below, the check will get into warning state.
crit(int / float): The critical level for free space.
[configuration]
-oracle_tablespaces_default_levels(int/float, int/float): The default warning and critical levels used for inventorized checks. This is preset to {(10.0, 5.0)}.
+oracle_tablespaces_default_levels(int/float, int/float): The default warning and critical levels
+ used for inventorized checks. This is preset to {(10.0, 5.0)}.
+
+oracle_tablespaces_check_autoext(bool): This boolean setting determines, whether
+ inventory should activate monitoring of the auto extension setting. Per default
+ this is set to {True}, so the current state of the auto extension will be
+ put into the check parameters as either {True} or {False}. If you set the
+ configuration variable to {False}, then inventory will enter {None} as
+ check parameter und thus disable the checking of the auto extensible flag
+ for newly inventorized table spaces.
+oracle_tablespaces_check_default_increment(bool): This setting does not
+ control inventory but is used live during the checking und thus affects
+ all checks, not only newly inventorized ones. Per default it is set to
+ {True}. That way the check will warn if the table space has its increment
+ size set to {1} (the ORACLE default value).
diff --git a/checks/oracle_tablespaces b/checks/oracle_tablespaces
index 26e8f9d..f244538 100644
--- a/checks/oracle_tablespaces
+++ b/checks/oracle_tablespaces
@@ -50,19 +50,31 @@
# integer: MB.
oracle_tablespaces_default_levels = (10.0, 5.0)
+# Whether to check auto extend settings
+oracle_tablespaces_check_autoext = True
+
+# Whether to check default increment size
+oracle_tablespaces_check_default_increment = True
def inventory_oracle_tablespaces(checkname, info):
tablespaces = set([])
autoextensible = set([])
for line in info:
ts = (line[0], line[2])
- if line[11] == "ONLINE":
+ if line[11] in [ "ONLINE", "READONLY" ]:
tablespaces.add(ts)
if line[4] == "YES":
autoextensible.add(ts)
- return [("%s.%s" % t,
- "(%s, oracle_tablespaces_default_levels[0], oracle_tablespaces_default_levels[1])" % (t in autoextensible))
- for t in tablespaces]
+
+ inventory = []
+ for t in tablespaces:
+ if oracle_tablespaces_check_autoext:
+ ae = t in autoextensible
+ else:
+ ae = None # means: ignore, only display setting
+ inventory.append( ("%s.%s" % t,
+ "(%s, oracle_tablespaces_default_levels[0], oracle_tablespaces_default_levels[1])" % ae))
+ return inventory
def check_oracle_tablespaces(item, params, info):
sid, tbsname = item.split('.')
@@ -77,12 +89,14 @@ def check_oracle_tablespaces(item, params, info):
increment_size = 0
free_space = 0
+ uses_default_increment = False
+
for line in info:
if line[0] == sid and line[2] == tbsname:
ts_status = line[11]
blocksize = int(line[10])
num_files += 1
- if line[3] in [ "AVAILABLE", "ONLINE" ]:
+ if line[3] in [ "AVAILABLE", "ONLINE", "READONLY" ]:
num_avail += 1
current_size += blocksize * int(line[5])
used += blocksize * int(line[7])
@@ -93,6 +107,8 @@ def check_oracle_tablespaces(item, params, info):
max_size += my_max_size
free_bl = int(line[6]) - int(line[5]) # number of free extension blocks
incsize = int(line[8]) # size of next increment in blocks
+ if incsize == 1:
+ uses_default_increment = True
incs = free_bl / incsize
num_increments += incs
increment_size += blocksize * incsize * incs
@@ -107,11 +123,9 @@ def check_oracle_tablespaces(item, params, info):
if ts_status == None:
return (3, "UNKNOWN - Tablespace not found")
- if ts_status != "ONLINE":
- return (2, "CRIT - Tablespace is not online, but %s" % ts_status)
-
- infotext = " - size %s, used %s" % \
- (get_bytes_human_readable(current_size),
+ infotext = " - %s, size %s, used %s" % \
+ (ts_status,
+ get_bytes_human_readable(current_size),
get_bytes_human_readable(used))
if num_extensible > 0:
@@ -121,12 +135,25 @@ def check_oracle_tablespaces(item, params, info):
status = 0
autoext, warn, crit = params
- if autoext and num_extensible == 0:
- infotext += ", Autoextend is off!!"
- status = 2
- elif not autoext and num_extensible > 0:
- infotext += ", Autotextend is on!!"
- status = 2
+
+ # Check increment size, should not be set to default (1)
+ if oracle_tablespaces_check_default_increment:
+ if uses_default_increment:
+ infotext += ", DEFAULT INCREMENT!"
+ status = 1
+
+ # Check autoextend status if parameter not set to None
+ if autoext != None:
+ if autoext and num_extensible == 0:
+ infotext += ", AUTOEXTEND!!"
+ status = 2
+ elif not autoext and num_extensible > 0:
+ infotext += ", NO AUTOTEXTEND!!"
+ status = 2
+ elif num_extensible > 0:
+ infotext += ", autoextend"
+ else:
+ infotext += ", no autoextend"
# warn/crit level are float => percentages of max size, otherwise MB
if type(warn) == float:
@@ -139,14 +166,16 @@ def check_oracle_tablespaces(item, params, info):
else:
crit *= 1024 * 1024
- if free_space <= crit or free_space <= warn:
- infotext += ", only %s left" % get_bytes_human_readable(free_space)
- infotext += " (levels at %s/%s)" % (
- get_bytes_human_readable(warn), get_bytes_human_readable(crit))
- if free_space <= crit:
- status = 2
- else:
- status = max(1, status)
+ # Check free space, but only if status is not READONLY
+ if ts_status != "READONLY":
+ if free_space <= crit or free_space <= warn:
+ infotext += ", only %s left" % get_bytes_human_readable(free_space)
+ infotext += " (levels at %s/%s)" % (
+ get_bytes_human_readable(warn), get_bytes_human_readable(crit))
+ if free_space <= crit:
+ status = 2
+ else:
+ status = max(1, status)
perfdata = [ ("size", current_size, max_size - warn, max_size - crit),
("used", used),
@@ -158,4 +187,4 @@ def check_oracle_tablespaces(item, params, info):
return (status, nagios_state_names[status] + infotext, perfdata)
check_info['oracle_tablespaces'] = (check_oracle_tablespaces, "ORA %s Tablespace", 1, inventory_oracle_tablespaces )
-
+check_config_variables.append("oracle_tablespaces_check_default_increment")
Module: check_mk
Branch: master
Commit: 9db80eb331300317174fa8b5fb38e083b33d0d0d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9db80eb3313003…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 27 12:44:12 2011 +0100
mk_oracle: new oracle agent plugin and first check
---
ChangeLog | 5 +++-
agents/plugins/mk_oracle | 64 +++++++++++++++++++++++++++++++++++++++++++++
agents/plugins/sqlplus.sh | 22 +++++++++++++++
checkman/oracle_sessions | 42 +++++++++++++++++++++++++++++
checks/oracle_sessions | 52 ++++++++++++++++++++++++++++++++++++
5 files changed, 184 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 73bcea5..e6dd36f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,7 +19,10 @@
* hpux_serviceguard: new check for monitoring HP-UX Serviceguard
* drbd: Fixed var typo which prevented inventory of drbd general check
(Thanks to Andreas Behler)
-
+ * mk_oracle: new agent plugin for monitoring ORACLE (currently only
+ on Linux, but easily portable to other Unices)
+ * oracle_sessions: new check for monitoring the current number of active
+ database sessions.
1.1.9i5:
Multisite:
diff --git a/agents/plugins/mk_oracle b/agents/plugins/mk_oracle
new file mode 100644
index 0000000..3f080b0
--- /dev/null
+++ b/agents/plugins/mk_oracle
@@ -0,0 +1,64 @@
+#!/bin/sh
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+# Check_MK agent plugin for monitoring ORACLE databases
+
+# Get list of all running databases
+SIDS=$(UNIX95=true ps ax -o args | sed -n '/^ora_pmon_\([^ ]*\)/s//\1/p')
+if [ -z "$SIDS" ] ; then exit 0 ; fi
+
+# Make an sqlplus query, clean up the result and add an artificial
+# column with the SID at the front of each line. If the query fails,
+# no output at all is made.
+function sqlplus ()
+{
+ OUTPUT=$({ echo 'set pages 0' ; echo 'set lines 8000' ; cat ; } | $MK_CONFDIR/sqlplus.sh $1) || return 1
+ echo "${OUTPUT}" | sed -e 's/[[:space:]]\+/ /g' -e '/^[[:space:]]*$/d' -e "s/^/$1 /"
+}
+
+# Sessions
+echo '<<<oracle_sessions>>>'
+for SID in $SIDS
+do
+ echo "select count(*) from v"'$'"session where status = 'ACTIVE';" | sqlplus "$SID"
+done
+
+echo '<<<oracle_logswitches>>>'
+for SID in $SIDS
+do
+ sqlplus "$SID" <<EOF
+select count(*) from v\$loghist where first_time > sysdate - 1/24;
+EOF
+done
+
+# Tablespaces
+echo '<<<oracle_tablespaces>>>'
+for SID in $SIDS
+do
+ sqlplus "$SID" <<EOF
+select f.file_name, f.tablespace_name, f.status, f.AUTOEXTENSIBLE, f.blocks, f.maxblocks, f.USER_BLOCKS, f.INCREMENT_BY, f.ONLINE_STATUS, t.BLOCK_SIZE, t.status from dba_data_files f, dba_tablespaces t where f.tablespace_name = t.tablespace_name;
+EOF
+done
+
diff --git a/agents/plugins/sqlplus.sh b/agents/plugins/sqlplus.sh
new file mode 100755
index 0000000..929eab6
--- /dev/null
+++ b/agents/plugins/sqlplus.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script is called by the Check_MK ORACLE plugin in order to
+# execute an SQL query.
+
+# It is your task to adapt this script so that the ORACLE environment
+# is setup and the correct user chosen to execute sqlplus.
+
+# The script we get the query on stdin and shall output the
+# result on stdout. Error messages goes to stderr.
+
+ORACLE_SID=$1
+if [ -z "$ORACLE_SID" ] ; then
+ echo "Usage: $0 ORACLE_SID" >&2
+ exit 1
+fi
+
+su - nagios -c "
+ORACLE_SID=$ORACLE_SID
+ORAENV_ASK=NO
+. /usr/local/bin/oraenv
+sqlplus -s /"
diff --git a/checkman/oracle_sessions b/checkman/oracle_sessions
new file mode 100644
index 0000000..5f2571d
--- /dev/null
+++ b/checkman/oracle_sessions
@@ -0,0 +1,42 @@
+title: Check number of active sessions in ORACLE database
+agents: linux
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the number of active sessions in an
+ ORACLE database. You can set warn/crit levels.
+
+ 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 to 20 sessions for
+ # warning and 100 sessions for critical
+ oracle_sessions_default_levels = (20, 100)
+
+ # Set higher levels for productive systems
+ # (having the host tag 'prod')
+ check_parameters += [
+ ( (80, 160), [ 'prod' ], ALL_HOSTS, [ "ORA .* sessions" ])
+ ]
+
+perfdata:
+ One value: the current number of active sessions.
+
+inventory:
+ One separate check for each database found running will
+ be created.
+
+[parameters]
+warning(int): The number of active sessions triggering a warning
+critical(int): The number of active sessions making the check critical
+
+[configuration]
+oracle_sessions_default_levels(int, int): Global default levels used for all checks which have no specific configuration. This is preset to {(50, 100)}.
+
diff --git a/checks/oracle_sessions b/checks/oracle_sessions
new file mode 100644
index 0000000..706f211
--- /dev/null
+++ b/checks/oracle_sessions
@@ -0,0 +1,52 @@
+#!/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_sessions>>>
+# pengt 15
+# hirni 22
+
+oracle_sessions_default_levels = (50, 100)
+
+def inventory_oracle_sessions(checkname, info):
+ return [ (line[0], "oracle_sessions_default_levels") for line in info if len(line) >= 2 ]
+
+def check_oracle_sessions(item, params, info):
+ for line in info:
+ if line[0] == item:
+ warn, crit = params
+ sessions = int(line[1])
+ infotext = " - %d active sessions" % sessions
+ perfdata = [("sessions", sessions, warn, crit)]
+ if sessions >= crit:
+ return (2, "CRIT" + infotext, perfdata)
+ elif sessions >= warn:
+ return (1, "WARN" + infotext, perfdata)
+ else:
+ return (0, "OK" + infotext, perfdata)
+ return (2, "UNKNOWN - Database not existant or not running")
+
+check_info['oracle_sessions'] = (check_oracle_sessions, "ORA %s Sessions", 1, inventory_oracle_sessions )
+
Module: check_mk
Branch: master
Commit: 915acbcd887807cab7467a34c97ce1aa90ea1f77
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=915acbcd887807…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 27 17:03:54 2011 +0100
Updated bug entries
---
.bugs/111 | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/.bugs/111 b/.bugs/111
new file mode 100644
index 0000000..117e19c
--- /dev/null
+++ b/.bugs/111
@@ -0,0 +1,11 @@
+Title: View editor does not save tool tips (in group header)
+Component: multisite
+Benefit: 2
+State: open
+Cost: 1
+Date: 2011-01-27 17:02:58
+Class: bug
+
+When you add tooltips to a group column in the view editor,
+the tooltip is not saved. This might appear at normal columns
+also, but is not tested.
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 )