Page 1 of 1

arguments in commands

Posted: Tue Jan 24, 2017 5:07 am
by nagios_aws
Hello everyone,

to follow up my first topic : https://support.nagios.com/forum/viewto ... =6&t=41911

It worked for one server, but not for another ...

when I try to launch the check from Nagios server, I got this :

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H WORKINGSERVER-c windows_flexlm -a "--port 22222"
DOWN

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H NOTWORKINGSERVER-c windows_flexlm -a "--port 22222"
The command (windows_flexlm) returned an invalid return code: 255
return code "DOWN" is normal right now.
I'm currently using 0.5.0.62 2016-09-14 agent on both servers, same nsclient.ini, same boot.ini, same Tools and plugins of my own, same Perl version, same command for both ...

I tried this :

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H NOTWORKINGSERVER-c windows_flexlm -a "22222"
DOWN
and it worked ...

here is the definition of command in both nsclient.ini :

Code: Select all

windows_flexlm=perl check_flexlm.pl --port $ARG1$
and in Nagios Webportal :

Code: Select all

$USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm -a "--port $ARG1$"

Do you have any ideas on how to fix that ?

Please ask for more informations if needed

Thank you

Re: arguments in commands

Posted: Tue Jan 24, 2017 12:00 pm
by rkennedy
Can you try manually executing the perl script on the Windows host and see what is returned? Please post the full result. Wondering if it'll come back with DOWN or the same thing you're seeing in Nagios.

Re: arguments in commands

Posted: Wed Jan 25, 2017 3:34 am
by nagios_aws
Hello,

forgot to tell but I can run it without problems using the command :

Code: Select all

perl check_flexlm.pl --port 22222
I think there is a problem in communication from Nagios Server and Nagios Agent ...

Re: arguments in commands

Posted: Wed Jan 25, 2017 8:52 am
by nagios_aws
I also used the "nscp test" in a command prompt, then launch my command, you can see the result in attachment (it works as expected)

Re: arguments in commands

Posted: Wed Jan 25, 2017 10:52 am
by nagios_aws
here is what I have now in nscp test command line:

windows_flexlm_daemon 27150
D ext-script Possible missing argument in: perl check_flexlm.pl --port 27150 --v
endor $ARG2$
D ext-script Command line: perl check_flexlm.pl --port 27150 --vendor $ARG2$
L cli CRITICAL: $ARG2$: DOWN

I have the config file in attachment, and this in "command" page in Nagios Portal :

Code: Select all

windows_flexlm_daemon 	$USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm -a "$ARG1$ $ARG2$"

Re: arguments in commands

Posted: Wed Jan 25, 2017 4:40 pm
by tgriep
The windows_flexlm_daemon command that is defined in the nsclient.ini file has 2 arguments but the command on the Nagios server is using the windows_flexlm command which only uses one argument.
Try changing the command on the Nagios server from

Code: Select all

windows_flexlm_daemon    $USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm -a "$ARG1$ $ARG2$"
to

Code: Select all

windows_flexlm_daemon    $USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm_daemon -a "$ARG1$ $ARG2$"
Save the change and Apply the Config, see if that fixes the issue.

Re: arguments in commands

Posted: Thu Jan 26, 2017 3:34 am
by nagios_aws
Hello,

I finally fixed this, here is the solution :

nsclient.ini :

Code: Select all

windows_flexlm=perl check_flexlm.pl --port $ARG1$
windows_flexlm_daemon=perl check_flexlm.pl --port $ARG1$ --vendor $ARG2$
commands in Nagios interface :

Code: Select all

windows_flexlm 	$USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm -a $ARG1$
windows_flexlm_daemon 	$USER1$/check_nrpe -H $HOSTADDRESS$ -c windows_flexlm_daemon -a "$ARG1$" "$ARG2$"
the tricky part is passing the arguments, as always :) but also take care you use the right command with the right syntax :lol:

Thank you !


ps : keep this thread open for a week, maybe I will have another problem like this one

Re: arguments in commands

Posted: Thu Jan 26, 2017 10:04 am
by tgriep
Glad it is working for you now. We'll leave it open for you but if you have a new question, please open a new post so we can keep the issues separated.