Module: check_mk
Branch: master
Commit: 0feaa4ade065c6493a694e1e96ba736a81e2163f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0feaa4ade065c6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 21 13:53:12 2011 +0200
FIX: mk_oracle: fix cache file handling
---
ChangeLog | 5 ++++-
agents/plugins/mk_oracle | 8 +++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f58ccab..0e4a5eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,14 @@
* FIX: fix cmk -D on cluster hosts
Checks & Agents:
- * FIX: j4p_performance: fix inventory functions
+ * FIX: j4p_performance: fix inventory functions
+ * FIX: mk_oracle: fix race condition in cache file handling (agent data
+ was missing sections in certain situations)
* mrpe: make check cluster-aware and work as clustered_service
* cups_queues: Run agent part only on directly on CUPS servers,
not on clients
+
Multisite:
* FIX: fix rescheduling of host check
* FIX: fix exception when using status_host while local site is offline
diff --git a/agents/plugins/mk_oracle b/agents/plugins/mk_oracle
index ad0f114..98890fb 100755
--- a/agents/plugins/mk_oracle
+++ b/agents/plugins/mk_oracle
@@ -80,7 +80,11 @@ for SID in $SIDS; do
fi
fi
- # Outputs the contents of the cache file when it exists and is recent enough.
+ # If the cache file exists, output it, regardless of its age. If it's outdated
+ # then it will be recreated *asynchronously*, we the new contents will not
+ # be available here anyway.
+ if [ -s "$CACHE_FILE" ] ; then cat "$CACHE_FILE" ; fi
+
# When not it checks if there is another task to update the cache is running
# at the moment (*.new) file present.
# When the cache is old and there is no *new file present, then start a query
@@ -117,7 +121,5 @@ EOF
fi
} > $CACHE_FILE.new && mv $CACHE_FILE.new $CACHE_FILE || rm -f
$CACHE_FILE*
"
- else
- cat "$CACHE_FILE"
fi
done