I tried running a script with ncpa.
NCPA agent version 2.1.5
check_ncpa.py version 1.1.3
Working:
/check_ncpa.py -t 'mytoken' -H X.X.X.X -P 5693 -M 'plugins/check_winfile.exe' -q 'args=--target C:\Test\,args=--compare eq,args=--critical 2'
/check_ncpa.py -t 'mytoken' -H X.X.X.X -P 5693 -M 'plugins/check_winfile.exe' -a '--target C:\Test\ --compare eq --critical 2'
Doesn't working:
/check_ncpa.py -t 'mytoken' -H X.X.X.X -P 5693 -M 'plugins/check_winfile.exe' -q 'args=--target C:\Program Files (x86)\Nagios\test.txt,args=--filter age lt -8 hours,args=--critical 0'
/check_ncpa.py -t 'mytoken' -H X.X.X.X -P 5693 -M 'plugins/check_winfile.exe' -a "--target 'C:\Program Files (x86)\Nagios\test.txt' --filter 'age lt -8 hours' --critical '0'"
I think the problem is with arguments -a and -q when there is a space. "Program Files (x86)" "age lt -8 hours".
I read in discussions about a similar problem with the -m argument. https://github.com/NagiosEnterprises/ncpa/issues/14
NCPA fails if there are spaces in argument -a -q
Re: NCPA fails if there are spaces in argument -a -q
In this particular case, I am not convinced that this is a NCPA problem. The plugin itself has some issues with spaces in the path... When I test it locally, on a Windows machine, the plugin handles well paths with no spaces. However, it fails to produce the expected output when there is a space ("TEMP" vs "MY TEMP"). This can be fixed by wrapping the path in double quotes.
For some reason, this doesn't work in all cases though. See the example below.
In this case, it was not enough to wrap the path in double quotes. In order to make it work, I had to escape backslashes. We will need to do some more testing, and see if we can make this work with NCPA.
Note: I haven't been able to find a solution yet, but just wanted to give you heads up, and let you know of my findings.
For some reason, this doesn't work in all cases though. See the example below.
In this case, it was not enough to wrap the path in double quotes. In order to make it work, I had to escape backslashes. We will need to do some more testing, and see if we can make this work with NCPA.
Note: I haven't been able to find a solution yet, but just wanted to give you heads up, and let you know of my findings.
Be sure to check out our Knowledgebase for helpful articles and solutions!