Hello Team,
I am trying to configure check_logfiles plugin to read specific pattern in one of my log file. The log files are generated on daily basis with the below naming convention under this path /var/log
--> bmessenger-YYYYMMDD.log
So how do I inform check_logfiles plugin to monitor only my latest log file ? Any help would be highly appreciated. I have looked at the documentation but I couldn't make anything there.
Below is the documentation.
--> https://labs.consol.de/nagios/check_logfiles/index.html
check_logfiles plugin log rotation
Re: check_logfiles plugin log rotation
A config like this:
and running the plugin like this:
will get you started. You'll need to add the extras like pattern(s) to search for, etc...
Code: Select all
@searches = (
{
logfile => '/var/log/bmessenger-$CL_DATE_YYYY$$CL_DATE_MM$$CL_DATE_DD$',
},
);
Code: Select all
/usr/local/nagios/libexec/check_logfiles --config filename.cfgAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_logfiles plugin log rotation
Hello cdienger,
Thank you for the reply. It is working fine.
Like to have one another clarification.
I have configured the service definition in this file '/usr/local/nagios/etc/objects/templates.cfg'
And in this file '/usr/local/nagios/etc/objects/node.cfg'
And in this file '/usr/local/nagios/etc/objects/commands.cfg'
Is this the recommended approach? Or do we have a better way to define the service, command, host definitions? I am asking this because I have configured service definition in template.cfg file and used the service in node.cfg. Is there a way to configure it in a single file? If yes how?
Thank you for the reply. It is working fine.
Like to have one another clarification.
I have configured the service definition in this file '/usr/local/nagios/etc/objects/templates.cfg'
Code: Select all
define service{
name mservice
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 1
check_period 24x7
max_check_attempts 1
check_interval 3
retry_interval 2
contact_groups admins
notification_options w,u,c
notification_interval 60
notification_period 24x7
register 0
}Code: Select all
define service {
use mservice
host_name jd.messenger.com
service_description check_logfiles
check_command check_logfiles
}Code: Select all
define command{
command_name check_logfiles
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_logfiles
}-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_logfiles plugin log rotation
You could configure all the settings form the template right in the service, but using a template can reduce a lot of work if you have many checks that use the same settings.
All of these can be put in a single file, as long as the file is included with directives in the nagios.cfg
All of these can be put in a single file, as long as the file is included with directives in the nagios.cfg