rajven преди 4 години
родител
ревизия
1705d5430d
променени са 2 файла, в които са добавени 6 реда и са изтрити 12 реда
  1. 3 6
      html/admin/devices/switchport.php
  2. 3 6
      html/admin/devices/switchstatus.php

+ 3 - 6
html/admin/devices/switchport.php

@@ -104,19 +104,16 @@ foreach ($ports as $row) {
         print "<td class=\"$cl\" >" . get_qa($row['nagios']) . "</td>\n";
         print "<td class=\"$cl\" >" . get_qa($row['nagios']) . "</td>\n";
         print "<td class=\"$cl\" >" . get_qa($row['skip']) . "</td>\n";
         print "<td class=\"$cl\" >" . get_qa($row['skip']) . "</td>\n";
         $vlan = $row['vlan'];
         $vlan = $row['vlan'];
-        $ifname= $row['ifName'];
+        $ifname= compact_port_name($row['ifName']);
         global $torrus_url;
         global $torrus_url;
         $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
         $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
         if (! isset($torrus_url) and (! isset($f_cacti_url))) {  $snmp_url=$ifname; }
         if (! isset($torrus_url) and (! isset($f_cacti_url))) {  $snmp_url=$ifname; }
                 else {
                 else {
                 if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
                 if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
                 if (isset($torrus_url)) {
                 if (isset($torrus_url)) {
-                    $normed_ifname = trim(str_replace("/", "_", $ifname));
-                    $normed_ifname = trim(str_replace(".", "_", $normed_ifname));
+                    $normed_ifname = str_replace("/", "_", $ifname);
+                    $normed_ifname = str_replace(".", "_", $normed_ifname);
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
-                    $pattern = '/cisco/i';
-                    preg_match($pattern, $switch['device_model'], $matches);
-                    if (isset($matches[0])) { $normed_ifname = trim(str_replace("Gi", "GigabitEthernet", $normed_ifname)); }
                     $t_url = str_replace("HOST_IP", $switch['ip'], $torrus_url);
                     $t_url = str_replace("HOST_IP", $switch['ip'], $torrus_url);
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
                     $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";
                     $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";

+ 3 - 6
html/admin/devices/switchstatus.php

@@ -171,19 +171,16 @@ if ($switch['snmp_version']>0) {
                 update_record($db_link, "device_ports", "id=".$row['id'], $new_port_info); 
                 update_record($db_link, "device_ports", "id=".$row['id'], $new_port_info); 
                 }
                 }
             }
             }
-
+        $ifname=compact_port_name($ifname);
         global $torrus_url;
         global $torrus_url;
         $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
         $f_cacti_url = get_cacti_graph($switch['ip'], $row['snmp_index']);
         if (! isset($torrus_url) and (! isset($f_cacti_url))) {  $snmp_url=$ifname; } 
         if (! isset($torrus_url) and (! isset($f_cacti_url))) {  $snmp_url=$ifname; } 
                 else {
                 else {
                 if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
                 if (isset($f_cacti_url)) { $snmp_url = "<a href=\"$f_cacti_url\">" . $ifname . "</a>"; }
                 if (isset($torrus_url)) {
                 if (isset($torrus_url)) {
-                    $normed_ifname = trim(str_replace("/", "_", $ifname));
-                    $normed_ifname = trim(str_replace(".", "_", $normed_ifname));
+                    $normed_ifname = str_replace("/", "_", $ifname);
+                    $normed_ifname = str_replace(".", "_", $normed_ifname);
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
                     $normed_ifname = trim(str_replace(" ", "_", $normed_ifname));
-                    $pattern = '/cisco/i';
-                    preg_match($pattern, $switch['device_model'], $matches);
-                    if (isset($matches[0])) { $normed_ifname = trim(str_replace("Gi", "GigabitEthernet", $normed_ifname)); }
                     $t_url = str_replace("HOST_IP", $switch['ip'], $torrus_url);
                     $t_url = str_replace("HOST_IP", $switch['ip'], $torrus_url);
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
                     $t_url = str_replace("IF_NAME", $normed_ifname, $t_url);
                     $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";
                     $snmp_url = "<a href=\"$t_url\">" . $ifname . "</a>";