Location: PHPKode > projects > Monolith - MySQL DBA Console > monolith-1.4-release/monitor.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', false);
ini_set('html_errors', true);

session_start();

$host_id = $_GET['host_id'];
$edit = $_GET['edit'];
$host_add = $_GET['host_add'];

$clientSub = $_POST['clientSub'];
$hostnameSub = $_POST['hostnameSub'];
$ip_addressSub = $_POST['ip_addressSub'];
$usernameSub = $_POST['usernameSub'];
$passwordSub = $_POST['passwordSub'];
$portSub = $_POST['portSub'];
$emailSub = $_POST['emailSub'];
$activeSub = $_POST['activeSub'];
$host_idSub = $_POST['host_idSub'];
$host_edit_submit = $_POST['host_edit_submit'];
$host_add_submit = $_POST['host_add_submit'];
$range = $_POST['range'];
$host_range_id = $_POST['host_range_id'];
$ram_bytes=$_POST['ram_bytes'];

require('inc/functions.php');

function links_menu() {
        $content = '
                <a href="index.php?manage=status" target="_self">Status</a> |
                <a href="index.php?manage=db" target="_self">Manage Databases</a> | 
                <a href="index.php?manage=system" target="_self">Manage System</a> |
                <a href="index.php?manage=cron" target="_self">Cron Table</a> |
                <a href="monitor.php" target="_self">Monitor</a> |
                <a href="index.php?manage=about" target="_self">About</a> |
                <a href="index.php?manage=logout" target="_self">Logout</a>
        ';
	tabler("menubox","","left","",$content);
}

function host_add_submit($clientSub,$hostnameSub,$ip_addressSub,$usernameSub,$passwordSub,$portSub,$emailSub,$activeSub,$ram_bytes) {
  if($_SESSION['user_level']=='1') {
    $sql="INSERT INTO `monitor`.`hosts` (
`id` ,
`client` ,
`hostname` ,
`ip_address` ,
`username` ,
`pass` ,
`port` ,
`email` ,
`ram_bytes`,
`active`
)
VALUES (
NULL , '$clientSub', '$hostnameSub', '$ip_addressSub', '$usernameSub', '$passwordSub', '$portSub', '$emailSub', '$ram_bytes', '$activeSub'
);";
    print "<fieldset class=\"legendBox\"><legend>Submitting Addition of $hostnameSub</legend></fieldset>";
    print '<meta http-equiv="refresh" content="2;url=monitor.php">';
    monitor_sql_insert($sql);
  }
}

function host_add() {
  if($_SESSION['user_level']=='1') {
    print "<fieldset class=\"legendBox\"><legend>Adding new host</legend>
           <table class=\"standardbox\"><form action=\"monitor.php\" method=\"POST\">
           <tr>";
    print '<td>Client</td><td><input type="text" name="clientSub" value="client name"></td></tr>
<tr><td>Hostname</td><td><input type="text" name="hostnameSub" value="hostname"></td></tr>
<tr><td>IP Address</td><td><input type="text" name="ip_addressSub" value="ip address"></td></tr>
<tr><td>Username</td><td><input type="text" name="usernameSub" value="username"></td></tr>
<tr><td>Password</td><td><input type="text" name="passwordSub" value="password"></td></tr>
<tr><td>Port</td><td><input type="text" name="portSub" value="3306"></td></tr>
<tr><td>Email</td><td><input type="text" name="emailSub" value="email"></td></tr>
<tr><td>RAM (bytes)</td><td><input type="text" name="ram_bytes" value="RAM (bytes)"></td></tr> 
<tr><td>Active</td><td><select name="activeSub">';
      print '<option SELECTED value="0">Active</option>
      <option  value="1">Inactive</option>';
    print '</select></td></tr>
<input type="hidden" name="host_add_submit" value="0">
<tr><td>&nbsp;</td><td><input type="submit" name="Submit"></td><tr>
<tr><td colspan="2"><em>NOTE: connecting user requires SELECT,PROCESS privileges on destination server.</em></td></tr>
<tr><td colspan="2"><em>ie: mysql> GRANT SELECT,PROCESS on *.* to \'username\'@\'hostname\' identified by \'password\';</em></td></tr>
           </table></fieldset>';
  }
}

