Module: check_mk
Branch: master
Commit: 9bd8a3db7ff603129b0c6d3b778575136415448a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9bd8a3db7ff603…
Author: Andreas <ab(a)mathias-kettner.de>
Date: Mon Jun 18 13:04:24 2018 +0200
5826 FIX mrpe: Fixed broken option "Append age to output"
Setting this option in the agent bakery, causing the mrpe check not to return any output.
Change-Id: Iffb0b935cf6d9d9e1ba2c8b004825a1d5b157424
---
.werks/5826 | 11 +++++++++++
agents/check_mk_agent.linux | 7 +++++--
agents/check_mk_agent.solaris | 7 +++++--
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/5826 b/.werks/5826
new file mode 100644
index 0000000..6f007ac
--- /dev/null
+++ b/.werks/5826
@@ -0,0 +1,11 @@
+Title: mrpe: Fixed broken option "Append age to output"
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1529319773
+
+Setting this option in the agent bakery, causing the mrpe check not to return any
output.
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 530ecfb..6c31894 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -198,6 +198,7 @@ export -f run_mrpe
# run_cached [-s] NAME MAXAGE
# -s creates the section header <<<$NAME>>>
# -m mrpe-mode: stores exit code with the cache
+# -ma mrpe-mode with age: stores exit code with the cache and adds the cache age
# NAME is the name of the section (also used as cache file name)
# MAXAGE is the maximum cache livetime in seconds
function run_cached () {
@@ -206,9 +207,11 @@ function run_cached () {
local section=
local mrpe=0
local append_age=0
+ # TODO: this function is unable to handle mulitple args at once
+ # for example: -s -m won't work, it is read as single token "-s
-m"
if [ "$1" = -s ] ; then local section="echo
'<<<$2:cached($NOW,$3)>>>' ; " ; shift ; fi
if [ "$1" = -m ] ; then local mrpe=1 ; shift ; fi
- if [ "$1" = -a ] ; then local append_age=1 ; shift ; fi
+ if [ "$1" = "-ma" ] ; then local mrpe=1 ; local append_age=1 ;
shift ; fi
local NAME=$1
local MAXAGE=$2
shift 2
@@ -1084,7 +1087,7 @@ then
if [ "$key" = "interval" ] ; then
interval=$value
elif [ "$key" = "appendage" ] ; then
- args="$args -a"
+ args="-ma"
fi
done
fi
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 6080dc3..87e5f24 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -75,9 +75,12 @@ export -f run_mrpe
function run_cached () {
local mrpe=0
local append_age=0
+ # TODO: this function is unable to handle mulitple args at once
+ # for example: -s -m won't work, it is read as single token "-s
-m"
+
if [ "$1" = -s ] ; then local section="echo
'<<<$2>>>' ; " ; shift ; fi
if [ "$1" = -m ] ; then local mrpe=1 ; shift ; fi
- if [ "$1" = -a ] ; then local append_age=1 ; shift ; fi
+ if [ "$1" = "-ma" ] ; then local mrpe=1 ; local append_age=1 ;
shift ; fi
local NAME=$1
local MAXAGE=$2
shift 2
@@ -442,7 +445,7 @@ then
if [ "$key" = "interval" ] ; then
interval=$value
elif [ "$key" = "appendage" ] ; then
- args="$args -a"
+ args="-ma"
fi
done
fi