Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Patch: Speed up search with Show=Recent

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (MAC Track)
Author Message
gthe
Cacti User


Joined: 29 Jul 2006
Posts: 94
Location: RU

PostPosted: Thu Mar 15, 2007 7:10 am    Post subject: Patch: Speed up search with Show=Recent Reply with quote

Sorry for my English.
I use mactrack:
Site: 1
Devices: 33
Data Collection Timing: 6 min.
Data Retention Duration: 2 month.
So, simple query with show=recent is very ssssslow.
My idea is to create one more table for store only Recent rows.
Step 0
Backup all!
It is my first work in php.
I did not test it on windows.
Work with mactrack-0.0.1b.

Step 1
Code:

CREATE TABLE  `cacti`.`mac_track_recent_ports` (
  `row_id` int(10) unsigned NOT NULL auto_increment,
  `site_id` int(10) unsigned NOT NULL default '0',
  `device_id` int(10) unsigned NOT NULL default '0',
  `hostname` varchar(40) NOT NULL default '',
  `description` varchar(100) NOT NULL default '',
  `vlan_id` varchar(5) NOT NULL default 'N/A',
  `vlan_name` varchar(50) NOT NULL default '',
  `mac_address` varchar(20) NOT NULL default '',
  `ip_address` varchar(20) NOT NULL default '',
  `dns_hostname` varchar(200) default '',
  `port_number` varchar(10) NOT NULL default '',
  `port_name` varchar(50) NOT NULL default '',
  `date_last` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `first_scan_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `count_rec` int(10) unsigned NOT NULL default '0',
  `active_last` int(2) unsigned NOT NULL default '0',
  PRIMARY KEY  (`row_id`),
  UNIQUE KEY `port_number` (`port_number`,`ip_address`,`mac_address`,`device_id`,`vlan_id`),
  KEY `site_id` (`site_id`),
  KEY `description` (`description`),
  KEY `mac` (`mac_address`),
  KEY `hostname` (`hostname`),
  KEY `device_id` (`device_id`),
  KEY `ip_address` (`ip_address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Database for Tracking Device Recent MAC''s';


Then add some change to mactrack_utilities.php:
LINE 35:
before:
Code:
      include_once($config['base_path'] . "/include/bottom_footer.php");
      break;
   case 'mactrack_utilities_purge_scanning_funcs':

after:
Code:
      include_once($config['base_path'] . "/include/bottom_footer.php");
      break;
case 'mactrack_utilities_rebuild_db_recent':
      include_once($config['base_path'] . "/include/top_header.php");
      include_once($config['base_path'] . "/plugins/mactrack/lib/mactrack_functions.php");

      mactrack_utilities();
      mactrack_utilities_db_recent();

      include_once($config['base_path'] . "/include/bottom_footer.php");
      break;      
   case 'mactrack_utilities_purge_scanning_funcs':


LINE 396:
before:

Code:
      </td>
   </tr>
   <tr bgcolor="#<?php print $colors["form_alternate2"];?>">
      <td class="textArea" width="150" valign="top">

after:
Code:
      </td>
   </tr>
   <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
      <td class="textArea" width="150" valign="top">
         <p><a href='mactrack_utilities.php?action=mactrack_utilities_rebuild_db_recent'>Perform Recent Database Rebuild</a></p>
      </td>
      <td class="textArea" valign="top">
         <p>Delete all record from mac_track_recent_ports and recreate.</p>
      </td>
   </tr>
   <tr bgcolor="#<?php print $colors["form_alternate2"];?>">
      <td class="textArea" width="150" valign="top">


mactrack_functions.php
END of file
before
Code:
   db_execute("REPLACE INTO mac_track_scan_dates (SELECT DISTINCT scan_date from mac_track_ports);");
   mactrack_debug("Finished deleting old records from the main database.");
}
?>