function host_edit_submit($host_idSub,$clientSub,$hostnameSub,$ip_addressSub,$usernameSub,$passwordSub,$portSub,$emailSub,$activeSub,$ram_bytes) {
  if($_SESSION['user_level']=='1') {
    $sql="UPDATE `monitor`.`hosts` SET `client` = '$clientSub',
`hostname` = '$hostnameSub',
`ip_address` = '$ip_addressSub',
`username` = '$usernameSub',
`pass` = '$passwordSub',
`port` = '$portSub',
`email` = '$emailSub',
`ram_bytes` = '$ram_bytes',
`active` = '$activeSub' WHERE `hosts`.`id` = '$host_idSub' LIMIT 1 ;";
  print "<fieldset class=\"legendBox\"><legend>Submitting changes to $hostnameSub</legend></fieldset>";
  print '<meta http-equiv="refresh" content="2;url=monitor.php?host_id='.$host_idSub.'">';
  monitor_sql_insert($sql);
  }
}

function host_edit($host_id) {
  if($_SESSION['user_level']=='1') {
    $sql = "select * from hosts where id='$host_id'";
    $rowstack = (monitor_sql_exec("$sql"));
    $count = count($rowstack);
    for ($i = 0; $i < $count; $i++) {
      $row = ($rowstack[$i]);
      $id = $row['id'];
      $client = $row['client'];
      $ip_address = $row['ip_address'];
      $hostname = $row['hostname'];
      $username = $row['username'];
      $password = $row['pass'];
      $port = $row['port'];
      $email = $row['email'];
      $ram_bytes = $row['ram_bytes'];
      $active = $row['active'];
      
      print "<fieldset class=\"legendBox\"><legend>Edit Settings for $hostname</legend>
           <table class=\"standardbox\"><form action=\"monitor.php\" method=\"POST\">
           <tr>";
      print '<td>Client</td><td><input type="text" name="clientSub" value="'.$client.'"></td></tr>
<tr><td>Hostname</td><td><input type="text" name="hostnameSub" value="'.$hostname.'"></td></tr>
<tr><td>IP Address</td><td><input type="text" name="ip_addressSub" value="'.$ip_address.'"></td></tr>
<tr><td>Username</td><td><input type="text" name="usernameSub" value="'.$username.'"></td></tr>
<tr><td>Password</td><td><input type="text" name="passwordSub" value="'.$password.'"></td></tr>
<tr><td>Port</td><td><input type="text" name="portSub" value="'.$port.'"></td></tr>
<tr><td>Email</td><td><input type="text" name="emailSub" value="'.$email.'"></td></tr>
<tr><td>RAM (bytes)</td><td><input type="text" name="ram_bytes" value="'.$ram_bytes.'"></td></tr>
<tr><td>Active</td><td><select name="activeSub">';

      if($active == '0') {
	print '<option SELECTED value="0">Active</option>
      <option  value="1">Inactive</option>';
      }
      else {
	print '<option SELECTED value="1">Inactive</option>                                                                                
      <option  value="0">Active</option>';
      }
      print '</select></td></tr>
<input type="hidden" name="host_edit_submit" value="0">
<input type="hidden" name="host_idSub" value="'.$host_id.'">  
<tr><td>&nbsp;</td><td><input type="submit" name="Submit Changes"></td><tr>
           </table></fieldset>';
    }
  }
}

