(no subject)

Adam Luchjenbroers adam at luchjenbroers.com
Thu Mar 18 07:24:45 CET 2004


I have written a perl script which parses incoming syslog data and submits
information to nagios via the command file.

I am having an issue where the reported time in Nagios is 12 hours in front
of what it should be, this issue only exists for this particular service.

The code used to do the translations from date to epoch and epoch to date
are provided below.

sub epoch {
open (DATE, "date -d \'$_[0]\' +\%s 2> /dev/null |");
$epoch = <DATE>;
if ($epoch == 0) {
open (DATE, "date +\%s |");
$epoch = <DATE>;
}
close DATE;
chomp $epoch;
return $epoch;
}

sub date {
@date = localtime($_[0]);
return sprintf("%s %2s %02s:%02s:%02s", $months{$date[4]}, $date[3],
$date[2], $date[1], $date[0]);
}

The epoch to date conversion has been used specifically to test the date to
epoch conversion and has verified that it functions correctly (two scripts
are used to test it, one generating dates at 1hr intervals and the other
converting to epoch and back and verifying that the date reported is the
same).

Anything people might recommend looking into?


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list