diff --git a/addhost.php b/addhost.php index 1ad808999..140651f4a 100755 --- a/addhost.php +++ b/addhost.php @@ -21,7 +21,7 @@ if($argv[1]) { if ( isPingable($argv[1])) { if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '".mres($host)."'"), 0) == '0' ) { $snmphost = trim(str_replace("\"", "", shell_exec($config['snmpget'] ." -m SNMPv2-MIB -Oqv -$snmpver -c $community $host:$port sysName.0"))); - if ($snmphost == $host || $hostshort = $host) { + if ($snmphost && ($snmphost == $host || $hostshort = $host)) { $return = createHost ($host, $community, $snmpver, $port); if($return) { echo($return . "\n"); } else { echo("Adding $host failed\n"); } } else { echo("Given hostname does not match SNMP-read hostname!\n"); } diff --git a/check-errors.php b/check-errors.php index 0c80873ff..854d56b3f 100755 --- a/check-errors.php +++ b/check-errors.php @@ -10,7 +10,7 @@ if($argv[1]) { $where = "AND `interface_id` = '$argv[1]'"; } $i = '0'; -$interface_query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where"); +$interface_query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where"); while ($interface = mysql_fetch_array($interface_query)) { $errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta']; if($errors > '1') { @@ -21,7 +21,7 @@ while ($interface = mysql_fetch_array($interface_query)) { echo("Checked $i Interfaces\n"); -if($errored) { ## If there are errored interfaces +if($errored) { ## If there are errored ports $i=0; $msg = "Interfaces with errors : \n\n"; foreach ($errored as $int) { diff --git a/cleanup.php b/cleanup.php index 729876d8e..9239f2a89 100755 --- a/cleanup.php +++ b/cleanup.php @@ -6,7 +6,7 @@ include("config.php"); include("includes/functions.php"); -$query = "SELECT *,A.id as id FROM ipv4_addresses AS A, interfaces as I, devices as D +$query = "SELECT *,A.id as id FROM ipv4_addresses AS A, ports as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'"; $data = mysql_query($query); @@ -34,7 +34,7 @@ while($device = mysql_fetch_array($query)) { list($ipv6addr,$ifIndex) = explode(" ", $data); $valid_ips[] = $ipv6addr; } - $sql = "SELECT * FROM ip6addr AS A, interfaces AS I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"; + $sql = "SELECT * FROM ip6addr AS A, ports AS I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"; $data = mysql_query($sql); while($row = mysql_fetch_array($data)) { echo($row['addr'] . "\n"); @@ -46,7 +46,7 @@ while($device = mysql_fetch_array($query)) { } -$query = "SELECT * FROM interfaces AS I, devices as D +$query = "SELECT * FROM ports AS I, devices as D WHERE I.device_id = D.device_id AND D.status = '1'"; $data = mysql_query($query); while($row = mysql_fetch_array($data)) { @@ -56,7 +56,7 @@ while($row = mysql_fetch_array($data)) { $port = $row['port']; $response = trim(`snmpget -v2c -Osq -c $community $hostname:$port ifIndex.$index | cut -d " " -f 2`); if($response != $index) { - mysql_query("DELETE from interfaces where interface_id = '" . $row['interface_id'] . "'"); + mysql_query("DELETE from ports where interface_id = '" . $row['interface_id'] . "'"); mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '" . $row['interface_id'] . "'"); mysql_query("DELETE from `links` WHERE `local_interface_id` = '" . $row['interface_id'] . "'"); mysql_query("DELETE from `links` WHERE `remote_interface_id` = '" . $row['interface_id'] . "'"); @@ -65,17 +65,17 @@ while($row = mysql_fetch_array($data)) { } } -echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces`"), 0) . " interfaces at start\n"); -$interface_query = mysql_query("SELECT interface_id,device_id FROM `interfaces`"); +echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at start\n"); +$interface_query = mysql_query("SELECT interface_id,device_id FROM `ports`"); while ($interface = mysql_fetch_array($interface_query)) { $device_id = $interface['device_id']; $interface_id = $interface['interface_id']; if(mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `device_id` = '$device_id'"), 0) == '0') { - mysql_query("delete from interfaces where `interface_id` = '$interface_id'"); + mysql_query("delete from ports where `interface_id` = '$interface_id'"); echo("Deleting if $interface_id \n"); } } -echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces`"), 0) . " interfaces at end\n"); +echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports`"), 0) . " ports at end\n"); echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at start\n"); $link_query = mysql_query("SELECT id,local_interface_id,remote_interface_id FROM `links`"); @@ -83,7 +83,7 @@ while ($link = mysql_fetch_array($link_query)) { $id = $link['id']; $src = $link['local_interface_id']; $dst = $link['remote_interface_id']; - if(mysql_result(mysql_query("SELECT COUNT(interface_id) FROM `interfaces` WHERE `interface_id` = '$src'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `interface_id` = '$dst'"), 0) == '0') { + if(mysql_result(mysql_query("SELECT COUNT(interface_id) FROM `ports` WHERE `interface_id` = '$src'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `interface_id` = '$dst'"), 0) == '0') { mysql_query("delete from links where `id` = '$id'"); echo("Deleting link $id \n"); } @@ -91,12 +91,12 @@ while ($link = mysql_fetch_array($link_query)) { echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at end\n"); echo(mysql_result(mysql_query("SELECT COUNT(adj_id) FROM `adjacencies`"), 0) . " adjacencies at start\n"); -$link_query = mysql_query("SELECT * FROM `adjacencies` AS A, `interfaces` AS I, `devices` AS D, networks AS N WHERE I.interface_id = A.interface_id AND D.device_id = I.device_id AND N.id = A.network_id"); +$link_query = mysql_query("SELECT * FROM `adjacencies` AS A, `ports` AS I, `devices` AS D, networks AS N WHERE I.interface_id = A.interface_id AND D.device_id = I.device_id AND N.id = A.network_id"); while ($link = mysql_fetch_array($link_query)) { $id = $link['adj_id']; $netid = $link['network_id']; $ifid = $link['interface_id']; - if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `interface_id` = '$ifid'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(id) FROM `networks` WHERE `id` = '$netid'"), 0) == '0') { + if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `interface_id` = '$ifid'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(id) FROM `networks` WHERE `id` = '$netid'"), 0) == '0') { $remove = 1; echo("Removed Interface!\n"); } diff --git a/contrib/generate-dnstext.php b/contrib/generate-dnstext.php index 8600ba816..fa4ba4286 100755 --- a/contrib/generate-dnstext.php +++ b/contrib/generate-dnstext.php @@ -8,7 +8,7 @@ $link = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass'] $db = mysql_select_db($config['db_name'], $link); -$query = "SELECT * FROM ipaddr AS A, interfaces as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.os = 'ios'"; +$query = "SELECT * FROM ipaddr AS A, ports as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.os = 'ios'"; $data = mysql_query($query, $link); while($ip = mysql_fetch_array($data)) { unset($sub); diff --git a/contrib/generate-vegadns.php b/contrib/generate-vegadns.php index b6400a202..fb8647a93 100755 --- a/contrib/generate-vegadns.php +++ b/contrib/generate-vegadns.php @@ -12,7 +12,7 @@ $link = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass'] $db = mysql_select_db($config['db_name'], $link); -$query = "SELECT * FROM ipaddr AS A, interfaces as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.hostname LIKE '%.vostron.net' AND D.hostname NOT LIKE '%.cust.%' AND D.os = 'ios'"; +$query = "SELECT * FROM ipaddr AS A, ports as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.hostname LIKE '%.vostron.net' AND D.hostname NOT LIKE '%.cust.%' AND D.os = 'ios'"; $data = mysql_query($query, $link); while($ip = mysql_fetch_array($data)) { unset($sub); diff --git a/database-update.sql b/database-update.sql index 69ceded35..182ae0549 100644 --- a/database-update.sql +++ b/database-update.sql @@ -104,3 +104,5 @@ ALTER TABLE `bgpPeers_cbgp` CHANGE `afi` `afi` VARCHAR( 16 ) NOT NULL , CHANGE ` ALTER TABLE `eventlog` ADD `reference` VARCHAR( 64 ) NOT NULL AFTER `type`; ALTER TABLE `syslog` CHANGE `datetime` `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; ALTER TABLE `syslog` DROP `host`, DROP `processed`; +RENAME TABLE `observer_demo`.`interfaces` TO `observer_demo`.`ports` ; +RENAME TABLE `observer_demo`.`interfaces_perms` TO `observer_demo`.`ports_perms` ; diff --git a/discovery.php b/discovery.php index b1d6bce35..7575b80fc 100755 --- a/discovery.php +++ b/discovery.php @@ -89,7 +89,7 @@ while ($device = mysql_fetch_array($device_query)) #include("includes/discovery/os.inc.php"); ## Discover Interfaces - include("includes/discovery/interfaces.php"); + include("includes/discovery/ports.php"); ## Discovery ENTITY-MIB # include("includes/discovery/entity-physical.inc.php"); diff --git a/html/ajax/list_interfaces.php b/html/ajax/list_interfaces.php index a5d8a9c9a..9ba835713 100755 --- a/html/ajax/list_interfaces.php +++ b/html/ajax/list_interfaces.php @@ -7,8 +7,8 @@ if(isset($_GET['device_id'])){ -$interfaces = mysql_query("SELECT * FROM interfaces WHERE device_id = '".$_GET['device_id']."'"); - while($interface = mysql_fetch_array($interfaces)) { +$ports = mysql_query("SELECT * FROM ports WHERE device_id = '".$_GET['device_id']."'"); + while($interface = mysql_fetch_array($ports)) { echo "obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['interface_id']."');\n"; } } diff --git a/html/includes/graphs/customer_bits.inc.php b/html/includes/graphs/customer_bits.inc.php index 517529f69..1e34b1718 100644 --- a/html/includes/graphs/customer_bits.inc.php +++ b/html/includes/graphs/customer_bits.inc.php @@ -1,8 +1,8 @@ "); - $if = mysql_fetch_array(mysql_query("SELECT * from interfaces AS I, devices as D where I.device_id = D.device_id AND I.interface_id = '".$entry['interface']."'")); + $if = mysql_fetch_array(mysql_query("SELECT * from ports AS I, devices as D where I.device_id = D.device_id AND I.interface_id = '".$entry['interface']."'")); echo(" " . generateiflink($if) . " diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index 121eefc4b..136b4ecc7 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -103,7 +103,7 @@ echo(""); echo(""); if ( strpos($interface['label'], "oopback") === false && !$graph_type) { - $link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.local_interface_id = '$if_id' AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id"); + $link_query = mysql_query("select * from links AS L, ports AS I, devices AS D WHERE L.local_interface_id = '$if_id' AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id"); while($link = mysql_fetch_array($link_query)) { # echo("Directly Connected " . generateiflink($link, makeshortif($link['label'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . "
"); # $br = "
"; @@ -119,7 +119,7 @@ echo(""); $nets_query = mysql_query($sql); while($net = mysql_fetch_array($nets_query)) { $ipv4_network_id = $net['ipv4_network_id']; - $sql = "SELECT I.interface_id FROM ipv4_addresses AS A, interfaces AS I, devices AS D + $sql = "SELECT I.interface_id FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.interface_id = I.interface_id AND A.ipv4_network_id = '".$net['ipv4_network_id']."' AND D.device_id = I.device_id AND D.device_id != '".$device['device_id']."'"; @@ -139,7 +139,7 @@ echo(""); $nets_query = mysql_query($sql); while($net = mysql_fetch_array($nets_query)) { $ipv6_network_id = $net['ipv6_network_id']; - $sql = "SELECT I.interface_id FROM ipv6_addresses AS A, interfaces AS I, devices AS D + $sql = "SELECT I.interface_id FROM ipv6_addresses AS A, ports AS I, devices AS D WHERE A.interface_id = I.interface_id AND A.ipv6_network_id = '".$net['ipv6_network_id']."' AND D.device_id = I.device_id AND D.device_id != '".$device['device_id']."' AND A.ipv6_origin != 'linklayer' AND A.ipv6_origin != 'wellknown'"; @@ -158,7 +158,7 @@ echo(""); foreach($int_links as $int_link) { - $link_if = mysql_fetch_array(mysql_query("SELECT * from interfaces AS I, devices AS D WHERE I.device_id = D.device_id and I.interface_id = '".$int_link."'")); + $link_if = mysql_fetch_array(mysql_query("SELECT * from ports AS I, devices AS D WHERE I.device_id = D.device_id and I.interface_id = '".$int_link."'")); echo("$br"); @@ -180,7 +180,7 @@ echo(""); while($pseudowire = mysql_fetch_array($pseudowires)) { #`interface_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid` $pw_peer_dev = mysql_fetch_array(mysql_query("SELECT * from `devices` WHERE `device_id` = '" . $pseudowire['peer_device_id'] . "'")); - $pw_peer_int = mysql_fetch_array(mysql_query("SELECT * from `interfaces` AS I, pseudowires AS P WHERE I.device_id = '".$pseudowire['peer_device_id']."' AND + $pw_peer_int = mysql_fetch_array(mysql_query("SELECT * from `ports` AS I, pseudowires AS P WHERE I.device_id = '".$pseudowire['peer_device_id']."' AND P.cpwVcID = '".$pseudowire['cpwVcID']."' AND P.interface_id = I.interface_id")); $pw_peer_int = ifNameDescr($pw_peer_int); @@ -188,14 +188,14 @@ echo(""); $br = "
"; } - $members = mysql_query("SELECT * FROM `interfaces` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); + $members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); while($member = mysql_fetch_array($members)) { echo("$br " . generateiflink($member) . " (PAgP)"); $br = "
"; } if($interface['pagpGroupIfIndex'] && $interface['pagpGroupIfIndex'] != $interface['ifIndex']) { - $parent = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE `ifIndex` = '".$interface['pagpGroupIfIndex']."' and `device_id` = '".$device['device_id']."'")); + $parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `ifIndex` = '".$interface['pagpGroupIfIndex']."' and `device_id` = '".$device['device_id']."'")); echo("$br " . generateiflink($parent) . " (PAgP)"); $br = "
"; } diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 6a3cd037b..0c2587ba6 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -1,7 +1,7 @@ Ports +
  • Ports
  • diff --git a/html/includes/print-vlan.inc b/html/includes/print-vlan.inc index 7cdd3b6ea..36761768f 100644 --- a/html/includes/print-vlan.inc +++ b/html/includes/print-vlan.inc @@ -8,7 +8,7 @@ echo(" Vlan " . $vlan['vlan_vlan'] . ""); echo("" . $vlan['vlan_descr'] . ""); echo(""); -$ports_query = mysql_query("SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' "); +$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' "); while($port = mysql_fetch_array($ports_query)) { if($_GET['opta']) { diff --git a/html/includes/print-vrf.inc b/html/includes/print-vrf.inc index 7700532a7..87126fd08 100644 --- a/html/includes/print-vrf.inc +++ b/html/includes/print-vrf.inc @@ -10,7 +10,7 @@ echo("" . $vrf['mplsVpnVrfRouteDistinguisher'] . "< echo(""); -$ports_query = mysql_query("SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVrf` = '" . $vrf['vrf_id'] . "' "); +$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVrf` = '" . $vrf['vrf_id'] . "' "); while($port = mysql_fetch_array($ports_query)) { if($_GET['opta']) { $graph_type = $_GET['opta']; diff --git a/html/includes/topnav.inc b/html/includes/topnav.inc index ff676125a..65d28e60b 100644 --- a/html/includes/topnav.inc +++ b/html/includes/topnav.inc @@ -8,12 +8,12 @@ $devices['down'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE $devices['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE `ignore` = '1'"),0); $devices['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE `disabled` = '1'"),0); -$interfaces['count'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces"),0); -$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'up' AND I.ignore = '0' AND I.device_id = D.device_id AND D.ignore = '0'"),0); -$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); -$interfaces['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); -$interfaces['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0); -$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0); +$ports['count'] = mysql_result(mysql_query("SELECT count(*) FROM ports"),0); +$ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifOperStatus = 'up' AND I.ignore = '0' AND I.device_id = D.device_id AND D.ignore = '0'"),0); +$ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); +$ports['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0); +$ports['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0); +$ports['errored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"),0); $services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0); @@ -29,11 +29,11 @@ $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM $devices['down'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '0' AND D.ignore = '0'"),0); $devices['disabled'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.ignore = '1'"),0); - $interfaces['count'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id"),0); - $interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'"),0); - $interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); - $interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'"),0); - $interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND (I.in_errors > '0' OR I.out_errors > '0')"),0); + $ports['count'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id"),0); + $ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'"),0); + $ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); + $ports['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'"),0); + $ports['errored'] = mysql_result(mysql_query("SELECT count(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND (I.in_errors > '0' OR I.out_errors > '0')"),0); $services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id"),0); $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '1' AND service_ignore ='0'"),0); @@ -43,7 +43,7 @@ $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM } if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = "transparent"; } -if($interfaces['down']) { $interfaces['bgcolour'] = "#ffcccc"; } else { $interfaces['bgcolour'] = "#e5e5e5"; } +if($ports['down']) { $ports['bgcolour'] = "#ffcccc"; } else { $ports['bgcolour'] = "#e5e5e5"; } if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = "transparent"; } ?> @@ -62,14 +62,14 @@ if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['b ) - + Interfaces : - + ( - up - down - ignored - shutdown + up + down + ignored + shutdown ) diff --git a/html/index.php b/html/index.php index b8ca03c08..a5efea74f 100755 --- a/html/index.php +++ b/html/index.php @@ -116,7 +116,7 @@ function popUp(URL) {
    = '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "Priv eBGP"; } } - $peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, interfaces AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + $peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); if($peerhost) { $peername = generatedevicelink($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } diff --git a/html/pages/customers.php b/html/pages/customers.php index faa978b5c..a813784f1 100644 --- a/html/pages/customers.php +++ b/html/pages/customers.php @@ -1,6 +1,6 @@ ".generatedevicelink($interface, shorthost($interface['hostname']))."
    @@ -145,47 +145,47 @@ echo("
    if($_SESSION['userlevel'] >= '5') { - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['peering'] .= $seperator . $interface['interface_id']; + $ports['peering'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['transit'] .= $seperator . $interface['interface_id']; + $ports['transit'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $interfaces['broadband'] = "2490,2509"; - $interfaces['wave_broadband'] = "2098"; + $ports['broadband'] = "2490,2509"; + $ports['wave_broadband'] = "2098"; - if($interfaces['transit']) { - echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    Internet Transit
    ". - "
    "); } - if($interfaces['broadband']) { - echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    Broadband
    ". - "
    "); } - if($interfaces['wave_broadband']) { - echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    Wave Broadhand
    ". - "
    "); } diff --git a/html/pages/device.php b/html/pages/device.php index f45fdfec7..2e477e052 100644 --- a/html/pages/device.php +++ b/html/pages/device.php @@ -71,7 +71,7 @@ if(is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) { '); } -if(@mysql_result(mysql_query("select count(interface_id) from interfaces WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') { +if(@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') { echo('
  • Ports @@ -113,7 +113,7 @@ if($config['enable_bgp'] && $device['bgpLocalAs']) { #} -if($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0)) { +if($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0)) { echo('
  • Map diff --git a/html/pages/device/arp.inc.php b/html/pages/device/arp.inc.php index 135e4e881..a6125e3ac 100644 --- a/html/pages/device/arp.inc.php +++ b/html/pages/device/arp.inc.php @@ -1,6 +1,6 @@ "); @@ -8,7 +8,7 @@ $i = "1"; while($arp = mysql_fetch_array($query)) { if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); } if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); } diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index 2907fa4fe..f1a4775b2 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -32,12 +32,12 @@ print_optionbar_end(); if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; } - $query = "SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE "; + $query = "SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE "; $query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)"; $query .= " AND D.device_id = I.device_id"; $ipv4_host = mysql_fetch_array(mysql_query($query)); - $query = "SELECT * FROM ipv6_addresses AS A, interfaces AS I, devices AS D WHERE "; + $query = "SELECT * FROM ipv6_addresses AS A, ports AS I, devices AS D WHERE "; $query .= "(A.ipv6_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)"; $query .= " AND D.device_id = I.device_id"; $ipv6_host = mysql_fetch_array(mysql_query($query)); @@ -105,7 +105,7 @@ print_optionbar_end(); } if ($_GET['opta'] == "macaccounting") { if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"),0)) { - $acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, interfaces AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id")); + $acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, ports AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id")); $graph_type = "mac_acc_bits"; $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; if ( is_file($database) ) { diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index 025e00750..23b9ec571 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -23,7 +23,7 @@ function printEntPhysical($ent, $level, $class) { if($link) {echo("");} if($ent['ifIndex']) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); $ent['entPhysicalName'] = generateiflink($interface); } diff --git a/html/pages/device/hrdevice.inc.php b/html/pages/device/hrdevice.inc.php index b998bcdcb..ad37e75ca 100644 --- a/html/pages/device/hrdevice.inc.php +++ b/html/pages/device/hrdevice.inc.php @@ -15,7 +15,7 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") { echo("".$hrdevice['hrDeviceDescr'].""); } elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") { $int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']); - $interface = mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'")); if($interface['ifIndex']) { echo("".generateiflink($interface).""); } else { diff --git a/html/pages/device/interface.inc.php b/html/pages/device/interface.inc.php index 73fb896a3..2f4077e37 100644 --- a/html/pages/device/interface.inc.php +++ b/html/pages/device/interface.inc.php @@ -1,6 +1,6 @@ PAgP"; } diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index c7101d8cc..c1f4b7db8 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -6,10 +6,10 @@ $overview = 1; #$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'")); -$interfaces['total'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "'"),0); -$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0); -$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); -$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifAdminStatus = 'down'"),0); +$ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0); +$ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0); +$ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); +$ports['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifAdminStatus = 'down'"),0); $services['total'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "'"),0); $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "' AND service_status = '1' AND service_ignore ='0'"),0); @@ -17,7 +17,7 @@ $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM serv $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '" . $device['device_id'] . "' AND service_ignore = '1'"),0); if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; } -if($interfaces['down']) { $interfaces_colour = $warn_colour_a; } else { $interfaces_colour = $list_colour_a; } +if($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; } echo("
    "); diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index d32577cba..61f30c4e1 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -1,6 +1,6 @@ " . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . ""); @@ -8,16 +8,16 @@ if($interfaces['total']) { echo(" - - - - - + + + + +
    $interfaces[total] $interfaces[up] $interfaces[down] $interfaces[disabled]
    $ports[total] $ports[up] $ports[down] $ports[disabled]
    "); echo("
    "); - $sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; + $sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; $query = mysql_query($sql); while($data = mysql_fetch_array($query)) { $data = ifNameDescr($data); diff --git a/html/pages/device/port/arp.inc.php b/html/pages/device/port/arp.inc.php index a0f2efe43..c3c7dfbc4 100644 --- a/html/pages/device/port/arp.inc.php +++ b/html/pages/device/port/arp.inc.php @@ -8,7 +8,7 @@ $i = "1"; while($arp = mysql_fetch_array($query)) { if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); if($arp_host) { $arp_name = generatedevicelink($arp_host); } else { unset($arp_name); } if($arp_host) { $arp_if = generateiflink($arp_host); } else { unset($arp_if); } diff --git a/html/pages/device/port/macaccounting.inc.php b/html/pages/device/port/macaccounting.inc.php index e51c7089d..6b6d2ef69 100644 --- a/html/pages/device/port/macaccounting.inc.php +++ b/html/pages/device/port/macaccounting.inc.php @@ -117,7 +117,7 @@ } else { $query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) 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 + `ports` 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"); while($acc = mysql_fetch_array($query)) { @@ -125,7 +125,7 @@ $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); $name = gethostbyaddr($addy['ipv4_address']); - $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); + $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); if($arp_host) { $arp_name = generatedevicelink($arp_host); $arp_name .= " ".generateiflink($arp_host); } else { unset($arp_if); } if($name == $addy['ipv4_address']) { unset ($name); } diff --git a/html/pages/device/port/pagp.inc.php b/html/pages/device/port/pagp.inc.php index c23032266..433de9d91 100644 --- a/html/pages/device/port/pagp.inc.php +++ b/html/pages/device/port/pagp.inc.php @@ -27,7 +27,7 @@ - $members = mysql_query("SELECT * FROM `interfaces` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); + $members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); while($member = mysql_fetch_array($members)) { echo("$br " . generateiflink($member) . " (PAgP)"); $br = "
    "; diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index 77ad6a856..d1c027ba9 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -31,7 +31,7 @@ if($_GET['optc'] == thumbs) { $timeperiods = array('-1day','-1week','-1month','-1year'); $from = '-1day'; echo("
    "); - $sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; + $sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { @@ -55,7 +55,7 @@ if($_GET['optc'] == thumbs) { if($_GET['opta'] == "details" ) { $port_details = 1; } echo("
    "); $i = "1"; - $interface_query = mysql_query("select * from interfaces WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC"); + $interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC"); while($interface = mysql_fetch_array($interface_query)) { include("includes/print-interface.inc.php"); $i++; diff --git a/html/pages/edituser.php b/html/pages/edituser.php index 3736e0d3e..1164d6191 100644 --- a/html/pages/edituser.php +++ b/html/pages/edituser.php @@ -12,7 +12,7 @@ function getInterfaceList(sel) var index = ajax.length; ajax[index] = new sack(); - ajax[index].requestFile = '/ajax/list_interfaces.php?device_id='+deviceId; // Specifying which file to get + ajax[index].requestFile = '/ajax/list_ports.php?device_id='+deviceId; // Specifying which file to get ajax[index].onCompletion = function(){ createInterfaces(index) }; // Specify function that will be executed after file has been found ajax[index].runAJAX(); // Execute AJAX function } @@ -45,10 +45,10 @@ if($_GET['user_id']) { } if($_GET['action'] == "delifperm") { - mysql_query("DELETE FROM interfaces_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + mysql_query("DELETE FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); } if($_GET['action'] == "addifperm") { - mysql_query("INSERT INTO interfaces_perms (`interface_id`, `user_id`) VALUES ('" . $_GET['interface_id'] . "', '" . $_GET['user_id'] . "')"); + mysql_query("INSERT INTO ports_perms (`interface_id`, `user_id`) VALUES ('" . $_GET['interface_id'] . "', '" . $_GET['user_id'] . "')"); } if($_GET['action'] == "delbillperm") { @@ -98,7 +98,7 @@ echo("
    "); echo(""); echo("

    Interface Access

    "); - $interface_perm_data = mysql_query("SELECT * from interfaces_perms as P, interfaces as I, devices as D WHERE `user_id` = '" . $_GET['user_id'] . + $interface_perm_data = mysql_query("SELECT * from ports_perms as P, ports as I, devices as D WHERE `user_id` = '" . $_GET['user_id'] . "' AND I.interface_id = P.interface_id AND D.device_id = I.device_id"); while($interface_perm = mysql_fetch_array($interface_perm_data)) { diff --git a/html/pages/front/default.php b/html/pages/front/default.php index 08fc56c4c..ec9b68b3c 100644 --- a/html/pages/front/default.php +++ b/html/pages/front/default.php @@ -38,9 +38,9 @@ while($device = mysql_fetch_array($sql)){ } if($_SESSION['userlevel'] == '10') { -$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); } else { -$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); } while($interface = mysql_fetch_array($sql)){ $interface = ifNameDescr($interface); diff --git a/html/pages/front/demo.php b/html/pages/front/demo.php index 77e5edf17..89b808108 100644 --- a/html/pages/front/demo.php +++ b/html/pages/front/demo.php @@ -18,7 +18,7 @@ while($device = mysql_fetch_array($sql)){ } -$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND D.status = '1' AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND D.status = '1' AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); while($interface = mysql_fetch_array($sql)){ echo("
    diff --git a/html/pages/front/example2.php b/html/pages/front/example2.php index fa0a02743..52cbe3cf5 100644 --- a/html/pages/front/example2.php +++ b/html/pages/front/example2.php @@ -36,7 +36,7 @@ while($device = mysql_fetch_array($sql)){ } -$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); while($interface = mysql_fetch_array($sql)){ echo("
    @@ -110,54 +110,54 @@ echo("
    if($_SESSION['userlevel'] >= '5') { - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['l2tp'] .= $seperator . $interface['interface_id']; + $ports['l2tp'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['transit'] .= $seperator . $interface['interface_id']; + $ports['transit'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '%"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '%"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['voip'] .= $seperator . $interface['interface_id']; + $ports['voip'] .= $seperator . $interface['interface_id']; $seperator = ","; } - if($interfaces['transit']) { - echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    Internet Transit
    ". - "
    "); } - if($interfaces['l2tp']) { - echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    L2TP ADSL
    ". - "
    "); } - if($interfaces['voip']) { - echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    VoIP to PSTN
    ". - "
    "); } diff --git a/html/pages/front/jt.php b/html/pages/front/jt.php index 23befc982..7156b4be3 100644 --- a/html/pages/front/jt.php +++ b/html/pages/front/jt.php @@ -35,7 +35,7 @@ while($device = mysql_fetch_array($sql)){ if($config['warn']['ifdown']) { -$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); +$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); while($interface = mysql_fetch_array($sql)){ if(interfacepermitted($interface['interface_id'])) { echo("
    @@ -111,39 +111,39 @@ echo("
    if($_SESSION['userlevel'] >= '5') { - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['transit'] .= $seperator . $interface['interface_id']; + $ports['transit'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); while($interface = mysql_fetch_array($query)) { - $interfaces['peering'] .= $seperator . $interface['interface_id']; + $ports['peering'] .= $seperator . $interface['interface_id']; $seperator = ","; } - $interfaces['broadband'] = "3294,3295,688,3534"; - $interfaces['wave_broadband'] = "827"; + $ports['broadband'] = "3294,3295,688,3534"; + $ports['wave_broadband'] = "827"; - $interfaces['new_broadband'] = "3659,4149,4121,4108,3676,4135"; + $ports['new_broadband'] = "3659,4149,4121,4108,3676,4135"; echo("
    "); - if($interfaces['peering'] && $interfaces['transit']) { + if($ports['peering'] && $ports['transit']) { echo(""); } @@ -151,25 +151,25 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($interfaces['transit']) { + if($ports['transit']) { echo(""); } - if($interfaces['peering']) { + if($ports['peering']) { echo(""); } @@ -177,14 +177,14 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($interfaces['broadband'] && $interfaces['wave_broadband'] && $interfaces['new_broadband']) { + if($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) { echo(""); } @@ -192,40 +192,40 @@ if($_SESSION['userlevel'] >= '5') echo(""); - if($interfaces['wave_broadband']) { + if($ports['wave_broadband']) { echo(""); + "
    "); } echo("
    "); diff --git a/html/pages/ifdown.php b/html/pages/ifdown.php index e4684706a..bb8cead7a 100644 --- a/html/pages/ifdown.php +++ b/html/pages/ifdown.php @@ -4,7 +4,7 @@ $type = $_GET['id']; $sql = "select *, DATE_FORMAT(I.lastchange, '%l:%i%p %D %M %Y') AS changed, I.id as iid, I.snmpid as snmpid, D.id as did, D.hostname as hostname, I.if as ifname, I.name as ifalias "; -$sql .= "from interfaces as I, devices as D WHERE `up_admin` = 'up' AND `up` = 'down' AND I.host = D.id AND I.name NOT LIKE 'Test%'"; +$sql .= "from ports as I, devices as D WHERE `up_admin` = 'up' AND `up` = 'down' AND I.host = D.id AND I.name NOT LIKE 'Test%'"; $sql .= "AND I.name NOT LIKE '%[eng]%' ORDER BY D.hostname, I.if "; $query = mysql_query($sql); diff --git a/html/pages/iftype.php b/html/pages/iftype.php index 9500fe868..51f712249 100644 --- a/html/pages/iftype.php +++ b/html/pages/iftype.php @@ -11,7 +11,7 @@ echo(""); } $type_where .= ") "; - $sql = "select * from interfaces as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $sql = "select * from ports as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); while($interface = mysql_fetch_array($query)) { $if_list .= $seperator . $interface['interface_id']; @@ -24,7 +24,7 @@ echo("
    "); $types = implode(' + ',$types_array); echo(" - "); + "); echo("
    Total Graph for interfaces of type : ".$types."
    Total Graph for ports of type : ".$types."
    "); $graph_type = "multi_bits"; @@ -33,7 +33,7 @@ echo(""); echo(""); - $sql = "select * from interfaces as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias"; + $sql = "select * from ports as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); while($interface = mysql_fetch_array($query)) { $done = "yes"; diff --git a/html/pages/interfaces.php b/html/pages/interfaces.php index 3afda3284..db26ae10e 100644 --- a/html/pages/interfaces.php +++ b/html/pages/interfaces.php @@ -34,7 +34,7 @@
    "); if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; } if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; } -$sql = "SELECT * FROM `ipv4_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address"; +$sql = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address"; $query = mysql_query($sql); diff --git a/html/pages/ipv6.php b/html/pages/ipv6.php index 4e04d01f8..f33dea0a7 100644 --- a/html/pages/ipv6.php +++ b/html/pages/ipv6.php @@ -44,7 +44,7 @@ echo("
    "); if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; } if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; } -$sql = "SELECT * FROM `ipv6_addresses` AS A, `interfaces` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id $where ORDER BY A.ipv6_address"; +$sql = "SELECT * FROM `ipv6_addresses` AS A, `ports` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id $where ORDER BY A.ipv6_address"; $query = mysql_query($sql); diff --git a/html/pages/pseudowires.php b/html/pages/pseudowires.php index f3930ea1c..f95da23c4 100644 --- a/html/pages/pseudowires.php +++ b/html/pages/pseudowires.php @@ -12,7 +12,7 @@ print_optionbar_end(); echo("
    "); -$sql = "SELECT * FROM pseudowires AS P, interfaces AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr"; +$sql = "SELECT * FROM pseudowires AS P, ports AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr"; $query = mysql_query($sql); while($pw_a = mysql_fetch_array($query)) { @@ -23,7 +23,7 @@ while($pw_a = mysql_fetch_array($query)) { $i++; } - $pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `interfaces` AS I, `pseudowires` AS P WHERE D.device_id = '".$pw_a['peer_device_id']."' AND + $pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = '".$pw_a['peer_device_id']."' AND D.device_id = I.device_id AND P.cpwVcID = '".$pw_a['cpwVcID']."' AND P.interface_id = I.interface_id")); diff --git a/html/pages/purgeports.php b/html/pages/purgeports.php index d6b15196d..758013cdd 100644 --- a/html/pages/purgeports.php +++ b/html/pages/purgeports.php @@ -26,11 +26,11 @@ mysql_query("DELETE FROM `mac_accounting` WHERE `interface_id` = '$interface_id'"); mysql_query("DELETE FROM `links` WHERE `local_interface_id` = '$interface_id'"); mysql_query("DELETE FROM `links` WHERE `remote_interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `interfaces_perms` WHERE `interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `interfaces` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `ports_perms` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `ports` WHERE `interface_id` = '$interface_id'"); } - $ports = mysql_query("SELECT * FROM `interfaces` WHERE `deleted` = '1'"); + $ports = mysql_query("SELECT * FROM `ports` WHERE `deleted` = '1'"); while($port = mysql_fetch_array($ports)) { echo("
    Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] ); delete_port($port['interface_id']); diff --git a/html/pages/vrf.php b/html/pages/vrf.php index 36612f791..6bfbac917 100644 --- a/html/pages/vrf.php +++ b/html/pages/vrf.php @@ -41,11 +41,11 @@ if($_GET['opta'] == "details" ) { echo("
    "); include("includes/device-header.inc"); echo("
    "); - $interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); unset($seperator); echo(""); $i=1; - while($interface = mysql_fetch_array($interfaces)) { + while($interface = mysql_fetch_array($ports)) { if(!is_integer($x/2)) { if(is_integer($i/2)) { $int_colour = $list_colour_a_a; } else { $int_colour = $list_colour_a_b; } } else { diff --git a/html/pages/vrfs.php b/html/pages/vrfs.php index 350889f59..0d719a8cd 100644 --- a/html/pages/vrfs.php +++ b/html/pages/vrfs.php @@ -35,10 +35,10 @@ print_optionbar_end(); echo("
    ".generatedevicelink($device, shorthost($device['hostname']))); if($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } echo(""); - $interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); unset($seperator); - while($port = mysql_fetch_array($interfaces)) { + while($port = mysql_fetch_array($ports)) { $port = array_merge ($device, $port); if($_GET['opta']) { $port['width'] = "130"; diff --git a/includes/common.php b/includes/common.php index 804ceecee..795b2eeb2 100644 --- a/includes/common.php +++ b/includes/common.php @@ -13,7 +13,7 @@ function mres($string) { // short function wrapper because the real one is stupi } function getifhost($id) { - $sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'"); + $sql = mysql_query("SELECT `device_id` from `ports` WHERE `interface_id` = '$id'"); $result = @mysql_result($sql, 0); return $result; } @@ -45,19 +45,19 @@ function getpeerhost($id) { } function getifindexbyid($id) { - $sql = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `interface_id` = '$id'"); + $sql = mysql_query("SELECT `ifIndex` FROM `ports` WHERE `interface_id` = '$id'"); $result = @mysql_result($sql, 0); return $result; } function getifbyid($id) { - $sql = mysql_query("SELECT * FROM `interfaces` WHERE `interface_id` = '$id'"); + $sql = mysql_query("SELECT * FROM `ports` WHERE `interface_id` = '$id'"); $result = @mysql_fetch_array($sql); return $result; } function getifdescrbyid($id) { - $sql = mysql_query("SELECT `ifDescr` FROM `interfaces` WHERE `interface_id` = '$id'"); + $sql = mysql_query("SELECT `ifDescr` FROM `ports` WHERE `interface_id` = '$id'"); $result = @mysql_result($sql, 0); return $result; } diff --git a/includes/discovery/arp-table.php b/includes/discovery/arp-table.php index fbf2effa0..82dea9945 100644 --- a/includes/discovery/arp-table.php +++ b/includes/discovery/arp-table.php @@ -12,7 +12,7 @@ list($oid, $mac) = explode(" ", $data); list($if, $first, $second, $third, $fourth) = explode(".", $oid); list($m_a, $m_b, $m_c, $m_d, $m_e, $m_f) = explode(":", $mac); - $interface = mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'")); $ip = $first .".". $second .".". $third .".". $fourth; $m_a = zeropad($m_a); $m_b = zeropad($m_b); @@ -44,7 +44,7 @@ } $interface_id = $interface['interface_id']; } - $sql = "SELECT * from ipv4_mac AS M, interfaces as I WHERE M.interface_id = I.interface_id and I.device_id = '".$device['device_id']."'"; + $sql = "SELECT * from ipv4_mac AS M, ports as I WHERE M.interface_id = I.interface_id and I.device_id = '".$device['device_id']."'"; $query = mysql_query($sql); while($entry = mysql_fetch_array($query)) { $entry_mac = $entry['mac_address']; diff --git a/includes/discovery/cisco-mac-accounting.php b/includes/discovery/cisco-mac-accounting.php index a58910f96..d883d10d7 100755 --- a/includes/discovery/cisco-mac-accounting.php +++ b/includes/discovery/cisco-mac-accounting.php @@ -11,7 +11,7 @@ list($if, $direction, $a_a, $a_b, $a_c, $a_d, $a_e, $a_f) = explode(".", $oid); $oid = "$a_a.$a_b.$a_c.$a_d.$a_e.$a_f"; unset($interface); - $interface = mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifIndex = '".$if."'")); $ah_a = zeropad(dechex($a_a)); $ah_b = zeropad(dechex($a_b)); $ah_c = zeropad(dechex($a_c)); diff --git a/includes/discovery/cisco-pw.php b/includes/discovery/cisco-pw.php index 324a4aba2..02856f8b7 100755 --- a/includes/discovery/cisco-pw.php +++ b/includes/discovery/cisco-pw.php @@ -18,8 +18,8 @@ if($config['enable_pseudowires']) { if($cpwOid) { list($cpw_remote_id) = split(":", shell_exec($config['snmpget'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); $interface_descr = trim(shell_exec($config['snmpwalk'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); - $cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, interfaces AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0); - $if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `interfaces` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0); + $cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0); + $if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0); if($cpw_remote_device && $if_id) { $hostname = gethostbyid($cpw_remote_device); #echo("\nOid: " . $cpwOid . " cpwVcID: " . $cpwVcID . " Remote Id: " . $cpw_remote_id . "($hostname(".$cpw_remote_device.") -> $interface_descr($if_id))"); @@ -39,7 +39,7 @@ if($config['enable_pseudowires']) { } } -$sql = "SELECT * FROM pseudowires AS P, interfaces AS I, devices as D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id AND D.device_id = '".$device['device_id']."'"; +$sql = "SELECT * FROM pseudowires AS P, ports AS I, devices as D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id AND D.device_id = '".$device['device_id']."'"; $query = mysql_query($sql); while ($cpw = mysql_fetch_array($query)) { diff --git a/includes/discovery/cisco-vrf.php b/includes/discovery/cisco-vrf.php index 3341836c1..fa7cc5dfa 100755 --- a/includes/discovery/cisco-vrf.php +++ b/includes/discovery/cisco-vrf.php @@ -34,15 +34,15 @@ $vrf_id = @mysql_result(mysql_query("SELECT vrf_id FROM vrfs WHERE `device_id` = '".$device['device_id']."' AND `vrf_oid`='".$vrf['oid']."'"),0); $valid_vrf[$vrf_id] = 1; echo("\nRD:".$vrf['mplsVpnVrfRouteDistinguisher']." ".$vrf['name']." ".$vrf['mplsVpnVrfDescription']." "); - $interfaces_oid = ".1.3.6.1.3.118.1.2.1.1.2." . $vrf['oid']; - $interfaces = shell_exec($config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $interfaces_oid"); - $interfaces = trim(str_replace($interfaces_oid . ".", "", $interfaces)); -# list($interfaces) = explode(" ", $interfaces); + $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2." . $vrf['oid']; + $ports = shell_exec($config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $ports_oid"); + $ports = trim(str_replace($ports_oid . ".", "", $ports)); +# list($ports) = explode(" ", $ports); echo(" ( "); - foreach (explode("\n", $interfaces) as $if_id) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE ifIndex = '$if_id' AND device_id = '" . $device['device_id'] . "'")); + foreach (explode("\n", $ports) as $if_id) { + $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE ifIndex = '$if_id' AND device_id = '" . $device['device_id'] . "'")); echo(makeshortif($interface['ifDescr']) . " "); - mysql_query("UPDATE interfaces SET ifVrf = '".$vrf_id."' WHERE interface_id = '".$interface['interface_id']."'"); + mysql_query("UPDATE ports SET ifVrf = '".$vrf_id."' WHERE interface_id = '".$interface['interface_id']."'"); $if = $interface['interface_id']; $valid_vrf_if[$vrf_id][$if] = 1; } @@ -52,14 +52,14 @@ echo("\n"); - $sql = "SELECT * FROM interfaces WHERE device_id = '" . $device['device_id'] . "'"; + $sql = "SELECT * FROM ports WHERE device_id = '" . $device['device_id'] . "'"; $data = mysql_query($sql); while($row = mysql_fetch_array($data)) { $if = $row['interface_id']; $vrf_id = $row['ifVrf']; if($row['ifVrf']){ if(!$valid_vrf_if[$vrf_id][$if]) { echo("-"); - $query = @mysql_query("UPDATE interfaces SET `ifVrf` = NULL WHERE interface_id = '$if'"); + $query = @mysql_query("UPDATE ports SET `ifVrf` = NULL WHERE interface_id = '$if'"); } else {echo(".");} } } diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 8cf60bcfd..ad8c774f0 100755 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -11,7 +11,7 @@ if($fdp_array) { unset($fdp_links); foreach( array_keys($fdp_array) as $key) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'")); $fdp_if_array = $fdp_array[$key]; foreach( array_keys($fdp_if_array) as $entry_key) { @@ -19,7 +19,7 @@ if($fdp_array) { $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0); if($remote_device_id) { $if = $fdp['snFdpCacheDevicePort']; - $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `interfaces` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); + $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); } else { $remote_interface_id = "0"; } discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']); @@ -38,14 +38,14 @@ $cdp_array = $cdp_array[$device['device_id']]; if($cdp_array) { unset($cdp_links); foreach( array_keys($cdp_array) as $key) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'")); $cdp_if_array = $cdp_array[$key]; foreach( array_keys($cdp_if_array) as $entry_key) { $cdp = $cdp_if_array[$entry_key]; $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0); if($remote_device_id) { $if = $cdp['cdpCacheDevicePort']; - $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `interfaces` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); + $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); } else { $remote_interface_id = "0"; } if($interface['interface_id'] && $cdp['cdpCacheDeviceId'] && $cdp['cdpCacheDevicePort']) { discover_link($interface['interface_id'], 'cdp', $remote_interface_id, $cdp['cdpCacheDeviceId'], $cdp['cdpCacheDevicePort'], $cdp['cdpCachePlatform'], $cdp['cdpCacheVersion']); @@ -66,14 +66,14 @@ if($lldp_array) { foreach( array_keys($lldp_array) as $key) { $lldp_if_array = $lldp_array[$key]; foreach( array_keys($lldp_if_array) as $entry_key) { - $interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$entry_key."'")); + $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$entry_key."'")); $lldp_instance = $lldp_if_array[$entry_key]; foreach ( array_keys($lldp_instance) as $entry_instance) { $lldp = $lldp_instance[$entry_instance]; $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0); if($remote_device_id) { $if = $lldp['lldpRemPortDesc']; - $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `interfaces` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); + $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); } else { $remote_interface_id = "0"; } if($interface['interface_id'] && $lldp['lldpRemSysDesc'] && $lldp['lldpRemPortDesc']) { @@ -87,7 +87,7 @@ if($lldp_array) { if($debug) { print_r($link_exists); } -$sql = "SELECT * FROM `links` AS L, `interfaces` AS I WHERE L.local_interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"; +$sql = "SELECT * FROM `links` AS L, `ports` AS I WHERE L.local_interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"; if ($query = mysql_query($sql)) { while ($test = mysql_fetch_array($query)) diff --git a/includes/discovery/interfaces.php b/includes/discovery/interfaces.php index b7e84ad9f..1e8517d27 100755 --- a/includes/discovery/interfaces.php +++ b/includes/discovery/interfaces.php @@ -1,19 +1,19 @@ = "5") { $allowed = TRUE; - } elseif ( devicepermitted(mysql_result(mysql_query("SELECT `device_id` FROM `interfaces` WHERE `interface_id` = '$interface_id'"),0))) { + } elseif ( devicepermitted(mysql_result(mysql_query("SELECT `device_id` FROM `ports` WHERE `interface_id` = '$interface_id'"),0))) { $allowed = TRUE; - } elseif ( @mysql_result(mysql_query("SELECT `interface_id` FROM `interfaces_perms` WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0)) { + } elseif ( @mysql_result(mysql_query("SELECT `interface_id` FROM `ports_perms` WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0)) { $allowed = TRUE; } else { $allowed = FALSE; @@ -403,7 +403,7 @@ function delHost($id) global $config; $host = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '$id'"), 0); mysql_query("DELETE FROM `devices` WHERE `device_id` = '$id'"); - $int_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '$id'"); + $int_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '$id'"); while($int_data = mysql_fetch_array($int_query)) { $int_if = $int_data['ifDescr']; $int_id = $int_data['interface_id']; @@ -429,7 +429,7 @@ function delHost($id) mysql_query("DELETE FROM `alerts` WHERE `device_id` = '$id'"); mysql_query("DELETE FROM `eventlog` WHERE `host` = '$id'"); mysql_query("DELETE FROM `syslog` WHERE `device_id` = '$id'"); - mysql_query("DELETE FROM `interfaces` WHERE `device_id` = '$id'"); + mysql_query("DELETE FROM `ports` WHERE `device_id` = '$id'"); mysql_query("DELETE FROM `services` WHERE `service_host` = '$id'"); mysql_query("DELETE FROM `alerts` WHERE `device_id` = '$id'"); shell_exec("rm -rf ".$config['rrd_dir']."/$host"); @@ -441,7 +441,7 @@ function retireHost($id) global $config; $host = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '$id'"), 0); mysql_query("DELETE FROM `devices` WHERE `device_id` = '$id'"); - $int_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '$id'"); + $int_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '$id'"); while($int_data = mysql_fetch_array($int_query)) { $int_if = $int_data['ifDescr']; $int_id = $int_data['interface_id']; @@ -758,9 +758,9 @@ function discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_orig if ($ipv6_type == "Link-Local Unicast Addresses") return; # ignore link-locals (coming from IPV6-MIB) - if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` + if (mysql_result(mysql_query("SELECT count(*) FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $ipv6_prefixlen > '0' && $ipv6_prefixlen < '129' && $ipv6_compressed != '::1') { - $i_query = "SELECT interface_id FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"; + $i_query = "SELECT interface_id FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"; $interface_id = mysql_result(mysql_query($i_query), 0); if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv6_networks` WHERE `ipv6_network` = '$ipv6_network'"), 0) < '1') { mysql_query("INSERT INTO `ipv6_networks` (`ipv6_network`) VALUES ('$ipv6_network')"); diff --git a/includes/graphing.php b/includes/graphing.php index db1bdcc6c..c0082a187 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -5,14 +5,14 @@ include("graphing/fortigate.php"); include("graphing/windows.php"); include("graphing/unix.php"); -function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') { +function graph_multi_bits_trio ($ports, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') { global $config, $installdir; $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"; } $i = 1; - foreach(explode(",", $interfaces[0]) as $ifid) { - $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); + foreach(explode(",", $ports[0]) as $ifid) { + $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); $int = mysql_fetch_row($query); if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) { if(strstr($inverse, "a")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; } @@ -27,8 +27,8 @@ function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height } } unset($seperator); unset($plus); - foreach(explode(",", $interfaces[1]) as $ifid) { - $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); + foreach(explode(",", $ports[1]) as $ifid) { + $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); $int = mysql_fetch_row($query); if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) { if(strstr($inverse, "b")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; } @@ -43,8 +43,8 @@ function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height } } unset($seperator); unset($plus); - foreach(explode(",", $interfaces[2]) as $ifid) { - $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); + foreach(explode(",", $ports[2]) as $ifid) { + $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); $int = mysql_fetch_row($query); if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) { if(strstr($inverse, "c")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; } @@ -169,14 +169,14 @@ function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height } -function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') { +function graph_multi_bits_duo ($ports, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') { global $config, $installdir; $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"; } $i = 1; - foreach(explode(",", $interfaces[0]) as $ifid) { - $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); + foreach(explode(",", $ports[0]) as $ifid) { + $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); $int = mysql_fetch_row($query); if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) { $options .= " DEF:inoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE"; @@ -190,8 +190,8 @@ function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height, } } unset($seperator); unset($plus); - foreach(explode(",", $interfaces[1]) as $ifid) { - $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); + foreach(explode(",", $ports[1]) as $ifid) { + $query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id"); $int = mysql_fetch_row($query); if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) { $options .= " DEF:inoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE"; diff --git a/includes/polling/cisco-mac-accounting.inc.php b/includes/polling/cisco-mac-accounting.inc.php index dee20b0a6..650d7caaf 100755 --- a/includes/polling/cisco-mac-accounting.inc.php +++ b/includes/polling/cisco-mac-accounting.inc.php @@ -9,7 +9,7 @@ $polled = time(); $mac_entries = 0; -$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `interfaces` AS I where A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"); +$mac_accounting_query = mysql_query("SELECT * FROM `mac_accounting` as A, `ports` AS I where A.interface_id = I.interface_id AND I.device_id = '".$device['device_id']."'"); while ($acc = mysql_fetch_array($mac_accounting_query)) { $device_id = $acc['device_id']; diff --git a/includes/polling/cisco-poe.inc.php b/includes/polling/cisco-poe.inc.php index 52c809851..923fbcf1b 100644 --- a/includes/polling/cisco-poe.inc.php +++ b/includes/polling/cisco-poe.inc.php @@ -22,7 +22,7 @@ if($device['os_group'] == "ios") { $polled = time(); - $port_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."'"); + $port_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."'"); while ($port = mysql_fetch_array($port_query)) { if($array[$device[device_id]][$port[ifIndex]]) { // Check to make sure Port data is cached. diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php index b7e0b1d1f..ef8108a1c 100644 --- a/includes/polling/interfaces.inc.php +++ b/includes/polling/interfaces.inc.php @@ -13,7 +13,7 @@ if($device['os_group'] == "ios") { if($debug) { print_r($portifIndex); } } -$interface_query = mysql_query("SELECT * FROM `interfaces` $where"); +$interface_query = mysql_query("SELECT * FROM `ports` $where"); while ($interface = mysql_fetch_array($interface_query)) { if(!$device) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $interface['device_id'] . "'")); } @@ -115,7 +115,7 @@ while ($interface = mysql_fetch_array($interface_query)) { } if ($update) { - $update_query = "UPDATE `interfaces` SET "; + $update_query = "UPDATE `ports` SET "; $update_query .= $update; $update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'"; #echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n"); @@ -152,7 +152,7 @@ while ($interface = mysql_fetch_array($interface_query)) { } $rates = interface_rates ($rrdfile); - mysql_query("UPDATE `interfaces` SET in_rate = '" . $rates['in'] . "', out_rate = '" . $rates['out'] . "' WHERE interface_id= '" . $interface['interface_id'] . "'"); + mysql_query("UPDATE `ports` SET in_rate = '" . $rates['in'] . "', out_rate = '" . $rates['out'] . "' WHERE interface_id= '" . $interface['interface_id'] . "'"); } diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index a9cc0a9ae..1016711bf 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -57,8 +57,8 @@ ///// TO DO /// End New interface detection - /// Loop interfaces in the DB and update where necessary - $port_query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."'"); + /// Loop ports in the DB and update where necessary + $port_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."'"); while ($port = mysql_fetch_array($port_query)) { echo(" --> " . $port['ifDescr'] . " "); @@ -155,7 +155,7 @@ // Update MySQL if ($update) { - $update_query = "UPDATE `interfaces` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'"; + $update_query = "UPDATE `ports` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'"; @mysql_query($update_query); $mysql++; if($debug) {echo("\nMYSQL : [ $update_query ]");} } diff --git a/includes/snmptrap/linkDown.inc.php b/includes/snmptrap/linkDown.inc.php index 820d95917..20c79a99b 100644 --- a/includes/snmptrap/linkDown.inc.php +++ b/includes/snmptrap/linkDown.inc.php @@ -1,6 +1,6 @@ diff --git a/includes/snmptrap/linkUp.inc.php b/includes/snmptrap/linkUp.inc.php index e82531f2f..567b14454 100644 --- a/includes/snmptrap/linkUp.inc.php +++ b/includes/snmptrap/linkUp.inc.php @@ -1,6 +1,6 @@