function divSections($host_id,$range,$host_range_id) {
  if(isset($host_range_id)) { $host_id=$host_range_id;}
  if(!isset($host_id)) { 
    $sql = "select id from hosts order by id limit 1";
    $rowstack = (monitor_sql_exec("$sql"));
    $count = count($rowstack);
    for ($i = 0; $i < $count; $i++) {
      $row = ($rowstack[$i]);
      $host_id = $row['id'];
    }
  }
  
  print '
<div class="monitorContainer" style="width: 96%; height: 2000px; overflow: hidden;  margin-left: auto; margin-right: auto;">
<div class="monitorBlank" style="width: 50%; height: 35px; overflow: auto; float: left; background:;"></div>
<div class="monitorTab" style="width: 50%; height: 35px; overflow: auto; float: right; background:;">
<table align="right">
<tr>
  <td>';
  if($_SESSION['user_level']=='1'){
    print '<a href="monitor.php?host_add=0">Add Host</a> | 
<a href="monitor.php?host_id='.$host_id.'&edit=0">Edit Host</a> | ';
  }

print '<a href="api-monitor.php">XML Generator</a> | <a href="monitor-total.php">Data Table</a> |
<a href="monitor-talkback.php">Talkback Report</a>
  </td>
</tr>
</table></div>
   <div class="monitorList" style="width: 15%; height: 100%; overflow: auto; float: left; background:;"><table>';    

//select clients for list generation

  $sql = "select distinct(client) from hosts order by client";
  $rowstack = (monitor_sql_exec("$sql"));
  $count = count($rowstack);
  for ($i = 0; $i < $count; $i++) {
    $row = ($rowstack[$i]);
    $client = $row['client'];
    print "<tr><td><em>$client ";

    $sql44 = "select count(id) from hosts where client='$client'";
    $rowstack44 = (monitor_sql_exec("$sql44"));
    $count44 = count($rowstack44);
    for ($r = 0; $r < $count44; $r++) {
      $row44 = ($rowstack44[$r]);
      $dbc = $row44['count(id)'];
      print "[$dbc]</em></td></tr>";
    }

    $sql45 = "select id,client,hostname from hosts where client='$client' order by client,hostname";
    $rowstack45 = (monitor_sql_exec("$sql45"));
    $count45 = count($rowstack45);
    for ($y = 0; $y < $count45; $y++) {
      $row45 = ($rowstack45[$y]);
      $id = $row45['id'];
      $client = $row45['client'];
      $hostname = $row45['hostname'];
      
      print "<tr><td>";
      if($active == 1) { print "<img src=\"images/redarrow.png\">";}
      else { print "<img src=\"images/greenarrow.png\">";}
      print "<a href=\"monitor.php?host_id=$id\">";
      print "&nbsp;$hostname</a></td></tr>";
    }
  }
 print "</table>";

print '</div>
   <div class="monitorAlerts" style="width: 85%; height: 100%; float: left;">
<fieldset>
     <div class="monitorHost" style="width: 50%; height: 180px; float: left; background: #CDCDCD;"><table>
<tr><td><h2>Host Information</h2></td></tr>';

//select host information
 $sql = "select * from hosts where id=$host_id";
 $rowstack = (monitor_sql_exec("$sql"));
 $count = count($rowstack);
 for ($i = 0; $i < $count; $i++) {
   $row = ($rowstack[$i]);
   $id = $row['id'];
   $client = $row['client'];
   $hostname = $row['hostname'];
   $ip_address = $row['ip_address'];
   $active = $row['active'];
   $ram_bytesHR = sizeformat($row['ram_bytes']);

   print "<tr><td>Client name:</td><td>$client</td></tr>";
   print "<tr><td>Host Name:</td><td>$hostname</td></tr>";
   print "<tr><td>IP Address:</td><td>$ip_address</td></tr>";
   if($active == 1) { print "<tr><td>Status:</td><td><img src=\"images/redarrow.png\"> Not Active</td></tr>";}
   else { print "<tr><td>Status:</td><td><img src=\"images/greenarrow.png\"> Active</td></tr>";}

 }

 $sql = "select * from messages_map where host_id='$host_id' order by Creation_time desc limit 1";
 $rowstack = (monitor_sql_exec("$sql"));
 $count = count($rowstack);
 for ($i = 0; $i < $count; $i++) {
   $row = ($rowstack[$i]);
   $id = $row['id'];
   $host_id = $row['host_id'];
   $reporting_variables_id = $row['reporting_variables_id'];
   $Creation_time = $row['Creation_time'];

   $sql3 = "select * from reports where reporting_variables_id ='$reporting_variables_id'";
   $rowstack3 = (monitor_sql_exec("$sql3"));
   $count3 = count($rowstack3);
   for ($g = 0; $g < $count3; $g++) {
     $row3 = ($rowstack3[$g]);
     $link = $row3['link'];
     $crlink = $row3['crfile_link'];
     print "<tr><td>Report:</td><td><a href=\"monitor/$link\"><img src=\"images/info.gif\"></a></td></tr>";
     print "<tr><td>CR File:</td><td><a href=\"monitor/$crlink\"><img src=\"images/info.gif\"></a></td></tr>";
   }
   $sql2 = "select Query_rate from query_rate where reporting_variables_id ='$reporting_variables_id'";
   $rowstack2 = (monitor_sql_exec("$sql2"));
   $count2 = count($rowstack2);
   for ($h = 0; $h < $count2; $h++) {
     $row2 = ($rowstack2[$h]);
     $Query_rate = $row2['Query_rate'];
   }
 }

 print "</table>";
 print '</div>                           
 
    <div class="monitorStats" style="width: 50%; height: 180px; float: left; background: #BDBDBD;">
       <font color="white"><table><tr><td><h2>Server Statistics</h2></td></tr>';

 //select stats information                                                                                        
 $sql = "select * from reporting_variables where host_id=$host_id order by Creation_time desc limit 1";
 $rowstack = (monitor_sql_exec("$sql"));
 $count = count($rowstack);
 for ($i = 0; $i < $count; $i++) {
   $row = ($rowstack[$i]);
   $reporting_variables_id = $row['id'];
   $storage_engine = $row['storage_engine'];
   $version = $row['version'];

   print "<tr><td>Storage Engine:</td><td>$storage_engine</td></tr>";
   print "<tr><td>MySQL Version:</td><td>$version</td></tr>";

   $Dbnum = $row['Dbnum'];
   $Data_length = sizeFormat($row['Data_length']);
   $Index_length = sizeFormat($row['Index_length']);
   $Db_size = sizeFormat($row['Db_size']);
   $Connections = $row['Connections'];

   print "<tr><td>Query|Connections:</td><td>$Query_rate Q/sec | $Connections Conn</td></tr>";
   print "<tr><td>System RAM:</td><td>$ram_bytesHR</td></tr>";
   print "<tr><td>Total Schemas:</td><td>$Dbnum</td></tr>";
   print "<tr><td>Data|Index Size:</td><td>$Data_length | $Index_length</td></tr>";
   print "<tr><td>Total Size:</td><td>$Db_size</td></tr>";
   print "<tr><td>Last Polled:</td><td>$Creation_time</td></tr>";

 }
 print '</table></font>
     </div>
    <div class="clear" style="height: 1px; clear: both;"></div>';
 
 get_audit_stats($host_id,$range);
 print '</div>

   <div id="footer" style="width: 100%, height: 50px; background: white; float: left;"></div>
   <hr>
   <div class="clear" style="height: 1px; clear: both;"></div>
 </fieldset>
</div>';

    print '</td></tr></table>
                </div>

             </div>
           </div>';
}

