config file option
Hi Lausser,
I really like your check_logfiles plugin, but i'm unable to make it work with -f option :(
I've created this config file:
@searches = ( { tag => 'test', logfile => '/var/log/messages', criticalpatterns => ['EXIT'] } );
very simple, just to test.
I've seen several lines like "Apr 3 01:55:21 server01 xinetd[4678]: EXIT: vnetd status=0 pid=32460 duration=0(sec)" in /var/log/messages
Then:
./check_logfiles -d --logfile /var/log/messages --criticalpattern='EXIT' --type=virtual 2.CRITICAL - (6 errors in check_logfiles.protocol-2017-04-04-16-03-12) - Apr 4 02:44:45 server01 xinetd[4678]: EXIT: vnetd status=0 pid=19013 duration=0(sec) ...|default_lines=31 default_warnings=0 default_criticals=6 default_unknowns=0
But when I use the config file option:
./check_logfiles --config /opt/nagios/conf/error_kernel_patterns.cfg --type=virtual 2.OK - no errors or warnings|test_lines=0 test_warnings=0 test_criticals=0 test_unknowns=0
What am i missing?
Your configuration is different. When supplying the configuration on the command line you specified type=virtual while in the configuration file you did not:
$ echo EXIT >> /tmp/messages $ check_logfiles -d --logfile /tmp/messages --criticalpattern='EXIT' CRITICAL - (1 errors in check_logfiles.protocol-2018-04-12-21-25-33) - EXIT |'default_lines'=1 'default_warnings'=0 'default_criticals'=1 'default_unknowns'=0
Remove the state file and try again with the configuration file where type=virtual is set:
$ rm -f /tmp/check_logfiles* $ check_logfiles -f test.cfg CRITICAL - (1 errors in test.protocol-2018-04-12-21-26-05) - EXIT |'default_lines'=1 'default_warnings'=0 'default_criticals'=1 'default_unknowns'=0
So, I don't think it's a bug, maybe something to discuss on the mailing lists (?).