Module: check_mk
Branch: master
Commit: 8056df66e594b3f9383c854c4b7dfb586030d786
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8056df66e594b3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 16 11:04:51 2017 +0100
Linux/Solaris agent: avoid potential name clash with cache files of MRPE
MRPE cache files are now prefixed with mrpe_. Previously
you could name a mrpe check for example omd_status and would
than use the same cache file as the normal section omd_status.
Change-Id: I1e86fbcfd433ed8615b6b2bcb033fb8fa7f57031
---
agents/check_mk_agent.linux | 6 +++++-
agents/check_mk_agent.solaris | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index dfde4ba..4d261ab 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -143,7 +143,11 @@ function run_cached () {
local CMDLINE="$section$@"
if [ ! -d $MK_VARDIR/cache ]; then mkdir -p $MK_VARDIR/cache ; fi
- CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
+ if [ "$mrpe" = 1 ] ; then
+ CACHEFILE="$MK_VARDIR/cache/mrpe_$NAME.cache"
+ else
+ CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
+ fi
# Check if the creation of the cache takes suspiciously long and kill the
# process if the age (access time) of $CACHEFILE.new is twice the MAXAGE.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 77c1aa7..250d40f 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -84,7 +84,11 @@ function run_cached () {
local CMDLINE="$section$@"
if [ ! -d $MK_VARDIR/cache ]; then mkdir -p $MK_VARDIR/cache ; fi
- CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
+ if [ "$mrpe" = 1 ] ; then
+ CACHEFILE="$MK_VARDIR/cache/mrpe_$NAME.cache"
+ else
+ CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
+ fi
# Check if the creation of the cache takes suspiciously long and return
# nothing if the age (access time) of $CACHEFILE.new is twice the MAXAGE