Check_logfiles (logfiles) exclusion pattern in a file


Currently we are using very old nagios and check_logfiles to monitor the postgresDB logs.

The monitoring is such that there is a exclusion file “ignore.txt” which has a list of all the codes / patterns which needs to be excluded in case it is written in the log.

The existing cfg file looks like below. Honestly this was created long back and I have no clue how to decipher this…

*$tag = 'DB_POSTGRES_LOG_hostname:dbname';*
*$grouperrors = 1;*
*$loghostname = 'hostname';*
*$seekfilesdir = '/srv/postgresql/var/dbname/log';*
*$protocolsdir = '/sysmgmt/nagios/plugins/var/tmp';*
*$protocolretention = 2;*
*$criticalprotocolfile = '/sysmgmt/nagios/plugins/var/log/critical.log';*
*$ignorepatternfiles = [ '/sysmgmt/nagios/plugins/etc/check_logfiles/postgresql_ignore.txt', '/sysmgmt/nagios/plugins/etc/check_logfiles/postgresql_ignore.hostname.txt' '/sysmgmt/nagios/plugins/etc/check_logfiles_v2/postgresql_ignore.hostname:dbname.txt' ];*
*$logfile = '/srv/postgresql/var/dbname/log/postgresql-instance.log';*
*$logfileprefix = '%t [%p-%l] (%e) %q%u@%d (%a) ';*
*@searches = ({*
*tag => $tag,*
*logfile => $logfile,*
*logfileprefix => $logfileprefix});*

I want to make it simple and achieve the monitoring using icinga and Director combination.

if you can share any screenshot of director on similar service creation lines will be very helpful

You can also use the check “check_logfiles” and this exclusion file with Icinga.
Just create a new command in the director
in command field you write the complete call like before including the parameters.
It is of course cleaner if you put the arguments in the tab “Arguments”

this is an example from a new check to Monitor a NetApp which we found on GitHub:

1 Like

Hello Stevie

Thank You for your response. I have already got the argument prepared.

I am confused with the settings. I will put the Postgres Logfile path in the logfiles_logfile field.
I want to monitor the logfile of postgres with an exception file.

I have a exception file (/sysmgmt/nagios/plugins/etc/check_logfiles/postgresql_ignore.txt) which has a list of Error Codes for which I do not need alert…Rest of any line written in the log should raise alarm

This is done above in the current nagios using the same plugin and the cfg file I posted above.

you’re welcome. With the Settings for this check I can’t really help. Because we don’t use this. So I’m sorry I don’t know how “to translate” the file “ignore.txt” into a config for the director.
But if you take a look into the docs of the check, you will finde some definitions from the Options in your file

1 Like