-
Incident report
-
Resolution: Fixed
-
Major
-
None
-
1.6.6, 1.9.0 (alpha)
-
None
-
CentOS 4 running PHP 5.1.6 on mysql 5.0
While reviewing the srv_status.php in order to patch in "previous week/month/year" functionality I noticed a rather odd thing.
the value of $period_start_sec is inconsistent. for the "today, this week/month/year" a absolute unix timestamp is stored in the variable.
However, for the "last 7/30/365 days" options a "relative" value is stored in the variable.
Later on when the extents of the SLA are calculated (the $start and $end variables) the $period_start_sec is treated as a relative instead of an absolute.
Thus, if you choose "this month" you actually get EVERYTHING. as $start is calculated as $now-(time for beginning of month) So for example..
$now = time(); // assume 2009-10-30 14:00 localtime;
$period_start_sec = mktime(0,0,0,date('n'), 1, date('Y')); // this would generate timestamp for 2009-10-01 00:00:00 local time
now when $start is calculated it is this
$start = $now - $period_start_sec;
which results in $start being the # of seconds since the first of the month until "now". which when treated as a unix stamp is 1970-01-30 14:00.
this results in pulling in ALL sla history all the time (as no one has sla alarm data for 1970)
I have a patch I'll attach that fixes this issue.