lausser / check_logfiles

A plugin (monitoring-plugin, not nagios-plugin, see also http://is.gd/PP1330) which scans logfiles for patterns.
https://omd.consol.de/docs/plugins/check_logfiles/
GNU General Public License v2.0
46 stars 27 forks source link

check_logfiles.exe fails to use a path with spaces in the argument --config #30

Open Tontonitch opened 7 years ago

Tontonitch commented 7 years ago

Hello,

After compiling a new version of check_logfiles.exe and using it in a different environment, I discovered that I cannot use a path with space in the argument --config. Usual path in a windows environment may contain "Program Files"

C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles>"C:\Program Files\ICINGA2\/sbin/custom_plugins\check_logfiles\check_logfiles.exe" --config "C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles\logfiles_sap.cfg" --searches backupsap
UNKNOWN - can not load configuration file C:\Program

I guess it what not supported since the beginning. Taking the last and an old version of the plugin output the same error:

C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles>"C:\Program Files\ICINGA2\/sbin/custom_plugins\check_logfiles\check_logfiles_3.4.2.exe" --config 'C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles\logfiles_sap.cfg' --searches backupsap
UNKNOWN - can not load configuration file 'C:\Program

C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles>"C:\Program Files\ICINGA2\/sbin/custom_plugins\check_logfiles\check_logfiles_3.8.1.exe" --config 'C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles\logfiles_sap.cfg' --searches backupsap
UNKNOWN - can not load configuration file 'C:\Program

Running the script in the location of the config files and adapting the --config argument works, but that's not usable by the launching agent.

C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles>"C:\Program Files\ICINGA2\/sbin/custom_plugins\check_logfiles\check_logfiles.exe" --config logfiles_sap.cfg --searches backupsap
CRITICAL - (1 errors) - cannot write status file C:\Program Files\ICINGA2\sbin\custom_plugins\check_logfiles\seek/logfiles_sap.C__scripts_logs_backupsap.cmd.log.backupsap! check your filesystem (permissions/usage/integrity) and disk devices |'backupsap_lines'=0 'backupsap_warnings'=0 'backupsap_criticals'=1 'backupsap_unknowns'=0

Would be great to be able to use paths with spaces with the --config option.

BR Yannick

ckujau commented 6 years ago

Did you try that with the latest version? Works fine here on a Windows 10 machine:

WIN10# check_logfiles -f "c:\dir with spaces\foobar.cfg"
OK - no errors or warnings

WIN10# find "logfile" "c:\dir with spaces\foobar.cfg"
---------- C:\DIR WITH SPACES\FOOBAR.CFG
  logfile => 'C:\Windows\SoftwareDistribution\ReportingEvents - Copy.log',

WIN10# ver & check_logfiles -V
Microsoft Windows [Version 10.0.16299.125]
check_logfiles.exe v3.8.1.4