We've moved to a new support system!

The Nagios Answer Hub is a place where you can get help with technical questions from our experts. There, you can quickly open tickets and join discussion boards.

Request Nagios Answer Hub access here: https://info.nagios.com/answer-hub-access-new-users

After completing the access form, you will be given access to a portal where new tickets can be created. We will keep the old customer forum sections and ticket system available for current cases to be resolved.

Go to the Answer Hub

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

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

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

Postby MurbiesWalto » Thu Aug 11, 2022 11:03 pm

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;
MurbiesWalto
 
Posts: 9
Joined: Sun Jun 19, 2022 3:28 am

Return to Community Support

Who is online

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