check_logfiles plugin via NCPA

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Maxwellb99
Posts: 97
Joined: Tue Jan 26, 2016 5:29 pm

check_logfiles plugin via NCPA

Post by Maxwellb99 »

Hello,
Has anyone had success using the console labs check_logfiles plugin via NCPA (essentially through the cmd line). I want the Flexibility to do fairly simple checks without having to make changes via a config on the remote hosts.

The problem: NCPA requires that I pass in the arguments quoted; as the path contains spaces: C:\Program Files (x86)\Nagios_Test\Nagios_Test.txt. Else, it chops off everything after 'Program'. Running the plugin locally, I see that it requires double quotes. I assume I'd need something like this:

./check_ncpa.py -H '<host>' -t '<your token>' -M 'plugins/check_logfiles.exe' -q 'args=--logfile "C:\Program Files (x86)\Nagios_Test\Nagios_Test.txt"' #double quote, then single quote.

That Creates: cannot write status file C:\Program Files (x86)\Nagios\NCPA\plugins\check_logfiles/check_logfiles."C__Program_Files_(x86)_Nagios_Test_Nagios_Test.txt".seek! check your filesystem (permissions/usage/integrity) and disk devices

Note: when there's no spaces. These work.
./check_ncpa.py -H <host> -t <token> -M plugins/check_logfiles.exe -q args=--logfile=C:\\Nagios_Test2.txt
./check_ncpa.py -H <host> -t <token> -M plugins/check_logfiles.exe -q 'args=--logfile=C:\Nagios_Test2.txt'
./check_ncpa.py -H <host> -t <token> -M plugins/check_logfiles.exe -q "args=--logfile=C:\Nagios_Test2.txt"

OK - no errors or warnings|'default_lines'=0 'default_warnings'=0 'default_criticals'=0 'default_unknowns'=0
# [see attachment]

I may not have configured the binary correctly, I'm gonna reconfigure it with the default settings then if that works I'll try creating the directories again, but in the mean time. Has anyone had success using this plugin in the way that I've described? Please paste your syntax.

https://labs.consol.de/nagios/check_logfiles/index.html

Thanks,
Maxwell Ramirez
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_logfiles plugin via NCPA

Post by lmiltchev »

Can your plugin handle spaces? Can you run the check locally on the Windows machine from the CMD prompt, and show the output? What is the NCPA version that you are currently using?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Maxwellb99
Posts: 97
Joined: Tue Jan 26, 2016 5:29 pm

Re: check_logfiles plugin via NCPA

Post by Maxwellb99 »

As you can see it requires double quotes from the localhost.
double quotes.PNG
I'm using NCPA 2.1.7.

Here's the check from Nagios to the remote host.
remote_host.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_logfiles plugin via NCPA

Post by lmiltchev »

I was able to recreate the issue in-house. I didn't have the plugin that you were using, but I tried another plugin that also requires path to be wrapped in double quotes. NCPA check failed when there were spaces in the path.

BTW, I found similar reports from other users - see this:

https://github.com/NagiosEnterprises/ncpa/issues/481

You can try the following command as a "workaround":

Code: Select all

./check_ncpa.py -H '<host>' -t '<your token>' -M 'plugins/check_logfiles.exe' -q 'args=--logfile C:\Progra~2\Nagios_Test\Nagios_Test.txt'
Unfortunately, this is not a "real solution", and it's not going to work with any other directories but "C:\Program Files". With this one, you could use "C:\Progra~1".

I would recommend that you check the issues on GitHub once in a while to follow up on the bug report.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked