Variable Date Macro?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bpablo
Posts: 2
Joined: Thu Apr 07, 2011 11:37 am

Variable Date Macro?

Post by bpablo »

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"
)
rdedon
Posts: 578
Joined: Sat Nov 20, 2010 4:51 pm

Re: Variable Date Macro?

Post by rdedon »

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. :-)
Rene deDon
Technical Team
___
Nagios Enterprises, LLC
Web: http://www.nagios.com
bpablo
Posts: 2
Joined: Thu Apr 07, 2011 11:37 am

Re: Variable Date Macro?

Post by bpablo »

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?
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Variable Date Macro?

Post by tonyyarusso »

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"
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
Locked