I have gone through the document https://labs.consol.de/nagios/check_logfiles/index.html. I am running the below command
Code: Select all
/usr/lib/nagios/plugins/check_logfiles --logfile=/opt/tomcat_gnip/logs/hashapi/gnipclienttest.log --criticalpattern "Error message received as stream result. Quitting connection"
OK - no errors or warnings|default_lines=0 default_warnings=0 default_criticals=0 default_unknowns=0
Code: Select all
cat /opt/tomcat_gnip/logs/hashapi/gnipclienttest.log
[ERROR] 2016-11-24 04:02:49.176 [pool-4-thread-1] GnipClientLog - Error message received as stream result. Quitting connection.
[ERROR] 2016-12-01 00:54:18.541 [pool-4-thread-1] GnipClientLog - Error message received as stream result. Quitting connection.
I am not sure why the command returns OK inspite of having Error in the /opt/tomcat_gnip/logs/hashapi/gnipclienttest.log file
Code: Select all
/usr/lib/nagios/plugins/check_logfiles --version
check_logfiles v3.7.6.3
/usr/lib/nagios/plugins/check_logfiles
Usage: check_logfiles [-t timeout] -f <configfile> [--searches=tag1,tag2,...]
check_logfiles [-t timeout] --logfile=<logfile> --tag=<tag> --rotation=<rotation>
--criticalpattern=<regexp> --warningpattern=<regexp>
/usr/lib/nagios/plugins/check_logfiles --help
This Nagios Plugin comes with absolutely NO WARRANTY. You may use
it on your own risk!
Copyright by ConSol Software GmbH, Gerhard Lausser.
This plugin looks for patterns in logfiles, even in those who were rotated
since the last run of this plugin.
You can find the complete documentation at
http://labs.consol.de/nagios/check_logfiles/
Usage: check_logfiles [-t timeout] -f <configfile>
The configfile looks like this:
$seekfilesdir = '/opt/nagios/var/tmp';
# where the state information will be saved.
$protocolsdir = '/opt/nagios/var/tmp';
# where protocols with found patterns will be stored.
$scriptpath = '/opt/nagios/var/tmp';
# where scripts will be searched for.
$MACROS = { CL_DISK01 => "/dev/dsk/c0d1", CL_DISK02 => "/dev/dsk/c0d2" };
@searches = (
{
tag => 'temperature',
logfile => '/var/adm/syslog/syslog.log',
rotation => 'bmwhpux',
criticalpatterns => ['OVERTEMP_EMERG', 'Power supply failed'],
warningpatterns => ['OVERTEMP_CRIT', 'Corrected ECC Error'],
options => 'script,protocol,nocount',
script => 'sendnsca_cmd'
},
{
tag => 'scsi',
logfile => '/var/adm/messages',
rotation => 'solaris',
criticalpatterns => 'Sense Key: Not Ready',
criticalexceptions => 'Sense Key: Not Ready /dev/testdisk',
options => 'noprotocol'
},
{
tag => 'logins',
logfile => '/var/adm/messages',
rotation => 'solaris',
criticalpatterns => ['illegal key', 'read error.*$CL_DISK01$'],
criticalthreshold => 4
warningpatterns => ['read error.*$CL_DISK02$'],
}
);
Thanks in Advance.
Regards,
Kaushal