";}
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"
",errors);
} else { $error_img = ""; }
$graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
echo("
" . generateiflink($interface, "$i. $ifDescr") . " $error_img
$ifAlias");
unset ($break);
if(!$dographs) {
$ipdata = mysql_query("SELECT * FROM `ipaddr` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
while($ip = mysql_fetch_Array($ipdata)) {
echo("$break $ip[addr]/$ip[cidr]");
$break = " ";
}
echo("");
echo(" | ");
if($interface['ifOperStatus'] == "up") {
$in_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
$out_perc = @round($interface['in_rate']/$interface['ifSpeed']*100);
echo(" " . formatRates($interface['in_rate']) . " ");
echo(" " . formatRates($interface['out_rate']) . "");
}
echo(" | ");
if($ifSpeed && $ifSpeed != "") { echo("$ifSpeed"); }
echo(" ");
# if($interface[ifDuplex] != unknown) { echo("Duplex " . $interface['ifDuplex'] . ""); } else { echo("-"); }
if($device['os'] == "IOS") {
if($interface['ifTrunk']) { echo("" . $interface['ifTrunk'] . "");
} elseif ($interface['ifVlan']) { echo("VLAN " . $interface['ifVlan'] . ""); }
}
echo(" | ");
if($ifType && $ifType != "") { echo("" . $ifType . ""); } else { echo("-"); }
echo(" ");
if($ifHardType && $ifHardType != "") { echo("" . $ifHardType . ""); } else { echo("-"); }
echo(" | ");
if($interface['ifPhysAddress'] && $interface['ifPhysAddress'] != "") { echo("" . $interface['ifPhysAddress'] . ""); } else { echo("-"); }
echo(" ");
if($interface['ifMtu'] && $interface['ifMtu'] != "") { echo("MTU " . $interface['ifMtu'] . ""); } else { echo("-"); }
}
echo(" | ");
echo("");
if ( strpos($ifDescr, "oopback") === false && !$dographs) {
$link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id");
while($link = mysql_fetch_array($link_query)) {
echo(" " . generateiflink($link) . " on " . generatedevicelink($link) . " ");
$br = " ";
}
unset($br);
$adj_sql = "SELECT * FROM networks AS N, interfaces AS I, adjacencies AS A ";
$adj_sql = $adj_sql . "WHERE I.interface_id = A.interface_id AND A.network_id = N.id ";
$adj_sql = $adj_sql . "AND I.interface_id = '$if_id'";
$adj_query = mysql_query("$adj_sql");
while($adjs = mysql_fetch_array($adj_query)) {
$network_id = $adjs['network_id'];
$newsql = "SELECT * FROM adjacencies AS A, networks as N, interfaces as I, devices as D ";
$newsql = $newsql . "WHERE N.id = '$network_id' AND A.network_id = N.id AND I.interface_id = A.interface_id AND D.device_id = I.device_id ";
$newsql = $newsql . "AND D.device_id != '$device[id]' AND I.ifDescr NOT LIKE '%loopback%' GROUP BY D.device_id ORDER BY D.hostname";
$new_query = mysql_query($newsql);
while($new = mysql_fetch_array($new_query)) {
if ($new['status'] == '0') { $class = "red"; } else { $class = "blue"; }
if ($new['ignore'] == '1') {
$class = "grey";
if ($new['status'] == '1') { $class = "green"; }
}
$this_ifid = $new['interface_id'];
$this_hostid = $new['device_id'];
$this_hostname = $new['hostname'];
$this_ifname = fixifName($new['ifDescr']);
$wq = mysql_query("select count(*) FROM links WHERE dst_if = '$this_ifid' AND src_if = $if_id;");
if (@mysql_result($wq, 0) == '0' && $this_hostname != $hostname) {
$graph_url = "graph.php?if=$this_ifid&from=$twoday&to=$now&width=400&height=120&type=bits'";
echo("$br " . generateiflink($new) . " on " . generatedevicelink($new));
$br = " ";
}
}
}
unset($br);
}
echo(" |
");
// If we're showing graphs, generate the graph and print the img tags
if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) {
$type = $_GET['type'];
$daily_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=210&height=100";
$daily_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=210&height=100";
$weekly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=210&height=100";
$monthly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=210&height=100";
$yearly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=500&height=150";
echo("