diff --git a/html/images/os/asa.gif b/html/images/os/asa.gif
new file mode 100755
index 0000000000..5af6d830c7
Binary files /dev/null and b/html/images/os/asa.gif differ
diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc
index c232971884..2c0154ef59 100644
--- a/html/includes/print-interface.inc
+++ b/html/includes/print-interface.inc
@@ -5,6 +5,8 @@
$interface['device_id'] = $device['device_id'];
$interface['hostname'] = $device['hostname'];
+ $interface = ifNameDescr($interface);
+
$if_id = $interface['interface_id'];
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
@@ -17,7 +19,7 @@
");
echo("
- " . generateiflink($interface, "$i. ".fixifName($interface['ifDescr'])) . " $error_img
+ " . generateiflink($interface, $interface['ifIndex'] . ". ".fixifName($interface['label'])) . " $error_img
".$interface['ifAlias']."");
@@ -85,10 +87,10 @@
echo(" | ");
echo("");
- if ( strpos($interface['ifDescr'], "oopback") === false && !$graph_type) {
+ 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.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id");
while($link = mysql_fetch_array($link_query)) {
-# echo(" " . generateiflink($link, makeshortif($link['ifDescr'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . " ");
+# echo(" " . generateiflink($link, makeshortif($link['label'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . " ");
# $br = " ";
$int_links[$link['interface_id']] = $link['interface_id'];
$int_links_phys[$link['interface_id']] = 1;
@@ -112,7 +114,7 @@ echo(" | ");
$this_ifid = $new['interface_id'];
$this_hostid = $new['device_id'];
$this_hostname = $new['hostname'];
- $this_ifname = fixifName($new['ifDescr']);
+ $this_ifname = fixifName($new['label']);
$int_links[$this_ifid] = $this_ifid;
$int_links_v4[$this_ifid] = 1;
}
@@ -132,7 +134,7 @@ echo("");
$this_ifid = $new['interface_id'];
$this_hostid = $new['device_id'];
$this_hostname = $new['hostname'];
- $this_ifname = fixifName($new['ifDescr']);
+ $this_ifname = fixifName($new['label']);
$int_links[$this_ifid] = $this_ifid;
$int_links_v6[$this_ifid] = 1;
}
@@ -148,7 +150,7 @@ echo("");
if($int_links_phys[$int_link]) { echo("
"); } else {
echo("
"); }
- echo("" . generateiflink($link_if, makeshortif($link_if['ifDescr'])) . " on " . generatedevicelink($link_if, shorthost($link_if['hostname'])) );
+ echo("" . generateiflink($link_if, makeshortif($link_if['label'])) . " on " . generatedevicelink($link_if, shorthost($link_if['hostname'])) );
if($int_links_v6[$int_link]) { echo(" v6"); }
if($int_links_v4[$int_link]) { echo(" v4"); }
@@ -166,7 +168,8 @@ echo("");
$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, shorthost($pw_peer_dev['hostname'])) . "");
+ $pw_peer_int = ifNameDescr($pw_peer_int);
+ echo("
" . generateiflink($pw_peer_int, makeshortif($pw_peer_int['label'])) ." on ". generatedevicelink($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . "");
}
diff --git a/html/pages/device.php b/html/pages/device.php
index 504d5d9772..88589319c5 100644
--- a/html/pages/device.php
+++ b/html/pages/device.php
@@ -16,9 +16,10 @@ $select[$section] = "selected";
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'");
while($device = mysql_fetch_array($device_query)) {
- echo("");
+ echo("");
include("includes/device-header.inc");
- echo("
");
+ echo("
");
echo("");
diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php
index 78e5dffb25..0b687386b7 100644
--- a/html/pages/device/overview.inc.php
+++ b/html/pages/device/overview.inc.php
@@ -202,8 +202,9 @@ echo("
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "'";
$query = mysql_query($sql);
while($data = mysql_fetch_array($query)) {
+ $data = ifNameDescr($data);
$data['hostname'] = $device['hostname'];
- echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['ifDescr']))));
+ echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['label']))));
$ifsep = ", ";
}
unset($ifsep);
diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php
index 03d2a4054a..7316c95fd3 100644
--- a/html/pages/device/ports.inc.php
+++ b/html/pages/device/ports.inc.php
@@ -60,16 +60,46 @@ if($_GET['optc'] == thumbs) {
echo("
");
} else {
if($_GET['opta'] == "details" ) { $port_details = 1; }
- $hostname = gethostbyid($device['device_id']);
- echo("");
- $i = "1";
- $interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
- while($interface = mysql_fetch_array($interface_query)) {
- include("includes/print-interface.inc");
- $i++;
+ if($_GET['opta'] == "arp" ) {
+
+ $interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
+ echo("Address | Hardware Addr | Interface | Remote Device | Remote Port |
");
+ $i = 1;
+ while($interface = mysql_fetch_array($interface_query)) {
+ $sql = "SELECT * FROM `ipv4_mac` WHERE `interface_id` = '".$interface['interface_id']."'";
+ $arp_query = mysql_query($sql);
+ while($arp = mysql_fetch_array($arp_query)) {
+ $i++;
+ if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+ $r_sql = "SELECT * FROM `ipv4_addresses` AS A, `interfaces` AS I, `devices` AS D WHERE I.interface_id = A.interface_id AND
+ I.device_id = D.device_id AND A.ipv4_address = '".$arp['ipv4_address']."' ORDER BY A.ipv4_address";
+ $remote = mysql_fetch_array(mysql_query($r_sql));
+ $mac = formatMac($arp['mac_address']);
+ echo("
+ " . $arp['ipv4_address'] . " | " . $mac . " | ".generateiflink($interface)." | ");
+ if ($remote['interface_id'] == $interface['interface_id']) {
+ echo("local | local | ");
+ } elseif($remote['device_id']) {
+ echo("" . generatedevicelink($remote) . " | " . generateiflink($remote) . " | ");
+ } else {
+ echo(" | | ");
+ }
+ echo("
");
+ }
+ echo("");
+ }
+ echo("
");
+ } else {
+ echo("");
+ $i = "1";
+ $interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
+ while($interface = mysql_fetch_array($interface_query)) {
+ include("includes/print-interface.inc");
+ $i++;
+ }
+ echo("
");
+ echo("");
}
- echo("
");
- echo("");
}
?>
diff --git a/includes/discovery/cisco-mac-accounting.php b/includes/discovery/cisco-mac-accounting.php
index 6abaa0becc..c86eb083f5 100755
--- a/includes/discovery/cisco-mac-accounting.php
+++ b/includes/discovery/cisco-mac-accounting.php
@@ -30,6 +30,8 @@
$mac_table[$if][$mac]['ciscomac'] = "$m_a$m_b.$m_c$m_d.$m_e$m_f";
$clean_mac = $m_a . $m_b . $m_c . $m_d . $m_e . $m_f;
$mac_table[$if][$mac]['cleanmac'] = $clean_mac;
+ $interface_id = $interface['interface_id'];
+ $mac_table[$interface_id][$clean_mac] = 1;
if(mysql_result(mysql_query("SELECT COUNT(*) from ipv4_mac WHERE interface_id = '".$interface['interface_id']."' AND ipv4_address = '$ip'"),0)) {
$sql = "UPDATE `ipv4_mac` SET `mac_address` = '$clean_mac' WHERE interface_id = '".$interface['interface_id']."' AND ipv4_address = '$ip'";
mysql_query($sql);
@@ -37,8 +39,24 @@
#echo("Add MAC $mac\n");
mysql_query("INSERT INTO `ipv4_mac` (interface_id, mac_address, ipv4_address) VALUES ('".$interface['interface_id']."','$clean_mac','$ip')");
}
+ $interface_id = $interface['interface_id'];
}
+ print_r($mac_table);
+
+ $sql = "SELECT * from ipv4_mac AS M, interfaces 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'];
+ $entry_if = $entry['interface_id'];
+ if(!$mac_table[$entry_if][$entry_mac]) {
+ mysql_query("DELETE FROM ipv4_mac WHERE interface_id = '".$entry_if."' AND mac_address = '".$entry_mac."'");
+ echo("Removing MAC $entry_mac from interface ".$interface['ifName']);
+ }
+ }
+
+ unset($mac);
+
$datas = shell_exec($config['snmpbulkwalk'] . " -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes");
echo("$datas\n");
echo("done\n");
diff --git a/includes/functions.php b/includes/functions.php
index 3977b5305b..e597812e4d 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -280,7 +280,8 @@ function geteventicon ($message)
function generateiflink($interface, $text=0,$type=bits)
{
global $twoday; global $now; global $config; global $day; global $month;
- if(!$text) { $text = fixIfName($interface['ifDescr']); }
+ $interface = ifNameDescr($interface);
+ if(!$text) { $text = fixIfName($interface['label']); }
if(!$type) { $type = 'bits'; }
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
$graph_url = $config['base_url'] . "/graph.php?if=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $type;
@@ -288,7 +289,7 @@ function generateiflink($interface, $text=0,$type=bits)
$device_id = getifhost($interface['interface_id']);
$link = "";
+ $link .= "
', CAPTION, '" . $interface['hostname'] . " - " . fixifName($interface['label']) . "";
if($interface['ifAlias']) { $link .= "
" . $interface['ifAlias']; }
$link .= "' ";
$link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >$text";
diff --git a/includes/osdiscovery/discover-asa.php b/includes/osdiscovery/discover-asa.php
new file mode 100755
index 0000000000..45b61ec637
--- /dev/null
+++ b/includes/osdiscovery/discover-asa.php
@@ -0,0 +1,7 @@
+
diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php
index 15ab9c6a77..955f22f870 100644
--- a/includes/polling/interfaces.inc.php
+++ b/includes/polling/interfaces.inc.php
@@ -19,14 +19,15 @@ while ($interface = mysql_fetch_array($interface_query)) {
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
$snmp_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
- $snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'];
+ $snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'] . " ifName." . $interface['ifIndex'];
+ $snmp_cmd .= " ifDescr." . $interface['ifIndex'];
$snmp_output = trim(shell_exec($snmp_cmd));
$snmp_output = str_replace("No Such Object available on this agent at this OID", "", $snmp_output);
$snmp_output = str_replace("No Such Instance currently exists at this OID", "", $snmp_output);
$snmp_output = str_replace("\"", "", $snmp_output);
- list($ifAdminStatus, $ifOperStatus, $ifAlias) = explode("\n", $snmp_output);
+ list($ifAdminStatus, $ifOperStatus, $ifAlias, $ifName, $ifDescr) = explode("\n", $snmp_output);
$ifAdminStatus = translate_ifAdminStatus ($ifAdminStatus);
$ifOperStatus = translate_ifOperStatus ($ifOperStatus);
@@ -37,7 +38,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$ifDescr = trim(str_replace("\"", "", $ifDescr));
$ifDescr = trim($ifDescr);
- if(!$ifDescr) { $ifDescr = $ifName; }
+# if(!$ifDescr) { $ifDescr = $ifName; }
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
@@ -63,10 +64,23 @@ while ($interface = mysql_fetch_array($interface_query)) {
if( file_exists("includes/polling/interface-" . $device['os'] . ".php") ) { include("includes/polling/interface-" . $device['os'] . ".php"); }
+ if ( $interface['ifDescr'] != $ifDescr ) {
+ $update .= $seperator . "`ifDescr` = '$ifDescr'";
+ $seperator = ", ";
+ mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifDescr -> $ifDescr')");
+ }
+
+
+ if ( $interface['ifName'] != $ifName ) {
+ $update .= $seperator . "`ifName` = '$ifName'";
+ $seperator = ", ";
+ mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifName -> $ifName')");
+ }
+
if ( $interface['ifAlias'] != $ifAlias ) {
$update .= $seperator . "`ifAlias` = '$ifAlias'";
$seperator = ", ";
- mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'Desc -> $ifAlias')");
+ mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'ifAlias -> $ifAlias')");
}
if ( $interface['ifOperStatus'] != $ifOperStatus && $ifOperStatus != "" ) {
$update .= $seperator . "`ifOperStatus` = '$ifOperStatus'";
diff --git a/includes/rewrites.php b/includes/rewrites.php
index 6dd03e68f1..0431db3237 100644
--- a/includes/rewrites.php
+++ b/includes/rewrites.php
@@ -1,6 +1,27 @@
'C',
'unknown' => '',
diff --git a/includes/static-config.php b/includes/static-config.php
index 839a78e89e..0b2513ad21 100644
--- a/includes/static-config.php
+++ b/includes/static-config.php
@@ -3,6 +3,9 @@
## ifDescr whitelist (used instead of ifName)
$config['ifdescr']['IOS'] = true;
$config['ifdescr']['IOS XE'] = true;
+$config['ifname']['ASA'] = true;
+
+
## AFI / SAFI pairs for BGP (and other stuff, perhaps)
$config['afi']['ipv4']['unicast'] = "IPv4";
diff --git a/poll-ifstatus.php b/poll-ifstatus.php
deleted file mode 100755
index ab3530a6d6..0000000000
--- a/poll-ifstatus.php
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/php
-
diff --git a/poll-ifstatus.sh b/poll-ifstatus.sh
deleted file mode 100755
index b08aba9117..0000000000
--- a/poll-ifstatus.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-cd /opt/observer/
-./poll-ifstatus.php 1 &
-./poll-ifstatus.php 2 &
-./poll-ifstatus.php 3 &
-./poll-ifstatus.php 4 &
-./poll-ifstatus.php 5 &
-./poll-ifstatus.php 6 &
-./poll-ifstatus.php 7 &
-./poll-ifstatus.php 8 &
-./poll-ifstatus.php 9 &
-./poll-ifstatus.php 0 &
-
diff --git a/test-discovery.php b/test-discovery.php
index 968e413bd8..d59e32aa82 100755
--- a/test-discovery.php
+++ b/test-discovery.php
@@ -45,7 +45,7 @@ $devices_polled = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id ASC");
while ($device = mysql_fetch_array($device_query)) {
- echo($device['hostname'] . "(".$device['sysName'].")\n");
+ echo($device['hostname'] . "(".$device['sysName']."|".$device['device_id'].")\n");
include("includes/discovery/".$type.".php");