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

Vector Graph Aggregations Broken For Datasets

XMLWordPrintable

    • S24-W38/39, S24-W40/41, S24-W42/43, S24-W46/47, S24-W48/49
    • 2

      Zabbix Team - 

      The vector graph widget aggregations are broken in 6.2 and probably 6.4 (6.0 is fine). For example, plot 2 metrics in the graph widget. Let's just say the values for both items are always "50". Then change the aggregation from 'none' to 'sum'. If you aggregate by each item it's fine and both items will still show "50" no matter what the aggregation interval. If you stack them, you get "100". However, if you change it to aggregate the dataset instead of each item you lose the second item and any others you add to the dataset and the value will always be "50".

      I was able to track this down in CSvgGraphHelper.php. In version 6.0 there was a switch statement to handle the proper aggregation, but it looks like that code was ripped out and wasn't migrated anywhere else starting in version 6.2. I'm guessing this was missed while adding the new graph widget features in version 6.2. 

       

      I was able to patch this on my system by adding the switch statements back. For example:

                                     $new_metric_points = []; 
                                      switch ($metric['options']['aggregate_function']) {
                                              case AGGREGATE_MIN:
                                                      foreach ($metric_points as $tick => $point)
      
      {                                                         $new_metric_points[$tick]['value'][] = min($point['value']);                                                 }
      
                                                      break;
                                              case AGGREGATE_MAX:
                                                      foreach ($metric_points as $tick => $point)
      
      {                                                         $new_metric_points[$tick]['value'][] = max($point['value']);                                                 }
      
                                                      break;
                                              case AGGREGATE_AVG:
                                                      foreach ($metric_points as $tick => $point)
      
      {                                                         $new_metric_points[$tick]['value'][] = CMathHelper::safeAvg($point['value']);                                                 }
      
                                                      break;
                                              case AGGREGATE_COUNT:
                                                      foreach ($metric_points as $tick => $point)
      
      {                                                         $new_metric_points[$tick]['value'][] = array_sum($point['value']);                                                 }
      
                                                      break;
                                             case AGGREGATE_SUM:
                                                     foreach ($metric_points as $tick => $point)
      
      {                                                        $new_metric_points[$tick]['value'][] = array_sum($point['value']);                                                 }
      
                                                     break;
      

      And then just set $metric_points = $new_metric_points before looping through to build the $metric['points'] array with the approximations for avg, min and max.

      Also, I don't really understand the use of 'first' and 'last', so I did not include those case statements above. 'first' and 'last' don't really seem well-defined. Perhaps that is a topic for a different ticket though.

        1. avg-17.5.png
          avg-17.5.png
          34 kB
        2. History.png
          History.png
          45 kB
        3. image-2024-11-21-12-07-53-932.png
          image-2024-11-21-12-07-53-932.png
          99 kB
        4. image-2024-12-20-10-25-40-750.png
          image-2024-12-20-10-25-40-750.png
          81 kB
        5. image-2024-12-20-10-29-56-596.png
          image-2024-12-20-10-29-56-596.png
          160 kB
        6. Trends.png
          Trends.png
          40 kB

            agriscenko Andrejs Griščenko
            GRyan337 Ryan Eberly
            Team A
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 16h
                16h