Service check results different in GUI vs. from command line

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

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

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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.
Former Nagios employee
rickwilson7425
Posts: 125
Joined: Tue Mar 18, 2014 3:20 pm

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

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

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

Post 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.
Former Nagios Employee.
me.
Locked