I am attempting to set up a check command to monitor a log file. The issue I am having is the log file has a variable date. And I have not been able to find a marco that can accommodate this. Any suggestions?
define service{
service_description Intergation Sever Broker connection
hostgroup_name opstest-is
use log-service
servicegroups opstest-websphere-logs
contact_groups ese-contactgroup
check_command check_nrpe!check_logfiles!/var/log/ops/wmlogs/server$CL_DATE_YYYY$$CL_DATE_MM$$CL_DATE_DD$.log $HOSTNAME$_log "JMS: Lost connection to Broker"
)
Variable Date Macro?
Re: Variable Date Macro?
Here is a large list of usable macros for you:
http://nagios.sourceforge.net/docs/3_0/macrolist.html
There are some time specific related ones if you hit F3 and enter Date/Time Macros
Hope this helps! Feel free to post if you have any additional questions or issues.
http://nagios.sourceforge.net/docs/3_0/macrolist.html
There are some time specific related ones if you hit F3 and enter Date/Time Macros
Hope this helps! Feel free to post if you have any additional questions or issues.
Re: Variable Date Macro?
Thanks, Unfortunately it doesn't put it in the format I need. The only options for those is :
Format: date_format=<option>
Example: date_format=us
This option allows you to specify what kind of date/time format Nagios should use in the web interface and date/time macros. Possible options (along with example output) include:
Option Output Format Sample Output
us MM/DD/YYYY HH:MM:SS 06/30/2002 03:15:00
euro DD/MM/YYYY HH:MM:SS 30/06/2002 03:15:00
iso8601 YYYY-MM-DD HH:MM:SS 2002-06-30 03:15:00
strict-iso8601 YYYY-MM-DDTHH:MM:SS 2002-06-30T03:15:00
I need to have YYYYMMDD with no dashes, backslashes or hr-mm-ss. Any idea how to set to that?
Format: date_format=<option>
Example: date_format=us
This option allows you to specify what kind of date/time format Nagios should use in the web interface and date/time macros. Possible options (along with example output) include:
Option Output Format Sample Output
us MM/DD/YYYY HH:MM:SS 06/30/2002 03:15:00
euro DD/MM/YYYY HH:MM:SS 30/06/2002 03:15:00
iso8601 YYYY-MM-DD HH:MM:SS 2002-06-30 03:15:00
strict-iso8601 YYYY-MM-DDTHH:MM:SS 2002-06-30T03:15:00
I need to have YYYYMMDD with no dashes, backslashes or hr-mm-ss. Any idea how to set to that?
-
tonyyarusso
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Variable Date Macro?
Skip the macros entirely, and just use this:
Code: Select all
check_command check_nrpe!check_logfiles!/var/log/ops/wmlogs/server`date +%Y%m%d`$.log $HOSTNAME$_log "JMS: Lost connection to Broker"