added support for missing files
Message-ID: <55895641.8IkelepYFp3b4AyN%mk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: fe994888ca658df8bc8326d776202d0d04ce30eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe994888ca658d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jun 23 14:50:59 2015 +0200
#1906: FIX: oracle_recovery_status: added support for missing files
---
.werks/1906 | 11 +++++++++++
ChangeLog | 1 +
checkman/oracle_recovery_status | 4 ++++
checks/oracle_recovery_status | 22 ++++++++++++++++------
4 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/.werks/1906 b/.werks/1906
new file mode 100644
index 0000000..da8eadb
--- /dev/null
+++ b/.werks/1906
@@ -0,0 +1,11 @@
+Title: oracle_recovery_status: added support for missing files
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i2
+Date: 1434707027
+Class: fix
+
+The check results in UNKNOWN state when a database has a missing
+datafile. The Check creates a CRIT with '1 missing datafiles(!!)'.
+
diff --git a/ChangeLog b/ChangeLog
index a39e018..aa4b993 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* 2221 FIX: cisco_temperature: Fixed order of device levels for some devices...
* 2329 FIX: windows_intel_bonding: Fix exception in case of no existing bonding
device
* 2355 FIX: docsis_channels_upstream: Fix graph definitions
+ * 1906 FIX: oracle_recovery_status: added support for missing files...
* 2311 FIX: windows agent: now replaces BOM (byte order marks) from local and plugin
scripts...
* 2357 FIX: livestatus_status: no not alarm switched off host freshness nor event
handlers on CMC <= 1.2.6...
diff --git a/checkman/oracle_recovery_status b/checkman/oracle_recovery_status
index bc2ffbc..7e7b26b 100644
--- a/checkman/oracle_recovery_status
+++ b/checkman/oracle_recovery_status
@@ -14,6 +14,10 @@ description:
Primary and Standby Database. Primary will only create WARNINGs, when
the level of levels is exceeded. A value for CRITICAL is only usable
when the Database is in Physical Standby Mode.
+ The check for 'missing files' detects missing files in the control file
+ of the database. The Check results in a CRIT state when more the 0
+ files are missing. This is possible in physical stanbdy Environments
+ after an error while creating a new datafile.
The 2nd function is the monitoring of datafiles in manual backup mode.
This is important for database which are backed up with 'alter database
diff --git a/checks/oracle_recovery_status b/checks/oracle_recovery_status
index b1482e2..30a2d4b 100644
--- a/checks/oracle_recovery_status
+++ b/checks/oracle_recovery_status
@@ -41,6 +41,7 @@ def inventory_oracle_recovery_status(info):
def check_oracle_recovery_status(item, params, info):
state = 0
offlinecount = 0
+ filemissingcount = 0
oldest_checkpoint_age = None
oldest_backup_age = -1
@@ -73,12 +74,16 @@ def check_oracle_recovery_status(item, params, info):
oldest_backup_age = max(int(backup_age), oldest_backup_age)
if datafilestatus == 'ONLINE':
- checkpoint_age = int(checkpoint_age)
-
- if oldest_checkpoint_age is None:
- oldest_checkpoint_age = checkpoint_age
+ if backup_state == 'FILE MISSING':
+ filemissingcount += 1
else:
- oldest_checkpoint_age = max(oldest_checkpoint_age, checkpoint_age)
+ checkpoint_age = int(checkpoint_age)
+
+ if oldest_checkpoint_age is None:
+ oldest_checkpoint_age = checkpoint_age
+ else:
+ oldest_checkpoint_age = max(oldest_checkpoint_age,
checkpoint_age)
+
else:
offlinecount += 1
@@ -93,7 +98,7 @@ def check_oracle_recovery_status(item, params, info):
# we found a negative time for last checkpoint
infotext += ", oldest checkpoint is in the future %s(!), check the time
on the server" \
% get_age_human_readable(int(oldest_checkpoint_age)*-1)
- state = 1
+ state = max(state, 1)
else:
infotext += ", oldest Checkpoint %s ago" \
@@ -133,6 +138,11 @@ def check_oracle_recovery_status(item, params, info):
% (offlinecount)
state = 2
+ if filemissingcount > 0:
+ infotext += " %i missing datafiles(!!)" \
+ % (filemissingcount)
+ state = 2
+
if oldest_backup_age > 0:
infotext += " %i datafiles in backup mode oldest is %s" % ( \
backup_count, get_age_human_readable(oldest_backup_age))