NCPA posix listener error : no such option

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vistate
Posts: 11
Joined: Tue Aug 22, 2017 10:55 am

NCPA posix listener error : no such option

Post by vistate »

Hi there,
I am having a very odd issue with an active check script. Running the script locally works without problem, running other checks with custom plugins works without problem.

The command is as follows :

$USER1$/check_ncpa.py -H $HOSTADDRESS$ -P 5693 -t sq5vplngs001 -M 'agent/plugin/qt_check_rep_stablequeue' -a "$ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$"

usr/local/nagios/libexec/check_ncpa.py -H targetserver -P 5693 -t nagiosserver -M 'agent/plugin/qt_check_rep_stablequeue' -a "-sPlatformrssd -dPlatform_RSSD -w50 -c60 "
Usage: ncpa_posix_listener [options]

ncpa_posix_listener: error: no such option: -P

why is the posix listener not understanding the flag -s ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA posix listener error : no such option

Post by lmiltchev »

Can you show us the command (script), run locally from the command line on the remote system, along with the output of it? Also, can you share the "qt_check_rep_stablequeue" script with us?
Be sure to check out our Knowledgebase for helpful articles and solutions!
vistate
Posts: 11
Joined: Tue Aug 22, 2017 10:55 am

Re: NCPA posix listener error : no such option

Post by vistate »

Running locally - i am receiving an error which is expected. At this current time.
script output

-bash-4.2$ ././qt_check_rep_stablequeue
ServerName is required
Usage:././qt_check_rep_stablequeue -s<ServerName> -d<DatabaseName> -w<warning threshold> -c<critical threshold>

script with variables

-bash-4.2$ ./qt_check_rep_stablequeue -sPlatformrssd -dPlatform_RSSD -w40 -c50
ERROR: Unable to ISQL into server Platformrssd from function getQueueSize
I need to check with the DB team if i can post the script.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NCPA posix listener error : no such option

Post by lmiltchev »

Many factors can be at play here, i.e. how is your script written, are you passing your args as one argument or as separate arguments, do you need to escape special characters, what version of NCPA you are using, etc.

Here's a very simple example of passing 4 args to a PS script.

4args.ps1 script

Code: Select all

$ServerName = "-s"+$args[0]
$DatabaseName = "-d"+$args[1]
$Warning = "-w"+$args[2]
$Critical = "-c"+$args[3]

write-host "Arguments are: $ServerName $DatabaseName $Warning $Critical"

exit 0

Running the script locally

Code: Select all

PS C:\Program Files (x86)\Nagios\NCPA\plugins> .\4args.ps1 myserver mydb 5 10
Arguments are: -smyserver -dmydb -w5 -c10
PS C:\Program Files (x86)\Nagios\NCPA\plugins>

In the web UI (API Endpoint)
example01.PNG
From the CLI on the Nagios XI server

Code: Select all

[root@main-nagios-xi ~]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.x.x -t 'mytoken' -M 'plugins/4args.ps1/myserver/mydb/5/10'
Arguments are: -smyserver -dmydb -w5 -c10
[root@main-nagios-xi ~]#

[root@main-nagios-xi ~]# /usr/local/nagios/libexec/check_ncpa.py -H 192.168.x.x -t 'mytoken' -M 'plugins/4args.ps1' -a "myserver mydb 5 10"
Arguments are: -smyserver -dmydb -w5 -c10
[root@main-nagios-xi ~]#
Hope this helps.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked