Ad Widget

Collapse

patch - display average on graphs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elmerfud
    Junior Member
    • Sep 2007
    • 6

    #1

    patch - display average on graphs

    This is my quick hack to have graphs display averages in addition to min, max, and last values.

    I'm not 100% sure that $data->avg is the array that I want to compute off of, but it seems to give me sensible results. Perhaps $data->max would be better?

    Code:
    --- ./zabbix-1.4.2/frontends/php/include/classes/graph.inc.php      2007-08-20 14:22:23.000000000 -0500
    +++ ./zabbix-1.4.2/include/classes/graph.inc.php        2007-09-25 14:51:08.525391334 -0500
    @@ -626,12 +626,13 @@
                                    $data = &$this->data[$this->items[$i]["itemid"]][$this->items[$i]["calc_type"]];
                                    if(isset($data)&&isset($data->min))
                                    {
    -                                       $str=sprintf("%s: %s [%s] [min:%s max:%s last:%s]",
    +                                       $str=sprintf("%s: %s [%s] [min:%s max:%s avg:%s last:%s]",
                                                    str_pad($this->items[$i]["host"],$max_host_len," "),
                                                    str_pad($this->items[$i]["description"],$max_desc_len," "),
                                                    $fnc_name,
                                                    convert_units(min($data->min),$this->items[$i]["units"]),
                                                    convert_units(max($data->max),$this->items[$i]["units"]),
    +                                                convert_units((array_sum($data->avg)/count($data->avg)),$this->items[$i]["units"]),
                                                    convert_units($this->getLastValue($i),$this->items[$i]["units"]));
                                    }
                                    else
  • bbrendon
    Senior Member
    • Sep 2005
    • 870

    #2
    Does anyone know if this or something similar is going to be merged into the code?

    I just realized it is quite annoying not getting an average # in the graphs. An options dotted line where the average is on the graph would be nice too!

    Is there a technical limitation on making averages?
    Unofficial Zabbix Expert
    Blog, Corporate Site

    Comment

    • Crazy Marty
      Member
      • Sep 2007
      • 75

      #3
      Actually, I'm thinking a better generalization would be to have each of "min", "max", "avg", "last" in the legend be enabled/disabled individually (are there any others?).

      I also agree, it'd be nice to display a trigger threshold as well (selectable in the graph).

      Comment

      • dminstrel
        Member
        • Apr 2005
        • 72

        #4
        For some reason, this patch was not added to 1.6. This is now in include/classes/chart.inc.php at line 360.

        Cheers,

        Comment

        Working...