timestamp in macro and log files

Vincent Reydet mrlag at buggynet.org
Mon Apr 20 23:38:57 CEST 2009


Hi,

I'm currently trying to get the timestamp of a service check with the  
event handler.

But I fail to get the same timestamp as the one on the nagios log file.

if I have this handler:

define command{
         command_name event-test
         command_line /bin/echo $LASTSERVICECHECK$  
$LASTSERVICESTATECHANGE$ $SERVICEEXECUTIONTIME$ >> /tmp/nagios.test
}

with this result on my tmp file:

chaos:/etc/nagios2# tail -f /tmp/nagios.test
1240264409 1240264409 0.014
1240264469 1240264409 0.014

and this on the nagios log file:
[1240264411] SERVICE ALERT: localhost;http test;CRITICAL;SOFT; 
1;CRITICAL - string not found
[1240264411] SERVICE EVENT HANDLER: localhost;http test;CRITICAL;SOFT; 
1;event-test
[1240264471] SERVICE ALERT: localhost;http test;CRITICAL;HARD; 
2;CRITICAL - string not found
[1240264471] SERVICE EVENT HANDLER: localhost;http test;CRITICAL;HARD; 
2;event-test

there are 2 seconds between them.

I want to put the data on a database and report the same date as the  
nagios web interface.

Do you know where I can have the same timestamp as the log file ?
Why there are two differents values ?

I'm using nagios 2.6 (debian)

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p




More information about the Developers mailing list