diff --git a/html/graph.php b/html/graph.php index f32cdf05b..0faeab8c9 100644 --- a/html/graph.php +++ b/html/graph.php @@ -11,12 +11,14 @@ include("includes/authenticate.inc"); if($_GET['host']) { - $hostid = $_GET['host']; + $device = $_GET['host']; + } elseif($_GET['device']) { + $device = $_GET['device']; } else { - $hostid = getifhost($_GET['if']); + $device = getifhost($_GET['if']); $ifIndex = getifindexbyid($_GET['if']); } - $hostname = gethostbyid($hostid); + $hostname = gethostbyid($device); $from = $_GET['from']; $to = $_GET['to']; $width = $_GET['width']; @@ -28,10 +30,13 @@ $graphfile = $hostname . ".". $ifIndex . "-" . $type . ".png"; - $os = gethostosbyid($hostid); + $os = gethostosbyid($device); switch ($type) { - + + case 'device_bits': + $graph = graph_device_bits ($device, $graphfile, $from, $to, $width, $height, $title, $vertical); + break; case 'bits': $graph = trafgraph ($hostname . ".". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; @@ -48,7 +53,7 @@ $graph = uptimegraph ($hostname . "-uptime.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'unixfs': - $graph = unixfsgraph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = unixfsgraph ($device, $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'calls': $graph = callsgraphSNOM ($hostname . "-data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical); @@ -79,7 +84,7 @@ } break; case 'temp': - $graph = temp_graph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = temp_graph ($device, $graphfile, $from, $to, $width, $height, $title, $vertical); break; case 'mem': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { @@ -116,7 +121,7 @@ break; case 'unixfs': if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) { - $graph = unixfsgraph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical); + $graph = unixfsgraph ($device, $graphfile, $from, $to, $width, $height, $title, $vertical); } break; case 'postfix': diff --git a/html/pages/device/dev-overview.inc b/html/pages/device/dev-overview.inc index 54392313e..dd4126acd 100644 --- a/html/pages/device/dev-overview.inc +++ b/html/pages/device/dev-overview.inc @@ -50,7 +50,11 @@ echo(""); echo("
Total Traffic
" . device_traffic_image($device['id'], 490, 100, $day, $now) . "Interfaces
"); diff --git a/includes/functions.php b/includes/functions.php index 5785e7047..cc51b88bb 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -68,6 +68,11 @@ function generatedevicelink($device, $text=0) { return $link; } + +function device_traffic_image($device, $width, $height, $from, $to) { + return "");
+# print_r ($opts);
+
+ $ret = rrd_graph("$imgfile", $opts, count($opts));
+
+ if( !is_array($ret) )
+ {
+ $err = rrd_error();
+ echo "rrd_graph() ERROR: $err\n";
+ return FALSE;
+ } else {
+ return $imgfile;
+ }
+}
+
+
?>