after
Code:
   db_execute("REPLACE INTO mac_track_scan_dates (SELECT DISTINCT scan_date from mac_track_ports);");
   mactrack_debug("Finished deleting old records from the main database.");
}
/*   perform_mactrack_db_recent - This utility removes all record from mac_track_recent_ports and recreate.
*/
function perform_mactrack_db_recent() {
   global $colors;
   mactrack_debug("Started recreate all records from the mac_track_recent_ports.");
   db_execute("TRUNCATE TABLE mac_track_recent_ports");
   db_execute("INSERT INTO mac_track_recent_ports
               (site_id, device_id, hostname, dns_hostname, description,
               vlan_id, vlan_name, mac_address, ip_address,
               port_number, port_name, date_last, first_scan_date, count_rec)
               SELECT site_id, device_id, hostname, dns_hostname, description,
               vlan_id, vlan_name, mac_address, ip_address,
               port_number, port_name, max(scan_date), min(scan_date), count(device_id)
               FROM mac_track_ports
          GROUP BY site_id,device_id, mac_address, port_number, ip_address, vlan_id");   
   db_execute("OPTIMIZE TABLE mac_track_recent_ports");
   mactrack_debug("Finished recreate all records from the mac_track_recent_ports.");
}
?>


Now add data to new table - see recent_util.png in attach


Step 2.
automaticly fill data after every mactrack polls.

poller_mactrack.php
LINE: 524
before
Code:
      mactrack_debug("Finished updating site table with collection statistics.");
      /* purge the ip address and temp port table */
      db_execute("TRUNCATE TABLE mac_track_temp_ports");

after
Code:
      mactrack_debug("Finished updating site table with collection statistics.");
    // update recent table 
    db_execute("UPDATE mac_track_recent_ports SET active_last=0;"); 
    db_execute("INSERT INTO mac_track_recent_ports " .
                    "(site_id, device_id, hostname, dns_hostname, description, " .
                    "vlan_id, vlan_name, mac_address, ip_address, " .
                    "port_number, port_name, date_last, first_scan_date, count_rec) " .
                    "SELECT site_id, device_id, hostname, dns_hostname, description, " .
                    "vlan_id, vlan_name, mac_address, ip_address, " .
                    "port_number, port_name, scan_date, min(scan_date), count(device_id) " .
                    "FROM mac_track_temp_ports " .
               "GROUP BY site_id, device_id, mac_address, port_number, ip_address, vlan_id " .
               "ON DUPLICATE KEY UPDATE count_rec=count_rec+1, active_last=1 ; " );
     mactrack_debug("Finished updating recent table.");   
      /* purge the ip address and temp port table */
      db_execute("TRUNCATE TABLE mac_track_temp_ports");


The new table less old - see mysql_recent.png in attach.

Step 3.
Change search with show=recent from mac_track_recent_ports + Opportunity of removal of records.
setup.php
LINE:220
before
Code:
   $nav["mactrack_view.php:"] = array("title" => "Mac Track Viewer", "mapping" => "index.php:", "url" => "mactrack_view.php", "level" => "1");
   $nav["mactrack_utilities.php:"] = array("title" => "Device Tracking Utilities", "mapping" => "index.php:", "url" => "mactrack_utilities.php", "level" => "1");

after
Code:
   $nav["mactrack_view.php:"] = array("title" => "Mac Track Viewer", "mapping" => "index.php:", "url" => "mactrack_view.php", "level" => "1");
   $nav["mactrack_view.php:actions"] = array("title" => "Actions", "mapping" => "index.php:,mactrack_view.php:", "url" => "", "level" => "2");
   $nav["mactrack_utilities.php:"] = array("title" => "Device Tracking Utilities", "mapping" => "index.php:", "url" => "mactrack_utilities.php", "level" => "1");


mactrack_view.php
LINE:24
before
Code:
define("MAX_DISPLAY_PAGES", 21);
load_current_session_value("report", "sess_mactrack_view_report", "macs");

after
Code:
define("MAX_DISPLAY_PAGES", 21);
$device_actions = array(
   1 => "Delete",
   );
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
switch ($_REQUEST["action"]) {
   case 'actions':
      form_actions();
      exit;
}
load_current_session_value("report", "sess_mactrack_view_report", "macs");


LINE:57
before
Code:
         $title = "Device Tracking - MAC to IP Report View";
         include_once($config['base_path'] . "/plugins/mactrack/include/top_mactrack_header.php");
         mactrack_view_macs();
         include($config['base_path'] . "/include/bottom_footer.php");

after
Code:
         $title = "Device Tracking - MAC to IP Report View";
         include_once($config['base_path'] . "/plugins/mactrack/include/top_mactrack_header.php");
      if ($_REQUEST["m_rowstoshow"] == 2) {
        mactrack_view_recent_macs();
      }else {
        mactrack_view_macs();
      }         
         include($config['base_path'] . "/include/bottom_footer.php");


LINE:462
before
Code:
      if (($apply_limits) && ($row_limit != 999999)) {
         $query_string .= " LIMIT " . ($row_limit*($_REQUEST["m_page"]-1)) . "," . $row_limit;
      }
   }else{

after
Code:
      if (($apply_limits) && ($row_limit != 999999)) {
         $query_string .= " LIMIT " . ($row_limit*($_REQUEST["m_page"]-1)) . "," . $row_limit;
      }
   }elseif($_REQUEST["m_rowstoshow"] == 2){
        $query_string = "SELECT
            row_id, site_name, description, hostname, mac_address, ip_address, dns_hostname, port_number,
            port_name, vlan_id, vlan_name, date_last as max_scan_date, count_rec, active_last
            FROM mac_track_recent_ports
            LEFT JOIN mac_track_sites ON (mac_track_recent_ports.site_id = mac_track_sites.site_id) " .
            str_replace("mac_track_ports", "mac_track_recent_ports", $sql_where) .
            " ORDER BY mac_track_recent_ports.hostname,  mac_track_recent_ports.ip_address, mac_track_recent_ports.count_rec desc, mac_track_recent_ports.port_number";
      if (($apply_limits) && ($row_limit != 999999)) {
         $query_string .= " LIMIT " . ($row_limit*($_REQUEST["m_page"]-1)) . "," . $row_limit;
      }
   }else{


END
before
Code:
   }
   html_end_box(false);
}

