diff --git a/html/pages/interfaces.php b/html/pages/interfaces.php index 4ad8dd4a69..8cad1946ce 100644 --- a/html/pages/interfaces.php +++ b/html/pages/interfaces.php @@ -14,11 +14,15 @@ while($interface = mysql_fetch_array($query)) { if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $speed = humanspeed($interface['ifSpeed']); - $if_link = generateiflink($interface, makeshortif($interface['ifDescr'])); - $dev_link = generatedevicelink($interface); $type = humanmedia($interface['ifType']); - echo("$dev_link$if_link$speed$type" . $interface[ifAlias] . "\n"); + echo(" + " . generatedevicelink($interface) . " + " . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " + $speed + $type + " . $interface[ifAlias] . " + \n"); $row++; diff --git a/includes/functions.php b/includes/functions.php index 8d4e912314..cd58d6ec5e 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -327,13 +327,13 @@ function fixiftype ($type) { } function fixifName ($inf) { + if(strstr($inf, "oopback")) { $inf = "loopback"; } $inf = str_replace("ether", "Ether", $inf); $inf = str_replace("gig", "Gig", $inf); $inf = str_replace("fast", "Fast", $inf); $inf = str_replace("ten", "Ten", $inf); $inf = str_replace("vlan", "Vlan", $inf); $inf = str_replace("ether", "Ether", $inf); - $inf = str_replace("loop", "Loop", $inf); $inf = str_replace("-802.1q Vlan subif", "", $inf); $inf = str_replace("serial", "Serial", $inf); $inf = str_replace("-aal5 layer", " aal5", $inf); @@ -341,10 +341,10 @@ function fixifName ($inf) { $inf = str_replace("atm", "ATM", $inf); $inf = str_replace("port-channel", "Port-Channel", $inf); $inf = str_replace("dial", "Dial", $inf); - $inf = str_replace("hp procurve switch software Loopback interface", "Loopback Interface", $inf); + $inf = str_replace("hp procurve switch software loopback interface", "Loopback Interface", $inf); $inf = str_replace("control plane interface", "Control Plane", $inf); - $inf = preg_replace("", "Interface \\1", $inf); - $inf = preg_replace("/^([0-9]+)$/", "Interface \\1", $inf); + $inf = str_replace("loop", "Loop", $inf); + $inf = preg_replace("/^([0-9]+)$/", "Interface \\0", $inf); return $inf; } diff --git a/poll-interface.php b/poll-interface.php index 295d094808..1a00561ee1 100755 --- a/poll-interface.php +++ b/poll-interface.php @@ -14,13 +14,15 @@ while ($interface = mysql_fetch_array($interface_query)) { $snmp_cmd .= " ifDescr." . $interface['ifIndex'] . " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " "; $snmp_cmd .= "ifAlias." . $interface['ifIndex'] . " ifSpeed." . $interface['ifIndex'] . " 1.3.6.1.2.1.10.7.2.1." . $interface['ifIndex']; $snmp_cmd .= " ifType." . $interface['ifIndex'] . " ifMtu." . $interface['ifIndex'] . " ifPhysAddress." . $interface['ifIndex']; + $snmp_cmd .= " 1.3.6.1.4.1.9.2.2.1.1.1." . $interface['ifIndex']; $snmp_output = trim(`$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); echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n"); - list($ifName, $ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifSpeed, $ifDuplex, $ifType, $ifMtu, $ifPhysAddress) = explode("\n", $snmp_output); + list($ifName, $ifDescr, $ifAdminStatus, $ifOperStatus, $ifAlias, $ifSpeed, $ifDuplex, $ifType, $ifMtu, $ifPhysAddress, $ifHardType) = explode("\n", $snmp_output); $ifDescr = trim(str_replace("\"", "", $ifDescr)); if ($ifDuplex == 3) { $ifDuplex = "half"; } elseif ($ifDuplex == 2) { $ifDuplex = "full"; } else { $ifDuplex = "unknown"; } $ifDescr = strtolower($ifDescr); @@ -31,11 +33,6 @@ while ($interface = mysql_fetch_array($interface_query)) { $ifPhysAddress = strtolower(str_replace("\"", "", $ifPhysAddress)); $ifPhysAddress = str_replace(" ", ":", $ifPhysAddress); - if($device['os'] == "IOS") { - $locIfHardType_cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " 1.3.6.1.4.1.9.2.2.1.1.1." . $interface['ifIndex']; - $locIfHardType = trim(str_replace("\"", "", `$locIfHardType_cmd`)); - } - $rrdfile = "rrd/" . $device['hostname'] . "." . $interface['ifIndex'] . ".rrd"; if(!is_file($rrdfile)) { $woo = `rrdtool create $rrdfile \ @@ -103,6 +100,13 @@ while ($interface = mysql_fetch_array($interface_query)) { mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" . $interface['interface_id'] . "', NOW(), 'MAC -> $ifPhysAddress')"); } + if ( $interface['ifHardType'] != $ifHardType && $ifHardType != "" ) { + $update .= $seperator . "`ifHardType` = '$ifHardType'"; + $seperator = ", "; + mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $interface['device_id'] . "', '" .$interface['interface_id'] . "', NOW(), 'HW Type -> $ifHardType')"); + } + + if ( $interface['ifSpeed'] != $ifSpeed && $ifSpeed != "" ) { $update .= $seperator . "`ifSpeed` = '$ifSpeed'"; $seperator = ", ";