Module: check_mk
Branch: master
Commit: 1335f615e07b1af8356071ee2c19810895b9867c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1335f615e07b1a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 23 14:01:03 2012 +0100
FIX: Oracle checks try to handle ORA-* errors reported by the agent
All oracle checks will return UNKNOWN when finding an ORA-* message
---
checks/oracle.include | 44 ++++++++++++++++++++++++++++++++
checks/oracle_logswitches | 7 +++++
checks/oracle_sessions | 7 +++++
checks/oracle_tablespaces | 62 ++++++++++++++++++++++++++-------------------
4 files changed, 94 insertions(+), 26 deletions(-)
diff --git a/checks/oracle.include b/checks/oracle.include
new file mode 100644
index 0000000..794667c
--- /dev/null
+++ b/checks/oracle.include
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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.
+
+
+# This function must be executed for each agent line which has been
+# found for the current item. It must deal with the ORA-* error
+# messages. It has to skip over the lines which show the SQL statement
+# and the SQL error message which comes before the ORA-* message.
+#
+# The check must completely skip the lines before the ORA-* messages
+# and return UNKNOWN on the first found ORA-* message.
+# line[0] is the item (db instance)
+#
+# This function returns a tuple when an ORA-* message has been found.
+# It returns False if this line should be skipped by the check.
+def oracle_handle_ora_errors(line):
+ if line[1] in [ 'select', '*', 'ERROR' ]:
+ return False
+ if line[1].startswith('ORA-'):
+ return (3, 'UNKNOWN - Found error in agent output "%s"' % ' '.join(line[1:]))
+
diff --git a/checks/oracle_logswitches b/checks/oracle_logswitches
index 558ad25..e912d23 100644
--- a/checks/oracle_logswitches
+++ b/checks/oracle_logswitches
@@ -36,6 +36,12 @@ def inventory_oracle_logswitches(info):
def check_oracle_logswitches(item, params, info):
for line in info:
if line[0] == item:
+ err = oracle_handle_ora_errors(line)
+ if err == False:
+ continue
+ elif isinstance(err, tuple):
+ return err
+
locrit, lowarn, warn, crit = params
logswitches = int(line[1])
infotext = " - %d log switches in the last 60 minutes (levels at %d/%d .. %d/%d)" \
@@ -51,3 +57,4 @@ def check_oracle_logswitches(item, params, info):
check_info['oracle_logswitches'] = (check_oracle_logswitches, "ORA %s Logswitches", 1, inventory_oracle_logswitches )
checkgroup_of['oracle_logswitches'] = "oracle_logswitches"
+check_includes['oracle_logswitches'] = [ "oracle.include" ]
diff --git a/checks/oracle_sessions b/checks/oracle_sessions
index af55546..2f5f143 100644
--- a/checks/oracle_sessions
+++ b/checks/oracle_sessions
@@ -36,6 +36,12 @@ def inventory_oracle_sessions(info):
def check_oracle_sessions(item, params, info):
for line in info:
if line[0] == item:
+ err = oracle_handle_ora_errors(line)
+ if err == False:
+ continue
+ elif isinstance(err, tuple):
+ return err
+
warn, crit = params
sessions = int(line[1])
infotext = " - %d active sessions (levels at %d/%d)" % (sessions, warn, crit)
@@ -49,3 +55,4 @@ def check_oracle_sessions(item, params, info):
return (2, "UNKNOWN - Database not existing or not running")
check_info['oracle_sessions'] = (check_oracle_sessions, "ORA %s Sessions", 1, inventory_oracle_sessions )
+check_includes['oracle_sessions'] = [ "oracle.include" ]
diff --git a/checks/oracle_tablespaces b/checks/oracle_tablespaces
index a98f95a..76ac671 100644
--- a/checks/oracle_tablespaces
+++ b/checks/oracle_tablespaces
@@ -61,6 +61,8 @@ def inventory_oracle_tablespaces(info):
tablespaces = set([])
autoextensible = set([])
for line in info:
+ if len(line) != 13:
+ continue
ts = (line[0], line[2])
if line[11] in [ "ONLINE", "READONLY" ]:
tablespaces.add(ts)
@@ -93,32 +95,39 @@ def check_oracle_tablespaces(item, params, info):
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", "READONLY" ]:
- num_avail += 1
- current_size += blocksize * int(line[5])
- used += blocksize * (int(line[5]) - int(line[12]))
- # Autoextensible? Honor max size
- if line[4] == "YES":
- num_extensible += 1
- my_max_size = blocksize * int(line[6])
- 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
- free_space += blocksize * (incsize * incs + (int(line[12])))
- # not autoextensible: take current size as maximum
- else:
- my_max_size = blocksize * int(line[5])
- max_size += my_max_size
- free_space += blocksize * int(line[12])
+ if line[0] == sid:
+ err = oracle_handle_ora_errors(line)
+ if err == False:
+ continue
+ elif isinstance(err, tuple):
+ return err
+
+ if line[2] == tbsname and len(line) == 13:
+ ts_status = line[11]
+ blocksize = int(line[10])
+ num_files += 1
+ if line[3] in [ "AVAILABLE", "ONLINE", "READONLY" ]:
+ num_avail += 1
+ current_size += blocksize * int(line[5])
+ used += blocksize * (int(line[5]) - int(line[12]))
+ # Autoextensible? Honor max size
+ if line[4] == "YES":
+ num_extensible += 1
+ my_max_size = blocksize * int(line[6])
+ 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
+ free_space += blocksize * (incsize * incs + (int(line[12])))
+ # not autoextensible: take current size as maximum
+ else:
+ my_max_size = blocksize * int(line[5])
+ max_size += my_max_size
+ free_space += blocksize * int(line[12])
if ts_status == None:
@@ -189,3 +198,4 @@ def check_oracle_tablespaces(item, params, info):
check_info['oracle_tablespaces'] = (check_oracle_tablespaces, "ORA %s Tablespace", 1, inventory_oracle_tablespaces )
check_config_variables.append("oracle_tablespaces_check_default_increment")
+check_includes['oracle_tablespaces'] = [ "oracle.include" ]
Module: check_mk
Branch: master
Commit: 1781d33ca2159456c8a828d33f9ec85795aa4c2f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1781d33ca21594…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 21 11:26:03 2012 +0100
Updated bug entries #0689
---
.bugs/689 | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/.bugs/689 b/.bugs/689
new file mode 100644
index 0000000..abe4ba1
--- /dev/null
+++ b/.bugs/689
@@ -0,0 +1,10 @@
+Title: BI nodes must not use the label of the aggregation for the node id
+Component: bi
+State: open
+Date: 2012-03-21 11:24:20
+Targetversion: 1.2.0
+Class: bug
+
+At the moment the aggregation label is used for the html node id without any escaping or similar.
+Labels like this "Host <a href=\"view.py?view_name=hoststatus&site=&host=$HOST$\">$HOST$</a>" will
+destroy the bi page but should really be possible.