Ad Widget

Collapse

Patch "TOTAL" Bandwidth

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ypircc
    Junior Member
    • Jun 2006
    • 7

    #1

    Patch "TOTAL" Bandwidth

    Hello, we needed a way to get the "total" bandwidth (IN and OUT) of all our servers, so I editted some PHP to display this for us. First of all, this patch is for include/items.inc.php in the zabbix 1.1 frontend. Also, it only works if the description for your bandwidth usage (in and out) are either Bandwidth IN eth0 or Bandwidth OUT eth0 ... the eth0 part is not necessary and you can replace it with anything, but the description MUST have at least the words Bandwidth IN or Bandwidth OUT (e.g. Bandwidth OUT eth1, Bandwidth OUT eth2 etc...) Here is the patch..
    Code:
    --- ../zabbix-1.1/frontends/php/include/items.inc.php   2006-05-23 10:14:26.000000000 -0400
    +++ include/items.inc.php       2006-06-28 09:20:05.000000000 -0400
    @@ -589,6 +589,8 @@
                    }
                    $table->SetHeader($header,'vertical_header');
                    $curr_rime = time();
    +               $OUTBOUND = 0; // CRIPY EDIT
    +               $INBOUND = 0; // CRIPY EDIT
                    foreach($items as $descr => $ithosts)
                    {
                            $table_row = array(nbsp($descr));
    @@ -607,11 +609,29 @@
                                                    $value = convert_units($ithosts[$hostname]["lastvalue"],$ithosts[$hostname]["units"]);
                                            else
                                                    $value = htmlspecialchars(substr($ithosts[$hostname]["lastvalue"],0,20)." ...");
    +                                       /* CRIPY EDIT */
    +                                       if (strpos($descr, "Bandwidth OUT") !== FALSE) {
    +                                               $OUTBOUND += $ithosts[$hostname]["lastvalue"];
    +                                       }
    +                                       if (strpos($descr, "Bandwidth IN") !== FALSE) {
    +                                               $INBOUND += $ithosts[$hostname]["lastvalue"];
    +                                       }
    +                                       /* CRIPY EDIT END */
    +
                                    }
                                    array_push($table_row,new CCol($value,$style));
                            }
                            $table->AddRow($table_row);
                    }
    +               /* CRIPY EDIT */
    +               $table_row = array(nbsp("Total Bandwidth OUT"));
    +               array_push($table_row,new CCol(convert_units($OUTBOUND, 'bps'),$style));
    +                $table->AddRow($table_row);
    +               $table_row = array(nbsp("Total Bandwidth IN"));
    +               array_push($table_row,new CCol(convert_units($INBOUND, 'bps'),$style));
    +               $table->AddRow($table_row);
    +               /* CRIPY EDIT END */
    +
     COpt::profiling_stop('prepare table');
    
                    return $table;
    Last edited by ypircc; 28-06-2006, 21:20.
  • timmi
    Junior Member
    • Jul 2005
    • 8

    #2
    I have some external links (on different cisco switches) and want to get summary bandwith graph. don't know haw to set it...

    Comment

    • mike_k
      Junior Member
      • May 2006
      • 18

      #3
      Originally posted by timmi
      I have some external links (on different cisco switches) and want to get summary bandwith graph. don't know haw to set it...
      Hmm, seems many of us want such a nice feature: http://www.zabbix.com/forum/showthre...newpost&t=3680
      It is also related to general calculations on the items.

      Comment

      • emx
        Junior Member
        • Aug 2006
        • 19

        #4
        Coming soon...

        See thread "Calculated Item" (http://zabbix.com/forum/showthread.php?t=1368)

        Originally posted by Alexei
        I do not see any technical problems to have this feature implemented and it possibly will be done if this fits nicely into design of 1.4.

        Comment

        Working...