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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

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

Post 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!
Last edited by iam33 on Wed Dec 20, 2017 7:15 am, edited 1 time in total.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

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

Post by iam33 »

It´s Works!
thank you so much!
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

I am glad I could help! :)
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked