check_logfiles plugin
Posted: Mon Aug 02, 2021 10:58 am
Hi Team ,
We have a requirement to monitor a string from a log file . The log file is dynamic and has date stamp but the log file is not rotated on a daily basis and I see that check_logfiles is trying to search for log file with latest date .
I have tried monitoring but im not getting the required output .
Below is the text file saved under C:/Program Files/NSClient++ folder .
$protocolsdir = 'C:\Nagios\NSClient++';
$seekfilesdir = 'C:\Nagios\NSClient++';
@searches = (
{
tag => 'logfile',
type => 'simple',
logfile => 'D:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.$CL_DATE_YYYY$-$CL_DATE_MM$-$CL_DATE_DD$.log',
criticalpatterns => ['java.net.SocketException: Connection reset by peer'],
}
);
I have updated the nsclient++ file as below under [/settings/external scripts/scripts] :
check_logfile_Tomcat8_BMC=scripts\check_logfiles.exe -f "C:\Program Files\NSClient++\Tomcat8_BMC.txt
Im getting below output in Nagios :
[nagios@xyz ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.**.***.** -u -t 100 -c check_logfile_Tomcat8_BMC
UNKNOWN - (1 unknown in Tomcat8_BMC.protocol-2021-08-02-11-51-29) - could not find logfile D:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.2021-08-02.log |'logfile_lines'=0 'logfile_warnings'=0 'logfile_criticals'=0 'logfile_unknowns'=1
Im pasting the screenshot of log file localhost below :
We have a requirement to monitor a string from a log file . The log file is dynamic and has date stamp but the log file is not rotated on a daily basis and I see that check_logfiles is trying to search for log file with latest date .
I have tried monitoring but im not getting the required output .
Below is the text file saved under C:/Program Files/NSClient++ folder .
$protocolsdir = 'C:\Nagios\NSClient++';
$seekfilesdir = 'C:\Nagios\NSClient++';
@searches = (
{
tag => 'logfile',
type => 'simple',
logfile => 'D:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.$CL_DATE_YYYY$-$CL_DATE_MM$-$CL_DATE_DD$.log',
criticalpatterns => ['java.net.SocketException: Connection reset by peer'],
}
);
I have updated the nsclient++ file as below under [/settings/external scripts/scripts] :
check_logfile_Tomcat8_BMC=scripts\check_logfiles.exe -f "C:\Program Files\NSClient++\Tomcat8_BMC.txt
Im getting below output in Nagios :
[nagios@xyz ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.**.***.** -u -t 100 -c check_logfile_Tomcat8_BMC
UNKNOWN - (1 unknown in Tomcat8_BMC.protocol-2021-08-02-11-51-29) - could not find logfile D:\Program Files\Apache Software Foundation\Tomcat 8.5_Tomcat8_BMC_SmartIT\logs\localhost.2021-08-02.log |'logfile_lines'=0 'logfile_warnings'=0 'logfile_criticals'=0 'logfile_unknowns'=1
Im pasting the screenshot of log file localhost below :