[Check_mk (english)] Local check script error

Hi,

Headache issue, hope someone can spot my (stupid) mistake. I’m running standalone 1.2.3i6 on CentOS 6.4

I have some scripts, which simply do ps and grep to see if some proc count is good. It has been acting not as expected.

Here is the simple dummy script which is based on a simple skeleton:

#!/bin/bash

···

STATUS=‘0’
ITEMNAME=‘all_badboys-NY.pl’
VARNAME=‘Count’
COUNT=$(ps -ef|grep perl|grep all_streamPRO-NY4.pl|wc --lines)
WARN=’’
CRIT=’’
MIN=’’
MAX=’’

if [ $COUNT -eq 0 ]; then
STATUS=2
STATUSTXT=‘CRITICAL’
else
STATUS=0
STATUSTXT=‘OK’
fi

CHKOUTPUT="$STATUSTXT - $ITEMNAME process = $COUNT"
echo “$STATUS $ITEMNAME
$VARNAME=${COUNT};$WARN;$CRIT;$MIN;$MAX $CHKOUTPUT”

Running the script manually gets this:

/usr/lib/check_mk_agent/local # ./test1.sh
0 all_badboys-NY.pl Count=1;;;; OK -
all_badboys-NY.pl process = 1

However, when I run a Full service scan under WATO, I get

CRITICAL - all_badboys-NY.pl process =
0

What’s wrong?

Will

Hi Will,

seems as if no such process is running when scan is done, so no
problem with the check.

What does 'cmk -d HOSTNAME' output regarding the check?

BTW: Why don't you use the shipped ps check
(http://mathias-kettner.de/checkmk_check_ps.html)?

Regards,
Marcel

···

2013/11/21 William Kwan <potatok@yahoo.com>:

Hi,

Headache issue, hope someone can spot my (stupid) mistake. I'm running
standalone 1.2.3i6 on CentOS 6.4

I have some scripts, which simply do ps and grep to see if some proc count
is good. It has been acting not as expected.

Here is the simple dummy script which is based on a simple skeleton:

#!/bin/bash
#
STATUS='0'
ITEMNAME='all_badboys-NY.pl'
VARNAME='Count'
COUNT=$(ps -ef|grep perl|grep all_streamPRO-NY4.pl|wc --lines)
WARN=''
CRIT=''
MIN=''
MAX=''

if [ $COUNT -eq 0 ]; then
   STATUS=2
   STATUSTXT='CRITICAL'
else
   STATUS=0
   STATUSTXT='OK'
fi

CHKOUTPUT="$STATUSTXT - $ITEMNAME process = $COUNT"
echo "$STATUS $ITEMNAME $VARNAME=${COUNT};$WARN;$CRIT;$MIN;$MAX $CHKOUTPUT"

Running the script manually gets this:

/usr/lib/check_mk_agent/local # ./test1.sh
0 all_badboys-NY.pl Count=1;;;; OK - all_badboys-NY.pl process = 1

However, when I run a Full service scan under WATO, I get
CRITICAL - all_badboys-NY.pl process = 0

What's wrong?

Will

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Hi,

I just figured out how to use the shipped ps check and we started to use it.

For our script, I'm very sure that the target proc has been running. Manually running the script would return OK, but check_mk will say no. I'll try collect the info you requested.

W

···

On Nov 20, 2013, at 9:52 PM, Marcel Schulte <schulte.marcel@gmail.com> wrote:

Hi Will,

seems as if no such process is running when scan is done, so no
problem with the check.

What does 'cmk -d HOSTNAME' output regarding the check?

BTW: Why don't you use the shipped ps check
(http://mathias-kettner.de/checkmk_check_ps.html)?

Regards,
Marcel

2013/11/21 William Kwan <potatok@yahoo.com>:

Hi,

Headache issue, hope someone can spot my (stupid) mistake. I'm running
standalone 1.2.3i6 on CentOS 6.4

I have some scripts, which simply do ps and grep to see if some proc count
is good. It has been acting not as expected.

Here is the simple dummy script which is based on a simple skeleton:

#!/bin/bash
#
STATUS='0'
ITEMNAME='all_badboys-NY.pl'
VARNAME='Count'
COUNT=$(ps -ef|grep perl|grep all_streamPRO-NY4.pl|wc --lines)
WARN=''
CRIT=''
MIN=''
MAX=''

if [ $COUNT -eq 0 ]; then
  STATUS=2
  STATUSTXT='CRITICAL'
else
  STATUS=0
  STATUSTXT='OK'
fi

CHKOUTPUT="$STATUSTXT - $ITEMNAME process = $COUNT"
echo "$STATUS $ITEMNAME $VARNAME=${COUNT};$WARN;$CRIT;$MIN;$MAX $CHKOUTPUT"

Running the script manually gets this:

/usr/lib/check_mk_agent/local # ./test1.sh
0 all_badboys-NY.pl Count=1;;;; OK - all_badboys-NY.pl process = 1

However, when I run a Full service scan under WATO, I get
CRITICAL - all_badboys-NY.pl process = 0

What's wrong?

Will

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en