check_logfiles plugin via NCPA
Posted: Fri Sep 06, 2019 1:22 am
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
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