错误记录在文件/var/log/puppet/error.log中。配置文件是
/usr/local/nagios/custom/check_puppet.cfg该文件的内容如下:
[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:)',
},
);你知道为什么会发生这种情况吗?
错误文件的内容:
[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文件权限为用户nagios,组nagios:
[root@prod nagios] ls -l | grep check_puppet
total 164
-rw-r-----. 1 nagios nagios 469 Dec 25 05:59 check_puppet.cfg示例运行:
[root@prod nagios] /usr/local/nagios/scripts/check_logs.pl -c /usr/local/nagios/custom/check_logs_puppetclient.cfg
puppet_err.log => OK;发布于 2019-12-28 00:23:59
我不知道你使用的是哪个版本的插件,但根据官方documentation,没有指令reg_exp和file_name。
我认为你应该使用criticalpatterns,就像这样:
$seek_file_template='/var/log/puppet/$log_file.puppet-agent.check_log.seek';
@log_files =
(
{
'logfile' => '/var/log/puppet/error.log',
'criticalpatterns' => ['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:'],
},
);https://stackoverflow.com/questions/59492216
复制相似问题