Page 1 of 1
NCPA posix listener error : no such option
Posted: Tue Aug 29, 2017 11:35 am
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 ?
Re: NCPA posix listener error : no such option
Posted: Tue Aug 29, 2017 11:42 am
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?
Re: NCPA posix listener error : no such option
Posted: Tue Aug 29, 2017 12:01 pm
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.
Re: NCPA posix listener error : no such option
Posted: Tue Aug 29, 2017 12:57 pm
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.