mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
change interfaces table to ports (to match GUI conventions)
git-svn-id: http://www.observium.org/svn/observer/trunk@889 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -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"); }
|
||||
|
@@ -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) {
|
||||
|
22
cleanup.php
22
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");
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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` ;
|
||||
|
@@ -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");
|
||||
|
@@ -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";
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of interfaces and then call the multi_bits grapher to generate from the list
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE `ifAlias` LIKE 'Cust: ".mres($_GET['cust'])."%' AND D.device_id = I.device_id");
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE `ifAlias` LIKE 'Cust: ".mres($_GET['cust'])."%' AND D.device_id = I.device_id");
|
||||
while($int = mysql_fetch_array($query)) {
|
||||
if(is_file($config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd"))) {
|
||||
$rrd_filenames[] = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of interfaces and then call the multi_bits grapher to generate from the list
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$device = mres($_GET['device']);
|
||||
$hostname = gethostbyid($device);
|
||||
|
||||
$query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'");
|
||||
$query = mysql_query("SELECT `ifIndex`,`interface_id` FROM `ports` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'");
|
||||
while($int = mysql_fetch_row($query)) {
|
||||
if(is_file($config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd"))) {
|
||||
$rrd_filenames[] = $config['rrd_dir'] . "/" . $hostname . "/" . safename($int[0] . ".rrd");
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
|
||||
$acc = mysql_fetch_array($query);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($_GET['id'])."'
|
||||
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
|
||||
$acc = mysql_fetch_array($query);
|
||||
|
@@ -33,7 +33,7 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
|
||||
|
||||
$sql = "SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) AS bps,
|
||||
(M.cipMacHCSwitchedPkts_input_rate + M.cipMacHCSwitchedPkts_output_rate) AS pps
|
||||
FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$port."'
|
||||
FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.interface_id = '".$port."'
|
||||
AND I.interface_id = M.interface_id AND D.device_id = I.device_id ORDER BY $sort DESC LIMIT 0," . $topn;
|
||||
|
||||
$query = mysql_query($sql);
|
||||
@@ -46,7 +46,7 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
|
||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
|
||||
if($addy) {
|
||||
$name = $addy['ipv4_address'];
|
||||
$peer = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I, devices AS D
|
||||
$peer = 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($peer) {
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
if($_GET['port']) { $interfaces = $_GET['port']; }
|
||||
if($_GET['interfaces']) { $interfaces = $_GET['interfaces']; }
|
||||
if($_GET['port']) { $ports = $_GET['port']; }
|
||||
if($_GET['ports']) { $ports = $_GET['ports']; }
|
||||
|
||||
|
||||
$i = 1;
|
||||
foreach(explode(",", $interfaces) 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) 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] . "/" . safename($int[0] . ".rrd"))) {
|
||||
$rrd_filenames[] = $config['rrd_dir'] . "/" . $int[1] . "/" . safename($int[0] . ".rrd");
|
||||
|
@@ -10,8 +10,8 @@ function graph_multi_bits ($args) {
|
||||
if(!$args['nototal']) {$options .= " COMMENT:' Total'";}
|
||||
$options .= " COMMENT:'\\\\n'";
|
||||
|
||||
foreach(explode(",", $args['interfaces']) as $ifid) {
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
foreach(explode(",", $args['ports']) as $ifid) {
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_array($query);
|
||||
$this_rrd = $config['rrd_dir'] . "/" . $int['hostname'] . "/" . safename($int['ifIndex'] . ".rrd");
|
||||
$units='bps'; $unit='B'; $colours='greens'; $multiplier = "8"; $coloursb = 'blues';
|
||||
@@ -59,9 +59,9 @@ function graph_multi_bits ($args) {
|
||||
return $graphfile;
|
||||
}
|
||||
|
||||
if($_GET['if']) { $args['interfaces'] = $_GET['if']; }
|
||||
if($_GET['interfaces']) { $args['interfaces'] = $_GET['interfaces']; }
|
||||
if($interfaces) {$args['interfaces'] = $interfaces; }
|
||||
if($_GET['if']) { $args['ports'] = $_GET['if']; }
|
||||
if($_GET['ports']) { $args['ports'] = $_GET['ports']; }
|
||||
if($ports) {$args['ports'] = $ports; }
|
||||
|
||||
$args['graphfile'] = $graphfile;
|
||||
$args['from'] = $from;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of interfaces and then call the multi_bits grapher to generate from the list
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE interface_id = '".mres($_GET['port'])."'"));
|
||||
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE interface_id = '".mres($_GET['port'])."'"));
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$parent['device_id']."' AND `pagpGroupIfIndex` = '".$parent['ifIndex']."'");
|
||||
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$parent['device_id']."' AND `pagpGroupIfIndex` = '".$parent['ifIndex']."'");
|
||||
|
||||
$i=0;
|
||||
while($int = mysql_fetch_array($query)) {
|
||||
|
@@ -5,7 +5,7 @@ if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
|
@@ -5,7 +5,7 @@ if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
## Generate a list of interfaces and then call the multi_bits grapher to generate from the list
|
||||
## Generate a list of ports and then call the multi_bits grapher to generate from the list
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.interface_id = '".mres($_GET['port'])."'
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".mres($_GET['port'])."'
|
||||
AND I.device_id = D.device_id");
|
||||
$port = mysql_fetch_array($query);
|
||||
|
||||
|
@@ -5,7 +5,7 @@ if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
|
@@ -5,7 +5,7 @@ if($_GET['id']) { $interface = $_GET['id'];
|
||||
} elseif($_GET['if']) { $interface = $_GET['if'];
|
||||
} elseif($_GET['interface']) { $interface = $_GET['interface']; }
|
||||
|
||||
$query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
$query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.interface_id = '".$interface."'
|
||||
AND I.device_id = D.device_id");
|
||||
|
||||
$port = mysql_fetch_array($query);
|
||||
|
@@ -15,7 +15,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
||||
".$entry['humandate']."
|
||||
</td>");
|
||||
|
||||
$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("<td class=list-bold width=75>
|
||||
" . generateiflink($if) . "
|
||||
|
@@ -103,7 +103,7 @@
|
||||
echo("</td>");
|
||||
echo("<td width=375 valign=top class=interface-desc>");
|
||||
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("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generateiflink($link, makeshortif($link['label'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . "</a><br />");
|
||||
# $br = "<br />";
|
||||
@@ -119,7 +119,7 @@ echo("</td>");
|
||||
$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("</td>");
|
||||
$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("</td>");
|
||||
|
||||
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("</td>");
|
||||
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("</td>");
|
||||
$br = "<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<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generateiflink($member) . " (PAgP)</strong>");
|
||||
$br = "<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<img src='images/16/bricks.png' align=absmiddle> <strong>" . generateiflink($parent) . " (PAgP)</strong>");
|
||||
$br = "<br />";
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$service_alerts = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0'"),0);
|
||||
$if_alerts = mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"),0);
|
||||
$if_alerts = mysql_result(mysql_query("SELECT count(*) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"),0);
|
||||
$device_alerts = "0";
|
||||
$device_alert_sql = "WHERE 0";
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
$this_alert = 0;
|
||||
if ($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif ($device['ignore'] == '0') {
|
||||
if (mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_host = '".$device['device_id']."'"),0)) { $this_alert = "1"; }
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device['device_id'] . "'"),0)) { $this_alert = "1"; }
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM ports WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device['device_id'] . "'"),0)) { $this_alert = "1"; }
|
||||
}
|
||||
if ($this_alert) {
|
||||
$device_alerts++;
|
||||
@@ -106,16 +106,16 @@ if ($config['show_locations']) { echo('<li><a class="menu2four" href="locations/
|
||||
?>
|
||||
|
||||
|
||||
<li><a class="menu2four" href="interfaces/"><img src="images/16/connect.png" border="0" align="absmiddle" /> Ports</a>
|
||||
<li><a class="menu2four" href="ports/"><img src="images/16/connect.png" border="0" align="absmiddle" /> Ports</a>
|
||||
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="interfaces/"><img src="images/16/connect.png" border="0" align="absmiddle" /> All Ports</a></li>
|
||||
<li><a href="ports/"><img src="images/16/connect.png" border="0" align="absmiddle" /> All Ports</a></li>
|
||||
|
||||
<?php
|
||||
|
||||
if ($interfaces['errored']) {
|
||||
echo('<li><a href="interfaces/errors/"><img src="images/16/chart_curve_error.png" border="0" align="absmiddle" /> Errored ('.$interfaces['errored'].')</a></li>');
|
||||
if ($ports['errored']) {
|
||||
echo('<li><a href="ports/errors/"><img src="images/16/chart_curve_error.png" border="0" align="absmiddle" /> Errored ('.$ports['errored'].')</a></li>');
|
||||
}
|
||||
|
||||
if ($config['enable_billing']) { echo('<li><a href="bills/"><img src="images/16/money_pound.png" border="0" align="absmiddle" /> Traffic Bills</a></li>'); $ifbreak = 1;}
|
||||
@@ -143,13 +143,13 @@ if ($_SESSION['userlevel'] >= '5') {##FIXME html
|
||||
if ($ifbreak) { echo('<li><hr width="140" /></li>'); }
|
||||
|
||||
if (isset($interface_alerts)) {
|
||||
echo('<li><a href="interfaces/?status=0"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerts ('.$interface_alerts.')</a></li>');
|
||||
echo('<li><a href="ports/?status=0"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerts ('.$interface_alerts.')</a></li>');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<li><a href="interfaces/down/"><img src="images/16/if-disconnect.png" border="0" align="absmiddle" /> Down</a></li>
|
||||
<li><a href="interfaces/admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li>
|
||||
<li><a href="ports/down/"><img src="images/16/if-disconnect.png" border="0" align="absmiddle" /> Down</a></li>
|
||||
<li><a href="ports/admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li>
|
||||
</ul></td></tr></table>
|
||||
</li>
|
||||
|
||||
|
@@ -8,7 +8,7 @@ echo("<td width=100 class=list-large> Vlan " . $vlan['vlan_vlan'] . "</td>");
|
||||
echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</td>");
|
||||
|
||||
echo("<td class=list-bold>");
|
||||
$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']) {
|
||||
|
@@ -10,7 +10,7 @@ echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "<
|
||||
|
||||
|
||||
echo("<td class=list-bold>");
|
||||
$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'];
|
||||
|
@@ -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
|
||||
<td> ) </td>
|
||||
<td width=5></td>
|
||||
</tr>
|
||||
<tr style="background-color: <?php echo $interfaces['bgcolour'] ?>">
|
||||
<tr style="background-color: <?php echo $ports['bgcolour'] ?>">
|
||||
<td width="5"></td><td>Interfaces : </td>
|
||||
<td><?php echo $interfaces['count'] ?></td>
|
||||
<td><?php echo $ports['count'] ?></td>
|
||||
<td> ( </td>
|
||||
<td style='text-align: right'><span class=green> <?php echo $interfaces['up'] ?> up </span></td>
|
||||
<td style='text-align: right'><span class="red"> <?php echo $interfaces['down'] ?> down </span></td>
|
||||
<td style='text-align: right'><span class="black"> <?php echo $interfaces['ignored'] ?> ignored </span></td>
|
||||
<td style='text-align: right'><span class="grey"> <?php echo $interfaces['shutdown'] ?> shutdown</span></td>
|
||||
<td style='text-align: right'><span class=green> <?php echo $ports['up'] ?> up </span></td>
|
||||
<td style='text-align: right'><span class="red"> <?php echo $ports['down'] ?> down </span></td>
|
||||
<td style='text-align: right'><span class="black"> <?php echo $ports['ignored'] ?> ignored </span></td>
|
||||
<td style='text-align: right'><span class="grey"> <?php echo $ports['shutdown'] ?> shutdown</span></td>
|
||||
<td> ) </td>
|
||||
<td width=5></td>
|
||||
</tr>
|
||||
|
@@ -116,7 +116,7 @@ function popUp(URL) {
|
||||
<div style="margin: 7px;"></div>
|
||||
<?php
|
||||
if($_SESSION['authenticated']) {
|
||||
include("includes/warn-deleted-interfaces.inc.php");
|
||||
include("includes/warn-deleted-ports.inc.php");
|
||||
## Authenticated. Print a page.
|
||||
if(isset($_GET['page']) && !strstr("..", $_GET['page']) && is_file("pages/" . $_GET['page'] . ".php")) {
|
||||
include("pages/" . $_GET['page'] . ".php");
|
||||
|
10
html/map.php
10
html/map.php
@@ -25,7 +25,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
{
|
||||
if($device)
|
||||
{
|
||||
$sql = "SELECT * from interfaces AS I, links AS L WHERE I.device_id = ".$device['device_id']." AND L.local_interface_id = I.interface_id";
|
||||
$sql = "SELECT * from ports AS I, links AS L WHERE I.device_id = ".$device['device_id']." AND L.local_interface_id = I.interface_id";
|
||||
$links = mysql_query($sql);
|
||||
|
||||
if (mysql_num_rows($links))
|
||||
@@ -64,11 +64,11 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
}
|
||||
|
||||
$src = $device['hostname'];
|
||||
$dst = mysql_result(mysql_query("SELECT `hostname` FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
|
||||
$dst_host = mysql_result(mysql_query("SELECT D.device_id FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
|
||||
$dst = mysql_result(mysql_query("SELECT `hostname` FROM `devices` AS D, `ports` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
|
||||
$dst_host = mysql_result(mysql_query("SELECT D.device_id FROM `devices` AS D, `ports` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
|
||||
|
||||
$sif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['local_interface_id'])),$device);
|
||||
$dif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['remote_interface_id'])));
|
||||
$sif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['local_interface_id'])),$device);
|
||||
$dif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE `interface_id`=" . $link['remote_interface_id'])));
|
||||
|
||||
$map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue URL=\"/device/".$device['device_id']."/interface/$local_interface_id/\"]\n";
|
||||
if (!$ifdone[$src][$sif['interface_id']])
|
||||
|
@@ -35,7 +35,7 @@ else
|
||||
if($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "<span style='color: #f00;'>Priv eBGP</span>"; }
|
||||
}
|
||||
|
||||
$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); }
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D";
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D";
|
||||
$sql .= " WHERE I.ifAlias like 'Cust: %' AND I.device_id = D.device_id ORDER BY I.ifAlias,D.hostname";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
|
@@ -38,7 +38,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)){
|
||||
|
||||
generate_front_box("warn", "<center><strong>".generatedevicelink($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
@@ -145,47 +145,47 @@ echo("<div style='width: 290px; margin: 7px; float: right;'>
|
||||
|
||||
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("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
if($ports['transit']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['broadband'].
|
||||
if($ports['broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['broadband'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Broadband</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['broadband'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['broadband'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['wave_broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['wave_broadband'].
|
||||
if($ports['wave_broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['wave_broadband'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Wave Broadhand</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['wave_broadband'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['wave_broadband'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,7 @@ if(is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
|
||||
</li>');
|
||||
}
|
||||
|
||||
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('<li class="' . $select['ports'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/ports/' .$config['ports_page_default']. '">
|
||||
<img src="images/16/connect.png" align="absmiddle" border="0" /> 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('<li class="' . $select['map'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/map/">
|
||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM ipv4_mac AS M, interfaces AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
$sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
@@ -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); }
|
||||
|
@@ -32,12 +32,12 @@ print_optionbar_end();
|
||||
|
||||
if($peer['bgpPeerRemoteAs'] == $device['bgpLocalAs']) { $peer_type = "<span style='color: #00f;'>iBGP</span>"; } else { $peer_type = "<span style='color: #0a0;'>eBGP</span>"; }
|
||||
|
||||
$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) ) {
|
||||
|
@@ -23,7 +23,7 @@ function printEntPhysical($ent, $level, $class) {
|
||||
if($link) {echo("<a $link>");}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
|
||||
echo("<td><a href='#' $proc_popup>".$hrdevice['hrDeviceDescr']."</a></td>");
|
||||
} 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("<td>".generateiflink($interface)."</td>");
|
||||
} else {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface_query = mysql_query("select * from interfaces WHERE interface_id = '".$_GET['opta']."'");
|
||||
$interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'");
|
||||
$interface = mysql_fetch_array($interface_query);
|
||||
|
||||
$port_details = 1;
|
||||
@@ -42,7 +42,7 @@ $interface = mysql_fetch_array($interface_query);
|
||||
$broke = yes;
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) {
|
||||
$pagp = " | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/pagp/'>PAgP</a>";
|
||||
}
|
||||
|
||||
|
@@ -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("<div style='width: 50%; float: left;'>");
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($interfaces['total']) {
|
||||
if($ports['total']) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
|
||||
" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
|
||||
|
||||
@@ -8,16 +8,16 @@ if($interfaces['total']) {
|
||||
|
||||
echo("
|
||||
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
|
||||
<tr bgcolor=$interfaces_colour align=center><td></td>
|
||||
<td width=25%><img src='images/16/connect.png' align=absmiddle> $interfaces[total]</td>
|
||||
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $interfaces[up]</td>
|
||||
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $interfaces[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $interfaces[disabled]</td></tr>
|
||||
<tr bgcolor=$ports_colour align=center><td></td>
|
||||
<td width=25%><img src='images/16/connect.png' align=absmiddle> $ports[total]</td>
|
||||
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $ports[up]</td>
|
||||
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $ports[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $ports[disabled]</td></tr>
|
||||
</table>");
|
||||
|
||||
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$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);
|
||||
|
@@ -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); }
|
||||
|
@@ -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); }
|
||||
|
@@ -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<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generateiflink($member) . " (PAgP)</strong>");
|
||||
$br = "<br />";
|
||||
|
@@ -31,7 +31,7 @@ if($_GET['optc'] == thumbs) {
|
||||
$timeperiods = array('-1day','-1week','-1month','-1year');
|
||||
$from = '-1day';
|
||||
echo("<div style='display: block; clear: both; margin: auto;'>");
|
||||
$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("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$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++;
|
||||
|
@@ -12,7 +12,7 @@ function getInterfaceList(sel)
|
||||
var index = ajax.length;
|
||||
ajax[index] = new sack();
|
||||
|
||||
ajax[index].requestFile = '<?php echo($config['base_url']); ?>/ajax/list_interfaces.php?device_id='+deviceId; // Specifying which file to get
|
||||
ajax[index].requestFile = '<?php echo($config['base_url']); ?>/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("<table width=100%><tr><td valign=top width=33%>");
|
||||
echo("</td><td valign=top width=33%>");
|
||||
echo("<h3>Interface Access</h3>");
|
||||
|
||||
$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)) {
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
|
||||
|
@@ -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("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
|
||||
@@ -110,54 +110,54 @@ echo("</div>
|
||||
|
||||
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("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
if($ports['transit']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['l2tp']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
|
||||
if($ports['l2tp']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['l2tp'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['l2tp'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['voip']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
|
||||
if($ports['voip']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&ports=".$ports['voip'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['voip'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
|
@@ -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("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
|
||||
@@ -111,39 +111,39 @@ echo("</div>
|
||||
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("<div style=' margin-bottom: 5px;'>");
|
||||
|
||||
if($interfaces['peering'] && $interfaces['transit']) {
|
||||
if($ports['peering'] && $ports['transit']) {
|
||||
echo("<div style='width: 235px; '>
|
||||
<a href='internet/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits_duo&interfaces=".$interfaces['peering']."&interfaces_b=".$interfaces['transit']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits_duo&interfaces=".$interfaces['peering']."&interfaces_b=".$interfaces['transit']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits_duo&ports=".$ports['peering']."&ports_b=".$ports['transit']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits_duo&ports=".$ports['peering']."&ports_b=".$ports['transit']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Aggregate Internet Traffic</div>".
|
||||
"<img src='graph.php?type=multi_bits_duo&interfaces=".$interfaces['peering']."&interfaces_b=".$interfaces['transit'].
|
||||
"<img src='graph.php?type=multi_bits_duo&ports=".$ports['peering']."&ports_b=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=385&height=100&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
@@ -151,25 +151,25 @@ if($_SESSION['userlevel'] >= '5')
|
||||
|
||||
echo("<div style=' margin-bottom: 5px;'>");
|
||||
|
||||
if($interfaces['transit']) {
|
||||
if($ports['transit']) {
|
||||
echo("<div style='width: 235px; float: left;'>
|
||||
<a href='iftype/transit/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['transit']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['transit']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Transit</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['transit'].
|
||||
"&from=".$day."&to=".$now."&width=155&height=100&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
if($interfaces['peering']) {
|
||||
if($ports['peering']) {
|
||||
echo("<div style='width: 235px; float: right;'>
|
||||
<a href='iftype/peering/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['peering']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['peering']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['peering']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['peering']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Internet Peering</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['peering'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['peering'].
|
||||
"&from=".$day."&to=".$now."&width=155&height=100&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
@@ -177,14 +177,14 @@ if($_SESSION['userlevel'] >= '5')
|
||||
|
||||
echo("<div style=' margin-bottom: 5px;'>");
|
||||
|
||||
if($interfaces['broadband'] && $interfaces['wave_broadband'] && $interfaces['new_broadband']) {
|
||||
if($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) {
|
||||
echo("<div style='width: 466px; '>
|
||||
<a href='broadband/' onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits_trio&interfaces=".$interfaces['broadband']."&interfaces_b=".$interfaces['new_broadband']."&interfaces_c=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=c\'>\
|
||||
<img src=\'graph.php?type=multi_bits_trio&interfaces=".$interfaces['broadband']."&interfaces_b=".$interfaces['new_broadband']."&interfaces_c=".$interfaces['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=c\'>\
|
||||
<img src=\'graph.php?type=multi_bits_trio&ports=".$ports['broadband']."&ports_b=".$ports['new_broadband']."&ports_c=".$ports['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=c\'>\
|
||||
<img src=\'graph.php?type=multi_bits_trio&ports=".$ports['broadband']."&ports_b=".$ports['new_broadband']."&ports_c=".$ports['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=c\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Aggregate Broadband Traffic</div>".
|
||||
"<img src='graph.php?type=multi_bits_trio&interfaces=".$interfaces['broadband']."&interfaces_b=".$interfaces['new_broadband']."&interfaces_c=".$interfaces['wave_broadband'].
|
||||
"<img src='graph.php?type=multi_bits_trio&ports=".$ports['broadband']."&ports_b=".$ports['new_broadband']."&ports_c=".$ports['wave_broadband'].
|
||||
"&from=".$day."&to=".$now."&width=385&height=100&legend=no&inverse=c'></a></div>");
|
||||
}
|
||||
|
||||
@@ -192,40 +192,40 @@ if($_SESSION['userlevel'] >= '5')
|
||||
|
||||
echo("<div style=' margin-bottom: 5px;'>");
|
||||
|
||||
if($interfaces['broadband']) {
|
||||
if($ports['broadband']) {
|
||||
echo("<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['broadband']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['broadband']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['broadband']."&from=".$day."&to=".$now."&width=400&height=150\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['broadband']."&from=".$week."&to=".$now."&width=400&height=150\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Jersey Broadband ATM</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['broadband'].
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['broadband'].
|
||||
"&from=".$day."&to=".$now."&width=155&height=100&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
echo("<div style=' margin-bottom: 5px;'>");
|
||||
|
||||
if($interfaces['new_broadband']) {
|
||||
if($ports['new_broadband']) {
|
||||
echo("<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['new_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=0\'>\
|
||||
<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['new_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=0\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['new_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=0\'>\
|
||||
<img src=\'graph.php?type=multi_bits&ports=".$ports['new_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=0\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 16px; font-weight: bold; color: #555555;'>Jersey Broadband NGN</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['new_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=0&legend=no'></a></div>");
|
||||
"<img src='graph.php?type=multi_bits&ports=".$ports['new_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=0&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
echo("</div>");
|
||||
|
||||
|
||||
if($interfaces['wave_broadband']) {
|
||||
if($ports['wave_broadband']) {
|
||||
echo("<div style='width: 235px; float: left;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=".$ports['wave_broadband']."&from=".$day."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=".$ports['wave_broadband']."&from=".$week."&to=".$now."&width=400&height=150&inverse=1&legend=1\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". "
|
||||
<div style='font-size: 16px; font-weight: bold; color: #555555;'>Wave Broadband</div>".
|
||||
"<img src='graph.php?type=port_bits&port=".$interfaces['wave_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=1&legend=no'></a></div>");
|
||||
"<img src='graph.php?type=port_bits&port=".$ports['wave_broadband']."&from=".$day."&to=".$now."&width=155&height=100&inverse=1&legend=no'></a></div>");
|
||||
}
|
||||
|
||||
echo("</div>");
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -11,7 +11,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
}
|
||||
$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("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
$types = implode(' + ',$types_array);
|
||||
|
||||
echo("<tr bgcolor='$bg'>
|
||||
<td><span class=list-large>Total Graph for interfaces of type : ".$types."</span></td></tr>");
|
||||
<td><span class=list-large>Total Graph for ports of type : ".$types."</span></td></tr>");
|
||||
|
||||
echo("<tr bgcolor='$bg'><td>");
|
||||
$graph_type = "multi_bits";
|
||||
@@ -33,7 +33,7 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$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";
|
||||
|
@@ -34,7 +34,7 @@
|
||||
<select name='ifSpeed' id='ifSpeed'>
|
||||
<option value=''>All Speeds</option>
|
||||
<?php
|
||||
$query = mysql_query("SELECT `ifSpeed` FROM `interfaces` GROUP BY `ifSpeed` ORDER BY `ifSpeed`");
|
||||
$query = mysql_query("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`");
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
if ($data['ifSpeed'])
|
||||
{
|
||||
@@ -50,7 +50,7 @@
|
||||
<select name='ifType' id='ifType'>
|
||||
<option value=''>All Media</option>
|
||||
<?php
|
||||
$query = mysql_query("SELECT `ifType` FROM `interfaces` GROUP BY `ifType` ORDER BY `ifType`");
|
||||
$query = mysql_query("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`");
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
if ($data['ifType'])
|
||||
{
|
||||
@@ -80,9 +80,9 @@
|
||||
<?php
|
||||
|
||||
#if ($_SESSION['userlevel'] >= '5') {
|
||||
# $sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
|
||||
# $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
|
||||
#} else {
|
||||
# $sql = "SELECT * FROM `interfaces` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
|
||||
# $sql = "SELECT * FROM `ports` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
|
||||
#}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ if($_POST['ifSpeed']) { $where .= " AND I.ifSpeed = '".$_POST['ifSpeed']."'"; }
|
||||
if($_POST['ifAlias']) { $where .= " AND I.ifAlias LIKE '%".$_POST['ifAlias']."%'"; }
|
||||
if($_POST['deleted'] || $_GET['type'] == "deleted") { $where .= " AND I.deleted = '1'"; }
|
||||
|
||||
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where ORDER BY D.hostname, I.ifIndex";
|
||||
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where ORDER BY D.hostname, I.ifIndex";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
|
@@ -42,7 +42,7 @@ echo("<table width=100% cellspacing=0 cellpadding=2>");
|
||||
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);
|
||||
|
||||
|
@@ -44,7 +44,7 @@ echo("<table width=100% cellpadding=2 cellspacing=0>");
|
||||
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);
|
||||
|
||||
|
@@ -12,7 +12,7 @@ print_optionbar_end();
|
||||
|
||||
echo("<table cellpadding=5 cellspacing=0 class=devicetable width=100%>");
|
||||
|
||||
$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"));
|
||||
|
@@ -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("<div style='font-weight: bold;'>Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] );
|
||||
delete_port($port['interface_id']);
|
||||
|
@@ -41,11 +41,11 @@ if($_GET['opta'] == "details" ) {
|
||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
include("includes/device-header.inc");
|
||||
echo("</table>");
|
||||
$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("<table cellspacing=0 cellpadding=7>");
|
||||
$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 {
|
||||
|
@@ -35,10 +35,10 @@ print_optionbar_end();
|
||||
echo("<tr bgcolor='$dev_colour'><td width=150>".generatedevicelink($device, shorthost($device['hostname'])));
|
||||
if($device['vrf_name'] != $vrf['vrf_name']) { echo("<a href='#' onmouseover=\" return overlib('Expected Name : ".$vrf['vrf_name']."<br />Configured : ".$device['vrf_name']."', CAPTION, '<span class=list-large>VRF Inconsistency</span>' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> <img align=absmiddle src=images/16/exclamation.png></a>"); }
|
||||
echo("</td><td>");
|
||||
$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";
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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'];
|
||||
|
@@ -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));
|
||||
|
@@ -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)) {
|
||||
|
@@ -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(".");} }
|
||||
}
|
||||
|
||||
|
@@ -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))
|
||||
|
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
# Discover interfaces
|
||||
# Discover ports
|
||||
|
||||
echo("Interfaces : ");
|
||||
|
||||
$interfaces = snmp_walk($device, "ifDescr", "-Onsq", "IF-MIB");
|
||||
$ports = snmp_walk($device, "ifDescr", "-Onsq", "IF-MIB");
|
||||
|
||||
$interfaces = str_replace("\"", "", $interfaces);
|
||||
$interfaces = str_replace("ifDescr.", "", $interfaces);
|
||||
$interfaces = str_replace(" ", "||", $interfaces);
|
||||
$ports = str_replace("\"", "", $ports);
|
||||
$ports = str_replace("ifDescr.", "", $ports);
|
||||
$ports = str_replace(" ", "||", $ports);
|
||||
|
||||
$interface_ignored = 0;
|
||||
$interface_added = 0;
|
||||
|
||||
foreach(explode("\n", $interfaces) as $entry){
|
||||
foreach(explode("\n", $ports) as $entry){
|
||||
|
||||
$entry = trim($entry);
|
||||
list($ifIndex, $ifDescr) = explode("||", $entry);
|
||||
@@ -30,19 +30,19 @@
|
||||
}
|
||||
if ($debug) echo("\n $if ");
|
||||
if ($nullintf == 0) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifDescr')");
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `ports` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifDescr')");
|
||||
# Add Interface
|
||||
echo("+");
|
||||
} else {
|
||||
mysql_query("UPDATE `interfaces` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '0' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
echo(".");
|
||||
}
|
||||
$int_exists[] = "$ifIndex";
|
||||
} else {
|
||||
# Ignored Interface
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') {
|
||||
mysql_query("UPDATE `interfaces` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0') {
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'");
|
||||
# Delete Interface
|
||||
echo("-"); ## Deleted Interface
|
||||
} else {
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = '0'";
|
||||
$sql = "SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `deleted` = '0'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($test_if = mysql_fetch_array($query)) {
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
if(!$exists) {
|
||||
echo("-");
|
||||
mysql_query("UPDATE `interfaces` SET `deleted` = '1' WHERE interface_id = '" . $test_if['interface_id'] . "'");
|
||||
mysql_query("UPDATE `ports` SET `deleted` = '1' WHERE interface_id = '" . $test_if['interface_id'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,8 +14,8 @@
|
||||
list($net,$cidr) = explode("/", $network);
|
||||
$cidr = trim($cidr);
|
||||
if($mask == "255.255.255.255") { $cidr = "32"; $network = "$oid/$cidr"; }
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $oid != "0.0.0.0") {
|
||||
$i_query = "SELECT interface_id FROM `interfaces` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'";
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) != '0' && $oid != "0.0.0.0") {
|
||||
$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 `ipv4_networks` WHERE `ipv4_network` = '$network'"), 0) < '1') {
|
||||
mysql_query("INSERT INTO `ipv4_networks` (`ipv4_network`) VALUES ('$network')");
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ipv4_addresses AS A, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$sql = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$data = mysql_query($sql);
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
$full_address = $row['ipv4_address'] . "/" . $row['ipv4_prefixlen'] . "|" . $row['ifIndex'];
|
||||
|
@@ -49,7 +49,7 @@ if (!$oids)
|
||||
} # foreach
|
||||
} # if $oids
|
||||
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, interfaces AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.interface_id = I.interface_id";
|
||||
$data = mysql_query($sql);
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
$full_address = $row['ipv6_address'] . "/" . $row['ipv6_prefixlen'];
|
||||
|
@@ -173,9 +173,9 @@ function interfacepermitted($interface_id)
|
||||
global $_SESSION;
|
||||
if ($_SESSION['userlevel'] >= "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')");
|
||||
|
@@ -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";
|
||||
|
@@ -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'];
|
||||
|
@@ -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.
|
||||
|
@@ -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'] . "'");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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 ]");}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
|
||||
if(!$interface) {exit;}
|
||||
|
||||
@@ -14,7 +14,7 @@ if(!$interface) {exit;}
|
||||
#}
|
||||
if($ifOperStatus != $interface['ifOperStatus']) {
|
||||
log_event("Interface went Down : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['interface_id']);
|
||||
mysql_query("UPDATE `interfaces` SET ifOperStatus = 'down' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
mysql_query("UPDATE `ports` SET ifOperStatus = 'down' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '".$entry[2]."'"));
|
||||
|
||||
if(!$interface) {exit;}
|
||||
|
||||
@@ -11,11 +11,11 @@ if(!$interface) {exit;}
|
||||
|
||||
if($ifAdminStatus != $interface['ifAdminStatus']) {
|
||||
log_event("Interface Enabled : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['interface_id']);
|
||||
mysql_query("UPDATE `interfaces` SET ifAdminStatus = 'up' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
mysql_query("UPDATE `ports` SET ifAdminStatus = 'up' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
}
|
||||
if($ifOperStatus != $interface['ifOperStatus']) {
|
||||
log_event("Interface went Up : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['interface_id']);
|
||||
mysql_query("UPDATE `interfaces` SET ifOperStatus = 'up' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
mysql_query("UPDATE `ports` SET ifOperStatus = 'up' WHERE `interface_id` = '".$interface['interface_id']."'");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@ function process_syslog ($entry, $update) {
|
||||
if($device_id_host) {
|
||||
$entry['device_id'] = $device_id_host;
|
||||
} else {
|
||||
$device_id_ip = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, interfaces AS I WHERE
|
||||
$device_id_ip = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE
|
||||
A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id"),0);
|
||||
if($device_id_ip) {
|
||||
$entry['device_id'] = $device_id_ip;
|
||||
|
6
map.php
6
map.php
@@ -58,7 +58,7 @@ echo("\n}\n");
|
||||
|
||||
}
|
||||
|
||||
$links_sql = "SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, interfaces AS I, interfaces AS X, devices as D, devices as Y WHERE I.device_id = D.device_id AND X.device_id = Y.device_id AND L.local_interface_id = I.interface_id AND X.interface_id = L.remote_interface_id";
|
||||
$links_sql = "SELECT *, X.ifDescr AS sif, I.ifDescr AS dif FROM links AS L, ports AS I, ports AS X, devices as D, devices as Y WHERE I.device_id = D.device_id AND X.device_id = Y.device_id AND L.local_interface_id = I.interface_id AND X.interface_id = L.remote_interface_id";
|
||||
|
||||
$links_result = mysql_query($links_sql);
|
||||
while($link_data = mysql_fetch_array($links_result)) {
|
||||
@@ -66,8 +66,8 @@ while($link_data = mysql_fetch_array($links_result)) {
|
||||
$local_interface_id = $link_data['local_interface_id'];
|
||||
$remote_interface_id = $link_data['remote_interface_id'];
|
||||
|
||||
$sq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$local_interface_id'"));
|
||||
$dq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM interfaces AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$remote_interface_id'"));
|
||||
$sq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM ports AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$local_interface_id'"));
|
||||
$dq = mysql_fetch_row(mysql_query("SELECT `hostname`,`ifSpeed` FROM ports AS I, devices as D where I.device_id = D.device_id and I.interface_id = '$remote_interface_id'"));
|
||||
|
||||
$src = $sq[0];
|
||||
$dst = $dq[0];
|
||||
|
@@ -21,7 +21,7 @@ while ($bill_data = mysql_fetch_array($bill_query)) {
|
||||
}
|
||||
|
||||
function CollectData($bill_id) {
|
||||
$port_query = mysql_query("select * from bill_ports as P, interfaces as I, devices as D where P.bill_id='$bill_id' AND I.interface_id = P.port_id AND D.device_id = I.device_id");
|
||||
$port_query = mysql_query("select * from bill_ports as P, ports as I, devices as D where P.bill_id='$bill_id' AND I.interface_id = P.port_id AND D.device_id = I.device_id");
|
||||
|
||||
while ($port_data = mysql_fetch_array($port_query)) {
|
||||
unset($port_in_measurement);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
$device = @mysql_fetch_array(mysql_query("SELECT * FROM devices WHERE `hostname` = '".$entry['0']."'"));
|
||||
|
||||
if(!$device['device_id']) {
|
||||
$device = @mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, interfaces AS I WHERE
|
||||
$device = @mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I WHERE
|
||||
A.ipv4_address = '" . $entry['0']."' AND I.interface_id = A.interface_id"));
|
||||
}
|
||||
if(!$device['device_id']) { exit; } else { }
|
||||
|
@@ -4,10 +4,10 @@
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
$interfaces = mysql_result(mysql_query("SELECT count(*) FROM interfaces"),0);
|
||||
$ports = mysql_result(mysql_query("SELECT count(*) FROM ports"),0);
|
||||
$devices = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
|
||||
|
||||
$dataHandle = fopen("http://www.observernms.org/latest.php?i=$interfaces&d=$devices&v=".$config['version'], r);
|
||||
$dataHandle = fopen("http://www.observernms.org/latest.php?i=$ports&d=$devices&v=".$config['version'], r);
|
||||
|
||||
if($dataHandle)
|
||||
{
|
||||
|
Reference in New Issue
Block a user