Nagios check_logs.pl gives OK even with Error in log file

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.
Post Reply
MurbiesWalto
Posts: 10
Joined: Sun Jun 19, 2022 3:28 am

Nagios check_logs.pl gives OK even with Error in log file

Post by MurbiesWalto »

I am using check_logs.pl file of Nagios to check for error in a log file for any errors in puppet run. Errors are logged in a file /var/log/puppet/error.log. The config file is

/usr/local/nagios/custom/check_puppet.cfg
contents of the file are:

[root@prod nagios] cat /usr/local/nagios/custom/check_puppet.cfg
$seek_file_template='/var/log/puppet/$log_file.puppet-agent.check_log.seek';

@log_files =
(
{
'file_name' => '/var/log/puppet/error.log',
'reg_exp' => '(Could not send report:|Could not retrieve file metadata for |Could not retrieve catalog from remote server|Could not retrieve catalog; skipping run|Error 500 on SERVER:)',
},
);
The problem is I am getting OK irrespective of the contents of the error file.i.e The log file contains error still the output is OK. Any ideas why this is happening??.

Contents of error file:

[root@prod nagios] cat /var/log/puppet/error.log
Dec 25 11:13:12 prod puppet-agent: Could not retrieve catalog; skipping run
Dec 25 11:33:53 prod puppet-agent: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find data item internalrepo::prod::repo_server in any Hiera data file and no default supplied at /etc/puppet/modules/prod-modules/manifests/params.pp:112:26 on node prod.maker.com
Dec 25 11:33:53 prod puppet-agent: Could not retrieve catalog; skipping run
File permissions are user nagios, group nagios:

[root@prod nagios] ls -l | grep check_puppet
total 164
-rw-r-----. 1 nagios nagios omegle.2yu.co 469 Dec 25 05:59 check_puppet.cfg
Sample run:

[root@prod nagios] /usr/local/nagios/scripts/check_logs.pl omeglz echat -c /usr/local/nagios/custom/check_logs_puppetclient.cfg
puppet_err.log => OK;
Post Reply