0 || $port['ifOutErrors_delta'] > 0) { $error_img = generate_port_link($port, "Interface Errors", 'port_errors'); } else { $error_img = ''; } if (dbFetchCell('SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?', array($port['port_id']))) { $mac = " 'macaccounting'))."'>"; } else { $mac = ''; } echo " "; echo ' '.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
".$port['ifAlias'].''; if ($port['ifAlias']) { echo '
'; } unset($break); if ($port_details) { foreach (dbFetchRows('SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip) { echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; $break = '
'; } foreach (dbFetchRows('SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip6) { echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; $break = '
'; } } echo ''; echo ""; if ($port_details) { $port['graph_type'] = 'port_bits'; echo generate_port_link($port, ""); $port['graph_type'] = 'port_upkts'; echo generate_port_link($port, ""); $port['graph_type'] = 'port_errors'; echo generate_port_link($port, ""); } echo ""; if ($port['ifOperStatus'] == 'up') { $port['in_rate'] = ($port['ifInOctets_rate'] * 8); $port['out_rate'] = ($port['ifOutOctets_rate'] * 8); $in_perc = @round(($port['in_rate'] / $port['ifSpeed'] * 100)); $out_perc = @round(($port['in_rate'] / $port['ifSpeed'] * 100)); echo " ".formatRates($port['in_rate'])."
".formatRates($port['out_rate'])."
".format_bi($port['ifInUcastPkts_rate'])."pps

".format_bi($port['ifOutUcastPkts_rate']).'pps
'; } echo ""; if ($port['ifSpeed']) { echo ''.humanspeed($port['ifSpeed']).''; } echo '
'; if ($port[ifDuplex] != 'unknown') { echo ''.$port['ifDuplex'].''; } else { echo '-'; } if ($device['os'] == 'ios' || $device['os'] == 'iosxe') { if ($port['ifTrunk']) { echo '

'.$vlan['vlan'].' '.$vlan['vlan_descr'].'
'; } echo '">'.$port['ifTrunk'].'

'; } else if ($port['ifVlan']) { echo '

VLAN '.$port['ifVlan'].'

'; } else if ($port['ifVrf']) { $vrf = dbFetchRow('SELECT * FROM vrfs WHERE vrf_id = ?', array($port['ifVrf'])); echo "

".$vrf['vrf_name'].'

'; }//end if }//end if if ($port_adsl['adslLineCoding']) { echo ""; echo $port_adsl['adslLineCoding'].'/'.rewrite_adslLineType($port_adsl['adslLineType']); echo '
'; echo 'Sync:'.formatRates($port_adsl['adslAtucChanCurrTxRate']).'/'.formatRates($port_adsl['adslAturChanCurrTxRate']); echo '
'; echo 'Max:'.formatRates($port_adsl['adslAtucCurrAttainableRate']).'/'.formatRates($port_adsl['adslAturCurrAttainableRate']); echo ""; echo 'Atten:'.$port_adsl['adslAtucCurrAtn'].'dB/'.$port_adsl['adslAturCurrAtn'].'dB'; echo '
'; echo 'SNR:'.$port_adsl['adslAtucCurrSnrMgn'].'dB/'.$port_adsl['adslAturCurrSnrMgn'].'dB'; } else { echo ""; if ($port['ifType'] && $port['ifType'] != '') { echo ''.fixiftype($port['ifType']).''; } else { echo '-'; } echo '
'; if ($ifHardType && $ifHardType != '') { echo ''.$ifHardType.''; } else { echo '-'; } echo ""; if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') { echo ''.formatMac($port['ifPhysAddress']).''; } else { echo '-'; } echo '
'; if ($port['ifMtu'] && $port['ifMtu'] != '') { echo 'MTU '.$port['ifMtu'].''; } else { echo '-'; } }//end if echo ''; echo ''; $neighborsCount=0; $nbLinks=0; if (strpos($port['label'], 'oopback') === false && !$graph_type) { foreach (dbFetchRows('SELECT * FROM `links` AS L, `ports` AS I, `devices` AS D WHERE L.local_port_id = ? AND L.remote_port_id = I.port_id AND I.device_id = D.device_id', array($if_id)) as $link) { // echo("Directly Connected " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "
"); // $br = "
"; $int_links[$link['port_id']] = $link['port_id']; $int_links_phys[$link['port_id']] = 1; $nbLinks++; } unset($br); if ($port_details && $config['enable_port_relationship'] === true) { // Show which other devices are on the same subnet as this interface foreach (dbFetchRows("SELECT `ipv4_network_id` FROM `ipv4_addresses` WHERE `port_id` = ? AND `ipv4_address` NOT LIKE '127.%'", array($port['port_id'])) as $net) { $ipv4_network_id = $net['ipv4_network_id']; $sql = 'SELECT I.port_id FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.port_id = I.port_id AND A.ipv4_network_id = ? AND D.device_id = I.device_id AND D.device_id != ?'; $array = array( $net['ipv4_network_id'], $device['device_id'], ); foreach (dbFetchRows($sql, $array) as $new) { echo $new['ipv4_network_id']; $this_ifid = $new['port_id']; $this_hostid = $new['device_id']; $this_hostname = $new['hostname']; $this_ifname = fixifName($new['label']); $int_links[$this_ifid] = $this_ifid; $int_links_v4[$this_ifid] = 1; } }//end foreach foreach (dbFetchRows('SELECT ipv6_network_id FROM ipv6_addresses WHERE port_id = ?', array($port['port_id'])) as $net) { $ipv6_network_id = $net['ipv6_network_id']; $sql = "SELECT I.port_id FROM ipv6_addresses AS A, ports AS I, devices AS D WHERE A.port_id = I.port_id AND A.ipv6_network_id = ? AND D.device_id = I.device_id AND D.device_id != ? AND A.ipv6_origin != 'linklayer' AND A.ipv6_origin != 'wellknown'"; $array = array( $net['ipv6_network_id'], $device['device_id'], ); foreach (dbFetchRows($sql, $array) as $new) { echo $new['ipv6_network_id']; $this_ifid = $new['port_id']; $this_hostid = $new['device_id']; $this_hostname = $new['hostname']; $this_ifname = fixifName($new['label']); $int_links[$this_ifid] = $this_ifid; $int_links_v6[$this_ifid] = 1; } }//end foreach }//end if if(count($int_links) > 3) { echo '
'; } if ($port_details && $config['enable_port_relationship'] === true && port_permitted($int_link,$device['device_id'])) { foreach ($int_links as $int_link) { $neighborsCount++; if($neighborsCount == 4) { echo '
[...]
'; echo '
'; echo '
'; } echo ''; // If we're showing graphs, generate the graph and print the img tags if ($graph_type == 'etherlike') { $graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'-dot3.rrd'; } else { $graph_file = $config['rrd_dir'].'/'.$device['hostname'].'/port-'.safename($port['ifIndex']).'.rrd'; } if ($graph_type && is_file($graph_file)) { $type = $graph_type; echo ""; include 'includes/print-interface-graphs.inc.php'; echo ''; }