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