Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-1076

IT Services SLA for "this month, week, year" not calculated correctly.

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.6, 1.9.0 (alpha)
    • Fix Version/s: None
    • Component/s: Frontend (F)
    • Labels:
      None
    • Environment:
      CentOS 4 running PHP 5.1.6 on mysql 5.0

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              urkle Edward Rudd
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: