diff --git a/discovery-test.php b/discovery-test.php index 44b631cb3..68c1fcef3 100755 --- a/discovery-test.php +++ b/discovery-test.php @@ -38,7 +38,9 @@ while ($device = mysql_fetch_array($device_query)) { # include("includes/discovery/unix-memory.php"); - include("cisco-vrf.php"); + include("cisco-pw.php"); + +# include("cisco-vrf.php"); echo("\n"); $devices_polled++; } diff --git a/discovery.php b/discovery.php index c3ad3104c..07673c517 100755 --- a/discovery.php +++ b/discovery.php @@ -57,6 +57,7 @@ while ($device = mysql_fetch_array($device_query)) { include("includes/discovery/cisco-vlans.php"); include("includes/discovery/cisco-physical.php"); include("includes/discovery/bgp-peers.php"); + include("includes/discovery/cisco-pw.php"); } echo("\n"); $devices_polled++; diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 08d18ebe4..c49dc120a 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -25,13 +25,15 @@ $graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits"; + echo(" - - + "); + + echo(" " . generateiflink($interface, "$i. $ifDescr") . " $error_img
$ifAlias"); - if($ifAlias) { echo("
"); } + if($ifAlias) { echo("
"); } unset ($break); if(!$dographs) { @@ -176,6 +178,17 @@ echo(""); } + $pseudowires = mysql_query("SELECT * FROM `pseudowires` WHERE `interface_id` = '" . $interface['interface_id'] . "'"); + 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 + P.cpwVcID = '".$pseudowire['cpwVcID']."' AND + P.interface_id = I.interface_id")); + echo(" " . generateiflink($pw_peer_int, makeshortif($pw_peer_int['ifDescr'])) ." on ". generatedevicelink($pw_peer_dev) . ""); + } + + echo(""); // If we're showing graphs, generate the graph and print the img tags diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index ca1613d24..477fd47dc 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -37,6 +37,7 @@ echo("
  • Syslog
  • "); } ?>
  • Alerts
  • +
  • Inventory
  • diff --git a/includes/discovery/cisco-pw.php b/includes/discovery/cisco-pw.php new file mode 100755 index 000000000..cf0b5cdcc --- /dev/null +++ b/includes/discovery/cisco-pw.php @@ -0,0 +1,38 @@ + $interface_descr($if_id)) \n"); + + if(mysql_result(mysql_query("SELECT count(*) FROM pseudowires WHERE `interface_id` = '$if_id' + AND `cpwVcID`='".$cpwVcID."'"),0)) { + echo("already have! \n"); + } else { + $insert_query = "INSERT INTO `pseudowires` (`interface_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`) "; + $insert_query .= "VALUES ('$if_id','$cpw_remote_device','$cpw_remote_id','$cpwVcID', '$cpwOid')"; + mysql_query($insert_query); + } + + } + } + } +} + +?> diff --git a/includes/functions.php b/includes/functions.php index 47aa7c046..84c8a97c9 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -273,7 +273,7 @@ function generatedevicelink($device, $text=0, $start=0, $end=0) { if(!$end) { $end = $now; } $class = devclass($device); if(!$text) { $text = $device['hostname']; } - $graph_url = "graph.php?host=" . $device[device_id] . "&from=$start&to=$end&width=400&height=120&type=cpu"; + $graph_url = "graph.php?host=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=cpu"; $link = "".$device['hostname']." - CPU Load"; $link .= "'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">$text"; @@ -551,7 +551,7 @@ function fixiftype ($type) { } function fixifName ($inf) { - if(strstr($inf, "oopback")) { $inf = "loopback"; } + #if(strstr($inf, "oopback")) { $inf = "loopback"; } $inf = str_replace("ether", "Ether", $inf); $inf = str_replace("gig", "Gig", $inf); $inf = str_replace("fast", "Fast", $inf);