function get_audit_stats($host_id,$range) {  
  if(!isset($range)) { $range='30'; }
  print '<table class="alertnosort" id="1" width="100%"><tr><td width="30%"><h2>Alerts</h2></td><td width="50%"><h2>Talkback Report</h2></td>';
  print '<td align="right"><form action="monitor.php" method="POST"><input type="hidden" name="host_range_id" value="'.$host_id.'"><input type="text" name="range" value="'.$range.'" size="3"><input type="submit" name="submit" value="Graph Days"></td></tr>';
  print '</tr>';
  
  $Dbtotal = '0';
  $Db_size_total = '0';
  $sql = "select * from messages_map where host_id='$host_id' order by Creation_time desc limit 1";
  $rowstack = (monitor_sql_exec("$sql"));
  $count = count($rowstack);
  for ($i = 0; $i < $count; $i++) {
    $row = ($rowstack[$i]);
    $id = $row['id'];
    $host_id = $row['host_id'];
    $reporting_variables_id = $row['reporting_variables_id'];
    $slow_queries_map = $row['slow_queries_map'];
    $long_queries_map = $row['long_queries_map'];
    $used_connections_map = $row['used_connections_map'];
    $thread_status_map = $row['thread_status_map'];
    $key_buffers_map = $row['key_buffers_map'];
    $query_cache_map = $row['query_cache_map'];
    $sort_merge_map = $row['sort_merge_map'];
    $join_map = $row['join_map'];
    $tmp_tables_map = $row['tmp_tables_map'];
    $open_files_map = $row['open_files_map'];
    $table_cache_map = $row['table_cache_map'];
    $table_locking_map = $row['table_locking_map'];
    $table_scans_map = $row['table_scans_map'];
    $innodb_map = $row['innodb_map'];
    $memory_usage_map = $row['memory_usage_map'];
    $Creation_time = $row['Creation_time'];
    
    $sql1 = "select active,client,ip_address,hostname from hosts where id='$host_id'";
    $rowstack1 = (monitor_sql_exec("$sql1"));
    $count1 = count($rowstack1);
    for ($j = 0; $j < $count1; $j++) {
      $row1 = ($rowstack1[$j]);
      $client = $row1['client'];
      $ip_address = $row1['ip_address'];
      $hostname = $row1['hostname'];
      $active = $row1['active'];
    }
    
    $sql2 = "select Query_rate from query_rate where reporting_variables_id ='$reporting_variables_id'";
    $rowstack2 = (monitor_sql_exec("$sql2"));
    $count2 = count($rowstack2);
    for ($h = 0; $h < $count2; $h++) {
      $row2 = ($rowstack2[$h]);
      $Query_rate = $row2['Query_rate'];
    }
    
    $sql3 = "select * from reports where reporting_variables_id ='$reporting_variables_id'";
    $rowstack3 = (monitor_sql_exec("$sql3"));
    $count3 = count($rowstack3);
    for ($g = 0; $g < $count3; $g++) {
      $row3 = ($rowstack3[$g]);
      $link = $row3['link'];
      $crlink = $row3['crfile_link'];
    }

    $sql4 = "select Dbnum,Data_length,Index_length,Db_size from reporting_variables where id ='$reporting_variables_id'";
    $rowstack4 = (monitor_sql_exec("$sql4"));
    $count4 = count($rowstack4);
    for ($r = 0; $r < $count4; $r++) {
      $row4 = ($rowstack4[$r]);
      $Dbnum = $row4['Dbnum'];
      $Data_length = sizeFormat($row4['Data_length']);
      $Index_length = sizeFormat($row4['Index_length']);      
      $Db_size = sizeFormat($row4['Db_size']);
      $Db_size_total += ($row4['Db_size']);
      $Dbtotal += $Dbnum;
    }

    $sql5 = "select t1.id,t1.host_id,t1.process_status_id,t1.file_size,t1.file_name,t1.exec_time,t1.exec_compress,t1.Creation_time,t2.description from hosts_incoming_backup_state as t1, process_status as t2 where t1.host_id='$host_id' and t1.process_status_id = t2.id order by Creation_time desc limit 1";
    $rowstack5 = (monitor_sql_exec("$sql5"));
    $count5 = count($rowstack5);
    for ($e = 0; $e < $count5; $e++) {
      $row5 = ($rowstack5[$e]);
      $TB_id = $row5['id'];
      $TB_file_name = $row5['file_name'];
      $TB_file_size = sizeformat($row5['file_size']);
      $TB_exec_time = $row5['exec_time'];
      $TB_exec_compress = $row5['exec_compress'];
      $TB_process_status_id = $row5['process_status_id'];
      $TB_description = $row5['description'];
      $TB_creation = $row5['Creation_time'];
    }

    //
    //GRAPHING
    //
    print '<div class="monitorTab" style="width: 100%; height: 200px; overflow: hidden; float: right; background:;">';
    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';  
    print "<iframe src =\"graph-uptime.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";

    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-combined.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";
    print "</div>";

    print '<div class="monitorTab" style="width: 100%; height: 200px; overflow: hidden; float: right; background:;">';
    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-querycache.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";

    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-querycache2.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";
    print "</div>";

    print '<div class="monitorTab" style="width: 100%; height: 200px; overflow: hidden; float: right; background:;">';
    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-data_transfer.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";

    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-memalloc.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";
    print "</div>";

    print '<div class="monitorTab" style="width: 100%; height: 200px; overflow: hidden; float: right; background:;">';
    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-tables.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";

    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-tmp_created.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";
    print "</div>";

    print '<div class="monitorTab" style="width: 100%; height: 200px; overflow: hidden; float: right; background:;">';
    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-threads_now.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";

    print '<div class="monitorTab" style="width: 50%; height: 200px; overflow: hidden; float: right; background:;">';
    print "<iframe src =\"graph-threads_hist.php?host=$host_id&range=$range\" width=\"100%\" height=\"180\"></iframe></div>";
    print "</div>";

    //
    
    if($active == 1) { $active_st = '<img src="images/redarrow.png"> Server is not actively being polled.';}
    else { $active_st = '<img src="images/greenarrow.png"> Server sucessfully polled.';}

    if($slow_queries_map == 1) { $slow_queries_map_st = '<img src="images/redarrow.png"> Slow Query needs to be checked';}
    else { $slow_queries_map_st = '<img src="images/greenarrow.png"> Slow Query setting OK';}

    if($long_queries_map == 1) { $long_queries_map_st = '<img src="images/redarrow.png"> Long Query needs to be checked';}
    else { $long_queries_map_st = '<img src="images/greenarrow.png"> Long Query setting OK';}

    if($used_connections_map == 1) { $used_connections_map_st = '<img src="images/redarrow.png"> Used Connections needs to be checked';}
    else { $used_connections_map_st = '<img src="images/greenarrow.png"> Used Connections setting OK';}

    if($thread_status_map == 1) { $thread_status_map_st = '<img src="images/redarrow.png"> Thread Status needs to be checked';}
    else { $thread_status_map_st = '<img src="images/greenarrow.png"> Thread Status setting OK';}

    if($key_buffers_map == 1) { $key_buffers_map_st = '<img src="images/redarrow.png"> Key Buffer needs to be checked';}
    else { $key_buffers_map_st = '<img src="images/greenarrow.png"> Key Buffers setting OK';}

    if($query_cache_map == 1) { $query_cache_map_st = '<img src="images/redarrow.png"> Query Cache needs to be checked';}
    else { $query_cache_map_st = '<img src="images/greenarrow.png"> Query Cache setting OK';}

    if($sort_merge_map == 1) { $sort_merge_map_st = '<img src="images/redarrow.png"> Sort Merge settings needs to be checked';}
    else { $sort_merge_map_st = '<img src="images/greenarrow.png"> Sort Merge Operations setting OK';}

    if($join_map == 1) { $join_map_st = '<img src="images/redarrow.png"> Join Merge settings needs to be checked';}
    else { $join_map_st = '<img src="images/greenarrow.png"> Join Merge setting OK';}

    if($tmp_tables_map == 1) { $tmp_tables_map_st = '<img src="images/redarrow.png"> Temporary Tables needs to be checked';}
    else { $tmp_tables_map_st = '<img src="images/greenarrow.png"> Temporary Tables setting OK';}

    if($open_files_map == 1) { $open_files_map_st = '<img src="images/redarrow.png"> Open Files needs to be checked';}
    else { $open_files_map_st = '<img src="images/greenarrow.png"> Open Files setting OK';}

    if($table_cache_map == 1) { $table_cache_map_st = '<img src="images/redarrow.png"> Table Cache needs to be checked';}
    else { $table_cache_map_st = '<img src="images/greenarrow.png"> Table Cache setting OK';}

    if($table_locking_map == 1) { $table_locking_map_st = '<img src="images/redarrow.png"> Table Locks needs to be checked';}
    else { $table_locking_map_st = '<img src="images/greenarrow.png"> Table Locking results OK';}

    if($table_scans_map == 1) { $table_scans_map_st = '<img src="images/redarrow.png"> Table Scan settings needs to be checked';}
    else { $table_scans_map_st = '<img src="images/greenarrow.png"> Table Scans setting OK';}

    if($innodb_map == 1) { $innodb_map_st = '<img src="images/redarrow.png"> InnoDB settings needs to be checked';}
    else { $innodb_map_st = '<img src="images/greenarrow.png"> InnoDB settings OK';}

    if($memory_usage_map == 1) { $memory_usage_map_st = '<img src="images/redarrow.png"> Memory Usage needs to be checked';}
    else { $memory_usage_map_st = '<img src="images/greenarrow.png"> Memory Usage results OK';}

    $report_link = '<a href="monitor/'.$link.'"><img src="images/info.gif"></a>';
    $crfile_link = '<a href="monitor/'.$crlink.'"><img src="images/info.gif"></a>';

    print "<tr class=\"d".($i & 1)."\">";
    //    <td align=\"left\">$id</td>
    //    <td align=\"left\">$server_variables_id</td>
    //    <td align=\"left\">$status_variables_id</td> 
    //    <td align=\"left\">$client</td>

    if(!isset($TB_description)){ $TB_description = "No Talkback report for this host."; $TB_file_name="NULL"; $TB_exec_time="NULL"; $TB_exec_compress="NULL"; $TB_id="NULL";}
    print "<td align=\"left\">$hostname</td><td>$hostname</td></tr>
<tr><td align=\"left\">$active_st</td><td><b>$TB_description</b></td></tr> 
<tr><td align=\"left\">$slow_queries_map_st</td><td>File: $TB_file_name</td></tr> 
<tr><td align=\"left\">$long_queries_map_st</td><td>Execution time: $TB_exec_time seconds</td></tr> 
<tr><td align=\"left\">$used_connections_map_st</td><td>Compression time: $TB_exec_compress seconds</td></tr> 
<tr><td align=\"left\">$thread_status_map_st</td><td>File size: $TB_file_size</td></tr> 
<tr><td align=\"left\">$key_buffers_map_st</td><td>Talkback ID: $TB_id</td></tr> 
<tr><td align=\"left\">$query_cache_map_st</td><td>Created: $TB_creation</td></tr> 
<tr><td align=\"left\">$sort_merge_map_st</td></tr> 
<tr><td align=\"left\">$join_map_st</td></tr> 
<tr><td align=\"left\">$tmp_tables_map_st</td></tr> 
<tr><td align=\"left\">$open_files_map_st</td></tr> 
<tr><td align=\"left\">$table_cache_map_st</td></tr> 
<tr><td align=\"left\">$table_locking_map_st</td></tr> 
<tr><td align=\"left\">$table_scans_map_st</td></tr> 
<tr><td align=\"left\">$innodb_map_st</td></tr> 
<tr><td align=\"left\">$memory_usage_map_st</td></tr> ";
print "</tr>";


  }
  $Db_size_total=sizeFormat($Db_size_total);

}

head();

if (!isset($_SESSION['validID'])) {
  $_SESSION['validID'] = 0;
 }

if($_SESSION["validID"] == "0") {
  //print $_SESSION['validID']."<br>";                                                                                
  $return=(check_valid($valid,$usernameSub,$passwordSub));

  if($return == "1") {
    $_SESSION["validID"] = "1";
    start($manage,$id);
  }
 }

elseif($_SESSION["validID"] == "1") {
  links_menu();
  
  if(isset($host_edit_submit)) {
    host_edit_submit($host_idSub,$clientSub,$hostnameSub,$ip_addressSub,$usernameSub,$passwordSub,$portSub,$emailSub,$activeSub,$ram_bytes);
  }
  elseif(isset($edit)) {
    host_edit($host_id);
  }
  elseif(isset($host_add_submit)) {
    host_add_submit($clientSub,$hostnameSub,$ip_addressSub,$usernameSub,$passwordSub,$portSub,$emailSub,$activeSub,$ram_bytes);
  }
  elseif(isset($host_add)) {
    host_add();
  }
  else {
    divSections($host_id,$range,$host_range_id); 
  }
  print '</fieldset></table>';
}

footer();
?>
Return current item: Monolith - MySQL DBA Console