arguments in commands

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nagios_aws
Posts: 76
Joined: Wed May 18, 2016 3:34 am

arguments in commands

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: arguments in commands

Post 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.
Former Nagios Employee
nagios_aws
Posts: 76
Joined: Wed May 18, 2016 3:34 am

Re: arguments in commands

Post 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 ...
nagios_aws
Posts: 76
Joined: Wed May 18, 2016 3:34 am

Re: arguments in commands

Post 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)
You do not have the required permissions to view the files attached to this post.
nagios_aws
Posts: 76
Joined: Wed May 18, 2016 3:34 am

Re: arguments in commands

Post 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$"
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: arguments in commands

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagios_aws
Posts: 76
Joined: Wed May 18, 2016 3:34 am

Re: arguments in commands

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: arguments in commands

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked