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
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
<
---
>
Comment