?>

after:
Code:


function form_actions() {
   global $colors, $config, $device_actions, $fields_mactrack_device_edit;

   /* if we are to save this form, instead of display it */
   if (isset($_POST["selected_items"])) {
      $selected_items = unserialize(stripslashes($_POST["selected_items"]));

      if ($_POST["drp_action"] == "1") { /* Delete Selected Rows */
         for ($i=0;($i<count($selected_items));$i++) {
            /* ================= input validation ================= */
            input_validate_input_number($selected_items[$i]);
            /* ==================================================== */

            api_mactrack_recent_remove($selected_items[$i]);
         }
                  include_once($config['base_path'] . "/plugins/mactrack/include/top_mactrack_header.php");
         mactrack_view_recent_macs();
      }
      exit;
   }

   /* setup some variables */
   $row_list = ""; $i = 0;

   /* loop through each of the host templates selected on the previous page and get more info about them */
   while (list($var,$val) = each($_POST)) {
      if (ereg("^chk_([0-9]+)$", $var, $matches)) {
         /* ================= input validation ================= */
         input_validate_input_number($matches[1]);
         /* ==================================================== */

            $row_info = db_fetch_row("SELECT description, ip_address, mac_address, date_last FROM mac_track_recent_ports WHERE row_id=" . $matches[1]);
            $row_list .= "<li>" . $row_info["description"] . " (IP:" . $row_info["ip_address"] . "   Mac:" . $row_info["mac_address"] . "   date:" . $row_info["date_last"] . ")<br>";
            $row_array[$i] = $matches[1];
        }

        $i++;
    }

    include_once($config['base_path'] . "/plugins/mactrack/include/top_mactrack_header.php");
    html_start_box("<strong>" . $device_actions{$_POST["drp_action"]} . "</strong>", "60%", $colors["header_panel"], "3", "center", "");
    print "<form action='mactrack_view.php' method='post'>\n";
    if ($_POST["drp_action"] == "1") {  /* delete */
        print "    <tr>
                <td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
                    <p>Are you sure you want to delete the following rows?</p>
                    <p>$row_list</p>
                </td>
            </tr>\n
            ";
    }

    if (!isset($row_array)) {
        print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one device.</span></td></tr>\n";
        $save_html = "";
    }else{
        $save_html = "<input type='image' src='" . $config['url_path'] . "images/button_yes.gif' alt='Save' align='absmiddle'>";
    }

    print "    <tr>
            <td colspan='2' align='right' bgcolor='#eaeaea'>
                <input type='hidden' name='action' value='actions'>
                <input type='hidden' name='selected_items' value='" . (isset($row_array) ? serialize($row_array) : '') . "'>
                <input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>
                <a href='mactrack_view.php'><img src='" . $config['url_path'] . "images/button_no.gif' alt='Cancel' align='absmiddle' border='0'></a>
                $save_html
            </td>
        </tr>
        ";

    html_end_box();

}

