diff --git a/html/.htaccess b/html/.htaccess index 560897103f..23c02b12c7 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -30,6 +30,7 @@ RewriteRule ^vrf/(.+)/(.+)/(.+)/ ?page=vrf&id=$1&opta=$2&optb=$3 RewriteRule ^vrf/(.+)/(.+)/ ?page=vrf&id=$1&opta=$2 RewriteRule ^vrf/(.+)/ ?page=vrf&id=$1 +RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/(.+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4&optc=$5&optd=$6&opte=$7 RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4&optc=$5&optd=$6 RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4&optc=$5 RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4 diff --git a/html/includes/graphs/collectd_cpu.inc.php b/html/includes/graphs/collectd_cpu.inc.php new file mode 100644 index 0000000000..a7986278b0 --- /dev/null +++ b/html/includes/graphs/collectd_cpu.inc.php @@ -0,0 +1,10 @@ + diff --git a/html/includes/graphs/mac_acc_total.inc.php b/html/includes/graphs/mac_acc_total.inc.php new file mode 100644 index 0000000000..61a556ae92 --- /dev/null +++ b/html/includes/graphs/mac_acc_total.inc.php @@ -0,0 +1,65 @@ + diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 2c0154ef59..a95a2374a4 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -176,7 +176,7 @@ echo(""); echo(""); // If we're showing graphs, generate the graph and print the img tags - if($graph_type && is_file($config['rrd_dir'] . "/" . $hostname . "/". $interface['ifIndex'] . ".rrd")) { + if($graph_type && is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/". $interface['ifIndex'] . ".rrd")) { $type = $graph_type; diff --git a/html/pages/device/interface.inc.php b/html/pages/device/interface.inc.php index 115ea30a8e..38236192db 100644 --- a/html/pages/device/interface.inc.php +++ b/html/pages/device/interface.inc.php @@ -62,7 +62,7 @@ echo(" echo(" | Mac Accounting : Bits - (Mini) | + (Mini|Top10) | Packets (Mini)"); } diff --git a/html/pages/device/port/macaccounting.php b/html/pages/device/port/macaccounting.php index 0a7ec37679..0675f2c08a 100644 --- a/html/pages/device/port/macaccounting.php +++ b/html/pages/device/port/macaccounting.php @@ -17,39 +17,67 @@ $i = 1; $inf = fixifName($ifname); - $query = mysql_query("SELECT *, (M.bps_in + M.bps_out) as bps FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id ORDER BY bps DESC"); - echo("
"); + + if($_GET['optd'] == "top10") { + if($_GET['opte']) { + $from = "-" . $_GET['opte']; + } else { $from = "-1day"; } + echo("
+ +
+ Day + + + +
+
+ Week + + + +
+
+ Month + + + +
+
+ Year + + + +
+
+ +"); + unset($query); + } + + while($acc = mysql_fetch_array($query)) { - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); $name = gethostbyaddr($addy['ipv4_address']); - if($name == $addy['ipv4_address']) { unset ($name); } - if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) { - $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); $peer_info = mysql_fetch_array($peer_query); - } else { unset ($peer_info); } - - if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else { unset ($as); unset ($astext); unset($asn); } - if($_GET['optc']) { - $graph_type = "mac_acc_" . $_GET['optc']; - } else { - $graph_type = "mac_acc_bits"; - } + if($_GET['optc']) { + $graph_type = "mac_acc_" . $_GET['optc']; + } else { + $graph_type = "mac_acc_bits"; + } - if($_GET['optd'] == "thumbs") { + if($_GET['optd'] == "thumbs") { if(!$asn) { $asn = "No Session"; } @@ -82,28 +110,24 @@ $peer_info['astext']; - $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; - $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; + $daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; + $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; + $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; + $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; + $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; + $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; + $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; + $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; - $weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; - $weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; - - $monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; - $monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; - - $yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; - $yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; - - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo("
"); $i++; } diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index b9f73d983d..7dd276534f 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -34,7 +34,6 @@ echo(" if($_GET['opta'] == graphs ) { if($_GET['optb']) { $graph_type = $_GET['optb']; } else { $graph_type = "bits"; } - $dographs = 1; } if($_GET['optc'] == thumbs) { diff --git a/includes/graphing.php b/includes/graphing.php index 8751b6acb2..7d4987b727 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -571,47 +571,6 @@ function graph_mac_acc ($id, $graph, $from, $to, $width, $height) { } -function graph_mac_acc_interface ($interface, $graph, $from, $to, $width, $height) { - global $config, $installdir; - $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; - $options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height "; - $options .= $config['rrdgraph_def_text']; - if($height < "99") { $options .= " --only-graph"; } - $hostname = gethostbyid($device); - $query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '$interface' AND I.interface_id = M.interface_id AND I.device_id = D.device_id"); - if($width <= "300") { $options .= "--font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } - $pluses = ""; - $options .= " COMMENT:' In Out\\\\n'"; - while($acc = mysql_fetch_array($query)) { - $this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['peer_ip'] . ".rrd"; - if(is_file($this_rrd)) { - $this_id = str_replace(".", "", $acc['peer_ip']); - if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE"; - } elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D"; - } elseif($iter=="7") {$colour="FF0084"; unset($iter); } else {$colour="C600C6";} - $descr = str_pad($acc['peer_desc'], 36); - $descr = substr($descr,0,36); - $options .= " DEF:in".$this_id."=$this_rrd:IN:AVERAGE "; - $options .= " DEF:out".$this_id."temp=$this_rrd:OUT:AVERAGE "; - $options .= " CDEF:out".$this_id."=out".$this_id."temp,-1,* "; - $options .= " CDEF:octets".$this_id."=in".$this_id.",out".$this_id."temp,+"; - $options .= " VDEF:totin".$this_id."=in".$this_id.",TOTAL"; - $options .= " VDEF:totout".$this_id."=out".$this_id."temp,TOTAL"; - $options .= " VDEF:tot".$this_id."=octets".$this_id.",TOTAL"; - $options .= " LINE1.25:in".$this_id."#" . $colour . ":'" . $descr . "'"; - $options .= " LINE1.25:out".$this_id."#" . $colour . "::"; - $options .= " GPRINT:in".$this_id.":LAST:%6.2lf%sbps"; - $options .= " GPRINT:totin".$this_id.":\(%6.2lf%sB\)"; - $options .= " GPRINT:out".$this_id."temp:LAST:%6.2lf%sbps"; - $options .= " GPRINT:totout".$this_id.":\(%6.2lf%sB\)\\\\n"; - $iter++; - } - } - #echo($config['rrdtool'] . " graph $imgfile $options"); - $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); - return $imgfile; -} - function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertical, $inverse = '0', $legend = '1') { global $config; $database = $config['rrd_dir'] . "/" . $rrd; diff --git a/includes/rewrites.php b/includes/rewrites.php index 0431db3237..29abc2af88 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -1,6 +1,5 @@