Page 1 of 1

howto find if a string is repeating N times in one minute

Posted: Fri Dec 15, 2017 7:44 am
by iam33
Hi!

I have never used this plugin and I need help with it.
I need to configure a check with check_logfiles that finds if a string is repeating N times in one minute, in a log file. If this string appears N times or more show an CRITICAL error, if not, OK.

Thanks in advance!

Re: howto find if a string is repeating N times in one minut

Posted: Fri Dec 15, 2017 3:39 pm
by lmiltchev
You can create a config file similar to the one below, and place it in the plugins directory:

Code: Select all

$seekfilesdir = '/tmp';
$protocolsdir = '/tmp';
$scriptpath = '/usr/local/nagios/libexec';

@searches = (
{
tag => 'error',
criticalpatterns => [ 'error' ] ,
criticalthreshold => 5,
options => 'noprotocol,report=long,allyoucaneat',
logfile => '/tmp/error.log'
}
);
Note: Set "criticalthreshold" and "logfile" values according to your needs.

Test it from the command line:

Code: Select all

/usr/local/nagios/libexec/check_logfiles -f yourconfig.conf
where you substitute "yourconfig.conf" with the actual config name. Schedule the check to run every minute.

Let us know if this helped.

Re: howto find if a string is repeating N times in one minut

Posted: Wed Dec 20, 2017 7:15 am
by iam33
It´s Works!
thank you so much!

Re: howto find if a string is repeating N times in one minut

Posted: Wed Dec 20, 2017 10:11 am
by lmiltchev
I am glad I could help! :)