Ad Widget

Collapse

total bandwidth usage/accounting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • edeus
    Senior Member
    • Aug 2005
    • 120

    #1

    total bandwidth usage/accounting

    I have made some quick changes to the classes.inc.php file so that it gives a total field in the legend.

    Using this, it will provide an accurate bandwidth per period total. This works for my case (which I believe is the defacto way to measure bandwidth on FreeBSD if not others).

    SNMP monitoring of interfaces via standard NET-SNMP monitored value (goes in agent conf):
    net[fxp0in],/usr/local/bin/snmpget -v 1 -c i-public -Oqv localhost IF-MIB::ifInOctets.1
    ... etc this gives a counter value back

    Configure Item configured as "delta (simple change)" so that it gives back only changes in fxp0in. Maybe change your keep history to 90 days or whatever suits your taste. Note: As soon as the value gets converted to trends it will probably loose it's accuracy.

    Apply patch as below (basically just adds up the value and totals it in the graph - Note: changes all graphs).

    If your date range is larger than 24 hours it will grab from trends as most know, here it total will be added up from averages which doesnt really work depending on timeframe/average clock value/etc. To fix, you can simply change the if statement above the $sql lines.

    I added in some quick lines to not show total for items where delta<>2 (simple change) as for anything but this item type, totals make no sense.

    If anyone can improve this, or has a better way of doing it please let me know - I just needed this and thought others might benefit by it. Hopefully a supported totals function in zabbix will surface soon!

    [root (p0)] /usr/local/www/zabbix/include % diff classes.inc.php classes.inc.php-orig
    Code:
    32c32
    <               var $totalval;
    ---
    > 
    41d40
    <               var $itemtype;
    47d45
    <               var $total;
    117d114
    <                       $this->total=array();
    351c348
    <                                       $str=sprintf("%s: %s [min:%s max:%s last:%s total:%s]",
    ---
    >                                       $str=sprintf("%s: %s [min:%s max:%s last:%s]",
    356,357c353
    <                                               convert_units($this->getLastValue($i),$this->items[$i]["units"]),
    <                                               convert_units($this->totalval,$this->items[$i]["units"]));
    ---
    >                                               convert_units($this->getLastValue($i),$this->items[$i]["units"]));
    508a505
    > 
    511,512c508,509
    <                               $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock,value as value from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
    <                       }
    ---
    >                               $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
    >                       }
    515c512
    <                               $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,sum(num) as count,avg(value_avg) as avg,min(value_min) as min,max(value_max) as max,max(clock) as clock,value_avg as value from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
    ---
    >                               $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,sum(num) as count,avg(value_avg) as avg,min(value_min) as min,max(value_max) as max,max(clock) as clock from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)";
    528d524
    <                               $this->total[$this->itemids[$row["itemid"]]][$i]=$row["value"];
    579d574
    <                               $this->totalval=intval($this->totalval)+intval($this->total[$item][$i]);
    593c588
    < 
    ---
    >
  • edeus
    Senior Member
    • Aug 2005
    • 120

    #2
    P.S. patch works with 1.1beta1.

    Comment

    • achu_sab
      Member
      • May 2006
      • 49

      #3
      Can you tell me how I can calculate the total bandwidth usage through an interface (for one day,month etc)? Also I want to give some trigger that give me email notification if the limit I given exceeds. I tried it several times using sum,avg functions and showing 2499204096.00 b/s . I am in trouble with this problem

      Comment

      • stucki
        Junior Member
        • Mar 2006
        • 15

        #4
        is there an update for v1.1 :-)

        Comment

        • primerose
          Junior Member
          • Oct 2011
          • 4

          #5
          Monthly Bandwidth usage

          Originally posted by achu_sab
          Can you tell me how I can calculate the total bandwidth usage through an interface (for one day,month etc)? Also I want to give some trigger that give me email notification if the limit I given exceeds. I tried it several times using sum,avg functions and showing 2499204096.00 b/s . I am in trouble with this problem
          Hi all,

          I'm quite new to Zabbix. I want to generate a report to get the bandwidth usage for a snmp enabled host for the entire month. If anyone can help me with that I will be very Thankful.

          Pls advice me on this.

          Thanks a lot,

          Comment

          Working...