z

Commercial Support Clients: Clients with support contracts can get escalated support assistance by visiting Nagios Answer Hub. These forums are for community support services. Although we at Nagios try our best to help out on the forums here, we always give priority support to our support clients.

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.

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

Postby RickyReyesmatrina » Tue Aug 30, 2022 1:57 am

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 469 Dec 25 05:59 check_puppet.cfg
Sample run:

[root@prod nagios] /usr/local/nagios/scripts/check_logs.pl -c /usr/local/nagios/custom/check_logs_puppetclient.cfg
puppet_err.log => OK;
RickyReyesmatrina
 
Posts: 7
Joined: Fri Apr 01, 2022 1:24 am

Return to Open Source Nagios Projects

Who is online

Users browsing this forum: Google [Bot] and 26 guests