function api_mactrack_recent_remove($row_id){
    db_execute("DELETE FROM mac_track_recent_ports WHERE row_id=" . $row_id);
}

function mactrack_view_recent_macs() {
   global $title, $report, $colors, $mactrack_search_types, $rows_selector, $device_actions, $config;
   /* ================= input validation ================= */
   input_validate_input_number(get_request_var_request("m_site_id"));
   input_validate_input_number(get_request_var_request("m_device_id"));
   input_validate_input_number(get_request_var_request("m_mac_filter_type_id"));
   input_validate_input_number(get_request_var_request("m_ip_filter_type_id"));
   input_validate_input_number(get_request_var_request("m_rows_selector"));
   input_validate_input_number(get_request_var_request("page"));
   /* ==================================================== */

   /* clean up report string */
   if (isset($_REQUEST["report"])) {
      $_REQUEST["report"] = sanitize_search_string(get_request_var("report"));
   }

   /* clean up filter string */
   if (isset($_REQUEST["m_filter"])) {
      $_REQUEST["m_filter"] = sanitize_search_string(get_request_var("m_filter"));
   }

   /* clean up search string */
   if (isset($_REQUEST["m_mac_filter"])) {
      $_REQUEST["m_mac_filter"] = sanitize_search_string(get_request_var("m_mac_filter"));
   }

   if (isset($_REQUEST["m_mac_filter_type_id"])) {
      if ($_REQUEST["m_mac_filter_type_id"] == 1) {
         unset($_REQUEST["m_mac_filter"]);
      }
   }

   /* clean up search string */
   if (isset($_REQUEST["m_rowstoshow"])) {
      $_REQUEST["m_rowstoshow"] = sanitize_search_string(get_request_var("m_rowstoshow"));
   }

   /* clean up search string */
   if (isset($_REQUEST["m_ip_filter"])) {
      $_REQUEST["m_ip_filter"] = sanitize_search_string(get_request_var("m_ip_filter"));
   }

   if (isset($_REQUEST["m_ip_filter_type_id"])) {
      if ($_REQUEST["m_ip_filter_type_id"] == 1) {
         unset($_REQUEST["m_ip_filter"]);
      }
   }

   /* if the user pushed the 'clear' button */
   if (isset($_REQUEST["clear_macs_x"])) {
      kill_session_var("sess_mactrack_view_macs_current_page");
      kill_session_var("sess_mactrack_view_macs_rowstoshow");
      kill_session_var("sess_mactrack_view_macs_filter");
      kill_session_var("sess_mactrack_view_macs_mac_filter_type_id");
      kill_session_var("sess_mactrack_view_macs_mac_filter");
      kill_session_var("sess_mactrack_view_macs_ip_filter_type_id");
      kill_session_var("sess_mactrack_view_macs_ip_filter");
      kill_session_var("sess_mactrack_view_macs_rows_selector");
      kill_session_var("sess_mactrack_view_macs_site_id");
      kill_session_var("sess_mactrack_view_macs_device_id");

      $_REQUEST["page"] = 1;
      unset($_REQUEST["m_rowstoshow"]);
      unset($_REQUEST["m_filter"]);
      unset($_REQUEST["m_mac_filter_type_id"]);
      unset($_REQUEST["m_mac_filter"]);
      unset($_REQUEST["m_ip_filter_type_id"]);
      unset($_REQUEST["m_rows_selector"]);
      unset($_REQUEST["m_ip_filter"]);
      unset($_REQUEST["m_site_id"]);
      unset($_REQUEST["m_device_id"]);
   }else{
      /* if any of the settings changed, reset the page number */
      $changed = 0;
      $changed += mactrack_check_changed("m_rowstoshow", "sess_mactrack_view_mac_rowstoshow");
      $changed += mactrack_check_changed("m_filter", "sess_mactrack_view_mac_filter");
      $changed += mactrack_check_changed("m_mac_filter_type_id", "sess_mactrack_view_mac_mac_filter_type_id");
      $changed += mactrack_check_changed("m_mac_filter", "sess_mactrack_view_mac_mac_filter");
      $changed += mactrack_check_changed("m_ip_filter_type_id", "sess_mactrack_view_mac_ip_filter_type_id");
      $changed += mactrack_check_changed("m_ip_filter", "sess_mactrack_view_mac_ip_filter");
      $changed += mactrack_check_changed("m_rows_selector", "sess_mactrack_view_mac_rows_selector");
      $changed += mactrack_check_changed("m_site_id", "sess_mactrack_view_mac_site_id");
      $changed += mactrack_check_changed("m_device_id", "sess_mactrack_view_mac_device_id");
      if ($changed) {
         $_REQUEST["page"] = "1";
         $_REQUEST["m_page"] = $_REQUEST["page"];
      }else{
         if (isset($_REQUEST["page"])) {
            $_REQUEST["m_page"] = $_REQUEST["page"];
         }
      }
   }

   /* reset some things if the user has made changes */
   if ((!empty($_REQUEST["m_site_id"]))&&(!empty($_SESSION["sess_mactrack_view_macs_site_id"]))) {
      if ($_REQUEST["m_site_id"] <> $_SESSION["sess_mactrack_view_macs_site_id"]) {
         $_REQUEST["m_device_id"] = "-1";
      }
   }
   /* remember these search fields in session vars so we don't have to keep passing them around */
   load_current_session_value("report", "sess_mactrack_view_report", "macs");
   load_current_session_value("page", "sess_mactrack_view_macs_current_page", "1");
   load_current_session_value("m_page", "sess_mactrack_view_macs_current_page", "1");
   load_current_session_value("m_rowstoshow", "sess_mactrack_view_macs_rowstoshow", "2");
   load_current_session_value("m_filter", "sess_mactrack_view_macs_filter", "");
   load_current_session_value("m_mac_filter_type_id", "sess_mactrack_view_macs_mac_filter_type_id", "1");
   load_current_session_value("m_mac_filter", "sess_mactrack_view_macs_mac_filter", "");
   load_current_session_value("m_ip_filter_type_id", "sess_mactrack_view_macs_ip_filter_type_id", "1");
   load_current_session_value("m_ip_filter", "sess_mactrack_view_macs_ip_filter", "");
   load_current_session_value("m_rows_selector", "sess_mactrack_view_macs_rows_selector", "-1");
   load_current_session_value("m_site_id", "sess_mactrack_view_macs_site_id", "-1");
   load_current_session_value("m_device_id", "sess_mactrack_view_macs_device_id", "-1");

   /* set m_page variable */
   $_REQUEST["m_page"] = $_REQUEST["page"];

   mactrack_view_header();
   include($config['base_path'] . "/plugins/mactrack/html/inc_mactrack_view_mac_filter_table.php");
   mactrack_view_footer();


   $sql_where = "";

   if ($_REQUEST["m_rows_selector"] == -1) {
      $row_limit = read_config_option("num_rows_mactrack");
   }elseif ($_REQUEST["m_rows_selector"] == -2) {
      $row_limit = 999999;
   }else{
      $row_limit = $_REQUEST["m_rows_selector"];
   }
   $port_results = mactrack_view_get_mac_records($sql_where, TRUE, $row_limit);
   $sql_where = str_replace("mac_track_ports", "mac_track_recent_ports", $sql_where);
   html_start_box("", "98%", $colors["header"], "3", "center", "");
      $rows_query_string = "SELECT
         COUNT(DISTINCT device_id, mac_address, port_number, ip_address)
         FROM mac_track_recent_ports
         $sql_where";

      if (strlen($sql_where) == 0) {
         $total_rows = 0;
      }else{
         $total_rows = db_fetch_cell($rows_query_string);
      }
   
   /* generate page list */
   $url_page_select = get_page_list($_REQUEST["m_page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "mactrack_view.php?m_device_id=" . $_REQUEST["m_device_id"] . "&m_ip_filter_type_id=" . $_REQUEST["m_ip_filter_type_id"] . "&m_ip_filter=" . $_REQUEST["m_ip_filter"] . "&m_mac_filter_type_id=" . $_REQUEST["m_mac_filter_type_id"] . "&m_mac_filter=" . $_REQUEST["m_mac_filter"] . "&m_site_id=" . $_REQUEST["m_site_id"]);
   $nav = "<tr bgcolor='#" . $colors["header"] . "'>
            <td colspan='11'>
               <table width='100%' cellspacing='0' cellpadding='0' border='0'>
                  <tr>
                     <td align='left' class='textHeaderDark'>
                        <strong>&lt;&lt; "; if ($_REQUEST["m_page"] > 1) { $nav .= "<a class='linkOverDark' href='mactrack_view.php?m_device_id=" . $_REQUEST["m_device_id"] . "&m_ip_filter_type_id=" . $_REQUEST["m_ip_filter_type_id"] . "&m_ip_filter=" . $_REQUEST["m_ip_filter"] . "&m_mac_filter_type_id=" . $_REQUEST["m_mac_filter_type_id"] . "&m_mac_filter=" . $_REQUEST["m_mac_filter"] . "&m_site_id=" . $_REQUEST["m_site_id"] . "&page=" . ($_REQUEST["m_page"]-1) . "'>"; } $nav .= "Previous"; if ($_REQUEST["m_page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
                     </td>\n
                     <td align='center' class='textHeaderDark'>
                        Showing Rows " . (($row_limit*($_REQUEST["m_page"]-1))+1) . " to " . ((($total_rows < $row_limit) || ($total_rows < ($row_limit*$_REQUEST["m_page"]))) ? $total_rows : ($row_limit*$_REQUEST["m_page"])) . " of $total_rows [$url_page_select]
                     </td>\n
                     <td align='right' class='textHeaderDark'>
                        <strong>"; if (($_REQUEST["m_page"] * $row_limit) < $total_rows) { $nav .= "<a class='linkOverDark' href='mactrack_view.php?m_device_id=" . $_REQUEST["m_device_id"] . "&m_ip_filter_type_id=" . $_REQUEST["m_ip_filter_type_id"] . "&m_ip_filter=" . $_REQUEST["m_ip_filter"] . "&m_mac_filter_type_id=" . $_REQUEST["m_mac_filter_type_id"] . "&m_mac_filter=" . $_REQUEST["m_mac_filter"] . "&m_site_id=" . $_REQUEST["m_site_id"] . "&page=" . ($_REQUEST["m_page"]+1) . "'>"; } $nav .= "Next"; if (($_REQUEST["m_page"] * $row_limit) < $total_rows) { $nav .= "</a>"; } $nav .= " &gt;&gt;</strong>
                     </td>\n
                  </tr>
               </table>
            </td>
         </tr>\n";

   print $nav;

   if (strlen(read_config_option("mt_reverse_dns")) > 0) {
      html_header(array("Network<br>Device", "Network<br>Hostname", "End Device<br>IP Address", "End Device<br>DNS Hostname", "End Device<br>MAC Address", "Port<br>Number", "Port<br>Name", "VLAN<br>ID", "VLAN<br>Name", "Last<br>Scan Date", "Count<br>record"));
   }else{
    html_header_checkbox(array("Network<br>Device", "Network<br>Hostname", "End Device<br>IP Address", "End Device<br>MAC Address", "Port<br>Number", "Port<br>Name", "VLAN<br>ID", "VLAN<br>Name", "Last<br>Scan Date", "Count<br>record"));
   }
    $i = 0;
    if (sizeof($port_results) > 0) {
        foreach ($port_results as $port_result) {
            $scan_date = $port_result["max_scan_date"];

  if ($port_result["active_last"] == 1)  {
    $color_line_date="<span style='font-weight: bold;'>";
  }else{
    $color_line_date="";
  }
 
            form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
            ?>
            <td><?php print $port_result["description"];?></td>
            <td><?php print $port_result["hostname"];?></td>
            <td><?php print eregi_replace("(" . preg_quote($_REQUEST["m_ip_filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $port_result["ip_address"]);?></td>
            <?php
            if (strlen(read_config_option("mt_reverse_dns")) > 0) {?>
            <td><?php print eregi_replace("(" . preg_quote($_REQUEST["m_filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $port_result["dns_hostname"]);?></td>
            <?php }?>
            <td><?php print eregi_replace("(" . preg_quote($_REQUEST["m_mac_filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $port_result["mac_address"]);?></td>
            <td><?php print $port_result["port_number"];?></td>
            <td><?php print eregi_replace("(" . preg_quote($_REQUEST["m_filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $port_result["port_name"]);?></td>
            <td><?php print $port_result["vlan_id"];?></td>
            <td><?php print eregi_replace("(" . preg_quote($_REQUEST["m_filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $port_result["vlan_name"]);?></td>
            <td><?php print $color_line_date . " " . $scan_date;?></td>
            <td><?php print $port_result["count_rec"];?></td>
            <td style="<?php print get_checkbox_style();?>" width="1%" align="right">
                    <input type='checkbox' style='margin: 0px;' name='chk_<?php print $port_result["row_id"];?>' title="<?php print $port_result["description"];?>">
            </td>
            </tr>
            <?php
        }
        /* put the nav bar on the bottom as well */
        print $nav;
    }else{
        print "<tr><td><em>No Mac Track Port Results</em></td></tr>";
    }

    html_end_box(false);
    /* draw the dropdown containing a list of available actions for this form */
    draw_actions_dropdown($device_actions);
   
}

?>
                                     


Time of performance of inquiries has increased in tens times

Rezult - see recent_view.png



recent_view.png
 Description:
 Filesize:  79.86 KB
 Viewed:  814 Time(s)

recent_view.png



mysql_recent.png
 Description:
 Filesize:  8.84 KB
 Viewed:  814 Time(s)

mysql_recent.png



recent_util.png
 Description:
 Filesize:  53.74 KB
 Viewed:  814 Time(s)

recent_util.png


Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (MAC Track) All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group