Page 2 of 2

Re: Service check results different in GUI vs. from command

Posted: Wed Aug 12, 2015 9:10 am
by rickwilson7425
Here is what I get running the command line from the 3.2 server:

bash-3.2# ./check_cluster -s -l "DNS Cluster" -w 3 -c 3 -d $SERVICESTATEID:nsal1.dc:DNS$,$SERVICESTATEID:nsal2.dc:DNS$,$SERVICESTATEID:nsal1.wc:DNS$,$SERVICESTATEID:nsal2.wc:DNS$

CLUSTER OK: DNS Cluster: 4 ok, 0 warning, 0 unknown, 0 critical

Re: Service check results different in GUI vs. from command

Posted: Wed Aug 12, 2015 9:28 am
by tmcdonald
I don't think the check is "working" from the command line, I think it is just "running and not erroring out". The command line has no knowledge of what a Nagios macro is - those only come into play when the nagios binary itself runs the check. Observe what happens when I echo your -d parameter:

Code: Select all

echo "$SERVICESTATEID:nsal1.dc:DNS$,$SERVICESTATEID:nsal2.dc:DNS$,$SERVICESTATEID:nsal1.wc:DNS$,$SERVICESTATEID:nsal2.wc:DNS$"
:nsal1.dc:DNS$,:nsal2.dc:DNS$,:nsal1.wc:DNS$,:nsal2.wc:DNS$
See how it gets condensed down? That is essentially what your plugin ends up running when you run it from the CLI:

Code: Select all

./check_cluster -s -l "DNS Cluster" -w 3 -c 3 -d :nsal1.dc:DNS$,:nsal2.dc:DNS$,:nsal1.wc:DNS$,:nsal2.wc:DNS$
This condensing is an attempt by bash to resolve environment variables. If it is empty, then the $WHATEVER will be empty:

Code: Select all

echo $HOME
/root
echo $HOSTNAME
localhost
echo $USER
root
echo $IDONTEXIST

echo $SERVICESTATEID:nsal1.dc:DNS$
:nsal1.dc:DNS$
I think @Box293 has it right - your parameters are not what you think they are, hence the difference between GUI and CLI testing.

Re: Service check results different in GUI vs. from command

Posted: Wed Aug 12, 2015 9:45 am
by rickwilson7425
ok, I see what you mean.

Nevertheless, I was working on it some more last night and copied over the config files again. Somehow that got the check running ok on the new server - go figure....

Please close this ticket out.

Thanks for your help

Rick

Re: Service check results different in GUI vs. from command

Posted: Wed Aug 12, 2015 10:03 am
by hsmith
rickwilson7425 wrote:ok, I see what you mean.

Nevertheless, I was working on it some more last night and copied over the config files again. Somehow that got the check running ok on the new server - go figure....

Please close this ticket out.

Thanks for your help

Rick
Thank you for the reply.
I'm glad to hear you got it working.