Commit 4ff73f0d authored by 's avatar
Browse files

Added support for multiple host, which includes multiple interface support too.

Tested with new GUI (PHP); CGI GUI shows just first two hosts.

Flow is assigned to opposite sensor when it appears there too (same flow).
Unassigned flows are dropped, so filter has not to be exact,
something void like "greater 0" should work.

The differences against prev. impl. of multiple interface support
(subject to keep or change?):

prev.:
Usage: hostA:if1:if2, hostB... "filter"

now:
Usage: "hostA:if1, hostA:if2" "hostB..." "filter"

-more typing
+DiMAPI syntax
?no need to parse and store device names

prev.:
mapi_stats("hostA:if1", &(stats1->statstable[i%countA]))
mapi_stats("hostA:if2", &(stats1->statstable[++i%countA]))

now:
mapi_stats("host1:if1, host1:if2", &host[0].mapi_stats_dev).

-order of devices not guaranteed so reordering* is done via pointers
+less mapi function calls
?no need to store device names
?unique interface names required in case of reordering*
*)for now, order never changes

prev:
  for(i = 0; i < stats1.count;i++) { // host1
    stats = stats1.statstable[i];
    stats.hostname...
  for(i = 0; i < stats2.count;i++) { // host2
    ...

now:
  for(h = 0; h < hosts; h++) {
    for(d = 0; d < host[h].devices; d++) {
      stats = host[h].mapi_stats_dev[d];
      host[h].name...

parse_hosts() -- not a function (more simple as device names are not parsed and
stored, just counted)

get_mapi_stats() -- not a function (more simple because of prev. mentioned diffs)

GUI (CSV, PHP, JS) -- several updates



git-svn-id: file:///home/svn/mapi/trunk@1340 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 662258a4
...@@ -17,7 +17,7 @@ packetloss_top = "/path/to/packetloss/packetloss_top.csv" ...@@ -17,7 +17,7 @@ packetloss_top = "/path/to/packetloss/packetloss_top.csv"
# enable or disable tops # enable or disable tops
enable_packetloss_top enable_packetloss_top
#enable_appmon_top enable_protocol_top
# keep as is # keep as is
output = "-" output = "-"
...@@ -8,7 +8,7 @@ require_once "${DIR}lib/graph.php"; ...@@ -8,7 +8,7 @@ require_once "${DIR}lib/graph.php";
# }}} # }}}
$allowed_args = ",predefined,start,end,width,height,upperLimit,lowerLimit,onlyGraph,title,"; $allowed_args = ",host0rrddsid,host1rrddsid,predefined,start,end,width,height,upperLimit,lowerLimit,onlyGraph,title,";
foreach(array_keys($_GET) as $key) { foreach(array_keys($_GET) as $key) {
if(strpos($allowed_args,",$key,") !== false) { if(strpos($allowed_args,",$key,") !== false) {
...@@ -26,8 +26,8 @@ foreach(array_keys($_GET) as $key) { ...@@ -26,8 +26,8 @@ foreach(array_keys($_GET) as $key) {
//); //);
//$predefined = $predefinedarr[$predefined]; // filter values //$predefined = $predefinedarr[$predefined]; // filter values
if($predefined != "") $graph = new Graph("packetcount", $predefined, "", "", $width, $height); if($predefined != "") $graph = new Graph("packetcount", $host0rrddsid, $host1rrddsid, $predefined, "", "", $width, $height);
else $graph = new Graph("packetcount", "", $start, $end, $width, $height, $title); else $graph = new Graph("packetcount", $host0rrddsid, $host1rrddsid, "", $start, $end, $width, $height, $title);
//$graph->dry_run(); //$graph->dry_run();
$graph->flush(); $graph->flush();
......
...@@ -8,7 +8,7 @@ require_once "${DIR}lib/graph.php"; ...@@ -8,7 +8,7 @@ require_once "${DIR}lib/graph.php";
# }}} # }}}
$allowed_args = ",predefined,start,end,width,height,upperLimit,lowerLimit,onlyGraph,title,"; $allowed_args = ",host0rrddsid,host1rrddsid,predefined,start,end,width,height,upperLimit,lowerLimit,onlyGraph,title,";
foreach(array_keys($_GET) as $key) { foreach(array_keys($_GET) as $key) {
if(strpos($allowed_args,",$key,") !== false) { if(strpos($allowed_args,",$key,") !== false) {
...@@ -26,8 +26,8 @@ foreach(array_keys($_GET) as $key) { ...@@ -26,8 +26,8 @@ foreach(array_keys($_GET) as $key) {
//); //);
//$predefined = $predefinedarr[$predefined]; // filter values //$predefined = $predefinedarr[$predefined]; // filter values
if($predefined != "") $graph = new Graph("packetloss", $predefined, "", "", $width, $height); if($predefined != "") $graph = new Graph("packetloss", $host0rrddsid, $host1rrddsid, $predefined, "", "", $width, $height);
else $graph = new Graph("packetloss", "", $start, $end, $width, $height, $title); else $graph = new Graph("packetloss", $host0rrddsid, $host1rrddsid, "", $start, $end, $width, $height, $title);
//$graph->dry_run(); //$graph->dry_run();
$graph->flush(); $graph->flush();
......
...@@ -235,7 +235,6 @@ $form["time"] = new FormElement( // select - option (more selects) ...@@ -235,7 +235,6 @@ $form["time"] = new FormElement( // select - option (more selects)
clear: left; clear: left;
margin-top: 2em; margin-top: 2em;
border-top: 5px solid #F0F0F0; border-top: 5px solid #F0F0F0;
color: gray;
} }
.thetop { .thetop {
margin-top: 2em; margin-top: 2em;
...@@ -307,7 +306,7 @@ $form["time"] = new FormElement( // select - option (more selects) ...@@ -307,7 +306,7 @@ $form["time"] = new FormElement( // select - option (more selects)
echo <<<EOD echo <<<EOD
<div class="tr"> <div class="tr">
<span class="th"><label for="_$name_$key">$hostname</label></span> <span class="th"><label for="_$name_$key">$hostname</label></span>
<span class="td"><input id="_$name_$key" type="checkbox" name="${name}[]"$checked value="$key" disabled="disabled" /></span> <span class="td"><input id="_$name_$key" type="checkbox" name="${name}[]"$checked value="$key" /></span>
</div>\n </div>\n
EOD; EOD;
} }
...@@ -525,86 +524,113 @@ $height = ($form["graph_size"]->isChecked("large") ? "300" : ($form["graph_size" ...@@ -525,86 +524,113 @@ $height = ($form["graph_size"]->isChecked("large") ? "300" : ($form["graph_size"
$widthpx = ($width + 97) . "px"; $widthpx = ($width + 97) . "px";
$heightpx = ($height + 93) . "px"; $heightpx = ($height + 93) . "px";
switch($form["time_type"]->selectedvals) { foreach($form["subject"]->elementvals as $key0 => $val0) {
case "predefined": $checked0 = $form["subject"]->isChecked($key0);
$name = $form["times"]->name; $host0rrddsid = $val0["rrddsid"]["value"]; // key0
foreach($form["times"]->elementvals as $key => $val) { $host0name = $val0["hostname"]["value"];
$checked = $form["times"]->isChecked($key); if($checked0)
if($checked) { foreach($form["subject"]->elementvals as $key1 => $val1) {
$aquery = arr2query(array( $checked1 = $form["subject"]->isChecked($key1);
"predefined" => $key, $host1rrddsid = $val1["rrddsid"]["value"]; // key1
"width" => 500, $host1name = $val1["hostname"]["value"];
"height" => 300 if($checked1) {
)); if($host1rrddsid == $host0rrddsid) break;
$iquery = arr2query(array(
"predefined" => $key, switch($form["time_type"]->selectedvals) {
"width" => $width, case "predefined":
"height" => $height $name = $form["times"]->name;
)); foreach($form["times"]->elementvals as $key => $val) {
$checked = $form["times"]->isChecked($key);
$name2 = $form["characteristics"]->name; if($checked) {
foreach($form["characteristics"]->elementvals as $key2 => $val2) { $aquery = arr2query(array(
"host0rrddsid" => $host0rrddsid,
"host1rrddsid" => $host1rrddsid,
"predefined" => $key,
"width" => 500,
"height" => 300
));
$iquery = arr2query(array(
"host0rrddsid" => $host0rrddsid,
"host1rrddsid" => $host1rrddsid,
"predefined" => $key,
"width" => $width,
"height" => $height
));
$name2 = $form["characteristics"]->name;
foreach($form["characteristics"]->elementvals as $key2 => $val2) {
echo <<<EOD echo <<<EOD
<div class="graph"> <div class="graph">
<a href="graph/$key2.php?$aquery" title="TODO"><img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" class="mirage" alt="TODO" title="TODO" /><br /> <a href="graph/$key2.php?$aquery" title="TODO"><img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" class="mirage" alt="TODO" title="TODO" /><br />
<span style="width: $widthpx; text-align: center;">$val ($val2)</span></a> <span style="width: $widthpx; text-align: center;">$val ($val2)</span></a>
</div>\n </div>\n
EOD; EOD;
} }
} }
} }
break; break;
case "start_time": case "start_time":
$aquery = arr2query(array( $aquery = arr2query(array(
"start" => $gmseconds, "host0rrddsid" => $host0rrddsid,
"end" => ($gmseconds + time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)), "host1rrddsid" => $host1rrddsid,
"width" => 500, "start" => $gmseconds,
"height" => 300 "end" => ($gmseconds + time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)),
)); "width" => 500,
$iquery = arr2query(array( "height" => 300
"start" => $gmseconds, ));
"end" => ($gmseconds + time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)), $iquery = arr2query(array(
"width" => $width, "host0rrddsid" => $host0rrddsid,
"height" => $height "host1rrddsid" => $host1rrddsid,
)); "start" => $gmseconds,
"end" => ($gmseconds + time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)),
$name2 = $form["characteristics"]->name; "width" => $width,
foreach($form["characteristics"]->elementvals as $key2 => $val2) { "height" => $height
));
$name2 = $form["characteristics"]->name;
foreach($form["characteristics"]->elementvals as $key2 => $val2) {
echo <<<EOD echo <<<EOD
<div class="graph"> <div class="graph">
<a href="graph/$key2.php?$aquery" title="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height."> <a href="graph/$key2.php?$aquery" title="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height.">
<img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" alt="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" /> <img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" alt="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" />
</a> </a>
</div>\n </div>\n
EOD; EOD;
} }
break; break;
case "end_time": case "end_time":
$aquery = arr2query(array( $aquery = arr2query(array(
"start" => ($gmseconds - time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)), "host0rrddsid" => $host0rrddsid,
"end" => $gmseconds, "host1rrddsid" => $host1rrddsid,
"width" => 500, "start" => ($gmseconds - time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)),
"height" => 300 "end" => $gmseconds,
)); "width" => 500,
$iquery = arr2query(array( "height" => 300
"start" => ($gmseconds - time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)), ));
"end" => $gmseconds, $iquery = arr2query(array(
"width" => $width, "host0rrddsid" => $host0rrddsid,
"height" => $height "host1rrddsid" => $host1rrddsid,
)); "start" => ($gmseconds - time_to_sec($form["time_length_number"]->selectedvals, $form["time_length_unit"]->selectedvals)),
"end" => $gmseconds,
$name2 = $form["characteristics"]->name; "width" => $width,
foreach($form["characteristics"]->elementvals as $key2 => $val2) { "height" => $height
));
$name2 = $form["characteristics"]->name;
foreach($form["characteristics"]->elementvals as $key2 => $val2) {
echo <<<EOD echo <<<EOD
<div class="graph"> <div class="graph">
<a href="graph/$key2.php?$aquery" title="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height."> <a href="graph/$key2.php?$aquery" title="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height.">
<img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" alt="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" /> <img src="graph/$key2.php?$iquery" width="$widthpx" height="$heightpx" alt="User Defined: From &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" />
</a> </a>
</div>\n </div>\n
EOD; EOD;
}
break;
}
}
} }
break; }
}
?> ?>
<?php /* <?php /*
<div class="graph"> <div class="graph">
...@@ -651,7 +677,7 @@ EOD; ...@@ -651,7 +677,7 @@ EOD;
<div class="graph"> <div class="graph">
<?php <?php
echo <<<EOD echo <<<EOD
<a href="graph/packetloss.php?$aquery" title="Packetloss Default Time from &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height."><img id="packetloss" src="graph/packetloss.php?$iquery" width="497px" height="293px" alt="Packetloss Default Time from &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" /></a>\n <a href="graph/packetloss.php?$aquery" title="Packetloss Default Time from &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height."><img id="packetloss" src="graph/packetloss.php?$iquery" width="497px" height="293px" alt="Packetloss Default Time from &amp;start to &amp;end. Image dimensions: &amp;width × &amp;height." title="—" /></a>\n
EOD; EOD;
} }
?> ?>
...@@ -684,7 +710,7 @@ EOD; ...@@ -684,7 +710,7 @@ EOD;
<div class="table"> <div class="table">
<table class="vertical thetop"> <table class="vertical thetop">
<caption>Packetloss</caption> <caption>Packetloss Top</caption>
<tbody> <tbody>
<?php <?php
...@@ -719,12 +745,12 @@ EOD; ...@@ -719,12 +745,12 @@ EOD;
<?php <?php
//if(count($packetlossTop->top2rows) > 0) { //if(count($packetlossTop->top2rows) > 0) {
if(isset($config->enable_appmon_top)) { if(isset($config->enable_protocol_top)) {
?> ?>
<div class="table"> <div class="table">
<table class="vertical thetop"> <table class="vertical thetop">
<caption>Appmon</caption> <caption>Protocol Top</caption>
<thead> <thead>
<tr><th scope="col" >Protocol</th> <th scope="col" class="right">Total pkts</th> <th scope="col" class="right">Lost pkts</th></tr> <tr><th scope="col" >Protocol</th> <th scope="col" class="right">Total pkts</th> <th scope="col" class="right">Lost pkts</th></tr>
...@@ -759,6 +785,9 @@ EOD; ...@@ -759,6 +785,9 @@ EOD;
<?php <?php
echo "<span>".$packetlossTop->miscarr["ts"]["label"].": <span id=\"ts\">".date("H:i d F Y", $packetlossTop->miscarr["ts"]["value"])."</span></span>"; echo "<span>".$packetlossTop->miscarr["ts"]["label"].": <span id=\"ts\">".date("H:i d F Y", $packetlossTop->miscarr["ts"]["value"])."</span></span>";
?> ?>
<span class="note line">* or ".": Data are up-to-date (timesamp has changed since last refresh, service is running).</span>
<span class="note line">?: Data are NOT up-to-date (timestamp has NOT changed since last refresh, service probably NOT running).</span>
</span>
</label> </label>
</div> </div>
</form> </form>
......
...@@ -30,6 +30,8 @@ var packetlossTop = { ...@@ -30,6 +30,8 @@ var packetlossTop = {
delay: 10000, // 10s delay: 10000, // 10s
tid: 0, tid: 0,
counter: 0, counter: 0,
last_ts: 0,
uptodate: 0,
rslash: ".*.*", rslash: ".*.*",
objarr: Array(), objarr: Array(),
...@@ -91,6 +93,8 @@ var packetlossTop = { ...@@ -91,6 +93,8 @@ var packetlossTop = {
var value = arr[3]; var value = arr[3];
if(id == "ts") { if(id == "ts") {
packetlossTop.uptodate = (value > packetlossTop.last_ts);
packetlossTop.last_ts = value;
d = new Date(); d = new Date();
d.setTime(value + "000"); d.setTime(value + "000");
value = (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + value = (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) +
...@@ -114,10 +118,11 @@ var packetlossTop = { ...@@ -114,10 +118,11 @@ var packetlossTop = {
for(var i = 0; i < packetlossTop.bufferarr.length; i++) { for(var i = 0; i < packetlossTop.bufferarr.length; i++) {
var arr = packetlossTop.bufferarr[i].split(";"); var arr = packetlossTop.bufferarr[i].split(";");
var hid = arr[0]; var hid = arr[0];
if(hid.substr(0, 4) == "host") { if(hid == "host") {
var id = arr[1]; var hid = arr[1];
var label = arr[2]; var id = arr[2];
var value = arr[3]; var label = arr[3];
var value = arr[4];
packetlossTop.hostarr.push({ packetlossTop.hostarr.push({
id: hid, id: hid,
value: { value: {
...@@ -294,7 +299,10 @@ var packetlossTop = { ...@@ -294,7 +299,10 @@ var packetlossTop = {
}, },
addSlash: function(str) { addSlash: function(str) {
return str + " " + packetlossTop.rslash.charAt(packetlossTop.counter % 4); if(packetlossTop.uptodate)
return str + " " + packetlossTop.rslash.charAt(packetlossTop.counter % 4);
else
return str + " " + "?";
} }
} }
......
...@@ -31,14 +31,18 @@ class Graph { ...@@ -31,14 +31,18 @@ class Graph {
var $height; var $height;
var $output = "-"; var $output = "-";
function Graph($type, $predefined, $start="now-3600s", $end="now", $width="500", $height="300", $title="Untitled") { function Graph($type, $host0rrddsid, $host1rrddsid, $predefined, $start="now-3600s", $end="now", $width="500", $height="300", $title="Untitled") {
global $config, $predefinedTimes; global $config, $predefinedTimes;
$this->cwd = $config->packetloss_home; $this->cwd = $config->packetloss_home;
$this->rrdtool = $config->rrdtool; $this->rrdtool = $config->rrdtool;
$this->type = $type; $this->type = $type;
$this->predefined = $predefined; $this->host0id = $host0rrddsid; // backward compatibility
$this->host0rrddsid = $host0rrddsid;
$this->host1id = $host1rrddsid; // backward compatibility
$this->host1rrddsid = $host1rrddsid;
$this->predefined = $predefined;
$this->start = $start != "" ? $start : "now-3600s"; $this->start = $start != "" ? $start : "now-3600s";
$this->end = $end != "" ? $end : "now"; $this->end = $end != "" ? $end : "now";
...@@ -52,10 +56,11 @@ class Graph { ...@@ -52,10 +56,11 @@ class Graph {
$line = trim($rarr[$i]); $line = trim($rarr[$i]);
$arr = explode(";", $line); $arr = explode(";", $line);
$hid = $arr[0]; $hid = $arr[0];
if (substr($hid, 0, 4) == "host") { if ($hid == "host") {
$id = $arr[1]; $hid = $arr[1];
$label = $arr[2]; $id = $arr[2];
$value = $arr[3]; $label = $arr[3];
$value = $arr[4];
$this->hostarr[$hid][$id] = array( $this->hostarr[$hid][$id] = array(
"label" => $label, "label" => $label,
"value" => $value "value" => $value
...@@ -68,7 +73,7 @@ class Graph { ...@@ -68,7 +73,7 @@ class Graph {
$this->rrd_filename = $config->packetloss_rrd; $this->rrd_filename = $config->packetloss_rrd;
if($this->predefined != "") { if($this->predefined != "") {
list($avg, $dur) = explode("_", $this->predefined); list($avg, $dur) = explode("_", $this->predefined);
$this->title = "Packet Loss ratio \t(".($predefinedTimes[$this->predefined]).")"; $this->title = "Packet Loss ratio (".($predefinedTimes[$this->predefined]).")";
$this->start = "end-$dur"; $this->start = "end-$dur";
} }
else { else {
...@@ -84,7 +89,7 @@ class Graph { ...@@ -84,7 +89,7 @@ class Graph {
$this->rrd_filename = $config->packetcount_rrd; $this->rrd_filename = $config->packetcount_rrd;
if($this->predefined != "") { if($this->predefined != "") {
list($avg, $dur) = explode("_", $this->predefined); list($avg, $dur) = explode("_", $this->predefined);
$this->title = "Lost packets \t(".$predefinedTimes[$this->predefined].")"; $this->title = "Lost packets (".$predefinedTimes[$this->predefined].")";
$this->start = "end-$dur"; $this->start = "end-$dur";
} }
else { else {
...@@ -100,19 +105,25 @@ class Graph { ...@@ -100,19 +105,25 @@ class Graph {
} }
function __setup_command_packetloss() { function __setup_command_packetloss() {
$host0 = $this->hostarr["host0"]["hostname"]["value"]; $host0name = $this->hostarr["$this->host0id"]["hostname"]["value"];
$host0rrddsid = $this->host0rrddsid;
$i = 0; $i = 0;
while($this->hostarr["host0"]["if$i"]) { while($this->hostarr["$this->host0id"]["if$i"]) {
$host0 .= ($i == 0 ? "\:" : ",").$this->hostarr["host0"]["if$i"]["value"]; $host0 .= ($i == 0 ? "\:" : ",").$this->hostarr["$this->host0id"]["if$i"]["value"];
$i++; $i++;
}; };
$host1 = $this->hostarr["host1"]["hostname"]["value"];
$host1name = $this->hostarr["$this->host1id"]["hostname"]["value"];
$host1rrddsid = $this->host1rrddsid;
$i = 0; $i = 0;
while($this->hostarr["host1"]["if$i"]) { while($this->hostarr["$this->host1id"]["if$i"]) {
$host1 .= ($i == 0 ? "\:" : ",").$this->hostarr["host1"]["if$i"]["value"]; $host1 .= ($i == 0 ? "\:" : ",").$this->hostarr["$this->host1id"]["if$i"]["value"];
$i++; $i++;
}; };
$flow0 = $host0rrddsid.$host1rrddsid;
$flow1 = $host1rrddsid.$host0rrddsid;
$this->command = <<<EOC $this->command = <<<EOC
TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \
--width="$this->width" \ --width="$this->width" \
...@@ -124,30 +135,36 @@ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \ ...@@ -124,30 +135,36 @@ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \
--interlaced \ --interlaced \
--vertical-label "Packet Loss Ratio [%]" \ --vertical-label "Packet Loss Ratio [%]" \
--title "$this->title" \ --title "$this->title" \
"DEF:flow0=$this->rrd_filename:flow0:AVERAGE" \ "DEF:$flow0=$this->rrd_filename:$flow0:AVERAGE" \
"DEF:flow1=$this->rrd_filename:flow1:AVERAGE" \ "DEF:$flow1=$this->rrd_filename:$flow1:AVERAGE" \
"AREA:flow0#00FF00:$host0 to $host1" \ "AREA:$flow0#00FF00:$host0name to $host1name" \
"LINE:0" \ "LINE:0" \
"AREA:flow1#0066FF:$host0 to $host1:STACK" \ "AREA:$flow1#0066FF:$host1name to $host0name:STACK" \
"LINE:0#000000" "LINE:0#000000"
EOC; EOC;
} }
function __setup_command_packetcount() { function __setup_command_packetcount() {
$host0 = $this->hostarr["host0"]["hostname"]["value"]; $host0name = $this->hostarr["$this->host0id"]["hostname"]["value"];
$host0rrddsid = $this->host0rrddsid;
$i = 0; $i = 0;
while($this->hostarr["host0"]["if$i"]) { while($this->hostarr["$this->host0id"]["if$i"]) {
$host0 .= ($i == 0 ? "\:" : ",").$this->hostarr["host0"]["if$i"]["value"]; $host0 .= ($i == 0 ? "\:" : ",").$this->hostarr["$this->host0id"]["if$i"]["value"];
$i++; $i++;
}; };
$host1 = $this->hostarr["host1"]["hostname"]["value"];
$host1name = $this->hostarr["$this->host1id"]["hostname"]["value"];
$host1rrddsid = $this->host1rrddsid;
$i = 0; $i = 0;
while($this->hostarr["host1"]["if$i"]) { while($this->hostarr["$this->host1id"]["if$i"]) {
$host1 .= ($i == 0 ? "\:" : ",").$this->hostarr["host1"]["if$i"]["value"]; $host1 .= ($i == 0 ? "\:" : ",").$this->hostarr["$this->host1id"]["if$i"]["value"];
$i++; $i++;
}; };
$flow0 = $host0rrddsid.$host1rrddsid;
$flow1 = $host1rrddsid.$host0rrddsid;
$this->command = <<<EOC $this->command = <<<EOC
TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \
--width="$this->width" \ --width="$this->width" \
...@@ -159,11 +176,11 @@ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \ ...@@ -159,11 +176,11 @@ TZ=":GMT" "$this->rrdtool" graph "$this->output" $@ \
--interlaced \ --interlaced \