Documentation TYPO3 par Ameos

server_status.php

00001 <?php
00002 /* $Id: server_status.php,v 2.4 2003/11/26 22:52:24 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00009 require('./server_common.inc.php');
00010 
00011 
00015 require('./server_links.inc.php');
00016 
00017 
00021 if (!empty($innodbstatus)) {
00022     echo '<h2>' . "\n"
00023        . '    ' . $strInnodbStat . "\n"
00024        . '</h2>' . "\n";
00025     $sql_query = 'SHOW INNODB STATUS;';
00026     $res = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query);
00027     $row = PMA_mysql_fetch_row($res);
00028     echo '<pre>' . "\n"
00029        . htmlspecialchars($row[0]) . "\n"
00030        . '</pre>' . "\n";
00031     mysql_free_result($res);
00032     require_once('./footer.inc.php');
00033 }
00034 
00038 echo '<h2>' . "\n"
00039    . '    ' . $strServerStatus . "\n"
00040    . '</h2>' . "\n";
00041 
00042 
00046 if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
00047     echo $strNoPrivileges;
00048     require_once('./footer.inc.php');
00049 }
00050 
00051 
00055 $res = @PMA_mysql_query('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW STATUS;');
00056 while ($row = PMA_mysql_fetch_row($res)) {
00057     $serverStatus[$row[0]] = $row[1];
00058 }
00059 @mysql_free_result($res);
00060 unset($res);
00061 unset($row);
00062 
00063 
00067 //Uptime calculation
00068 $res = @PMA_mysql_query('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
00069 $row = PMA_mysql_fetch_row($res);
00070 echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
00071 mysql_free_result($res);
00072 unset($res);
00073 unset($row);
00074 //Get query statistics
00075 $queryStats = array();
00076 $tmp_array = $serverStatus;
00077 foreach($tmp_array AS $name => $value) {
00078     if (substr($name, 0, 4) == 'Com_') {
00079         $queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
00080         unset($serverStatus[$name]);
00081     }
00082 }
00083 unset($tmp_array);
00084 ?>
00085 <ul>
00086     <li>
00087         <!-- Server Traffic -->
00088         <?php echo $strServerTrafficNotes; ?><br />
00089         <table border="0">
00090             <tr>
00091                 <td valign="top">
00092                     <table border="0">
00093                         <tr>
00094                             <th colspan="2">&nbsp;<?php echo $strTraffic; ?>&nbsp;</th>
00095                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
00096                         </tr>
00097                         <tr>
00098                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strReceived; ?>&nbsp;</td>
00099                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'])); ?>&nbsp;</td>
00100                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
00101                         </tr>
00102                         <tr>
00103                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strSent; ?>&nbsp;</td>
00104                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'])); ?>&nbsp;</td>
00105                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
00106                         </tr>
00107                         <tr>
00108                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">&nbsp;<?php echo $strTotalUC; ?>&nbsp;</td>
00109                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent'])); ?>&nbsp;</td>
00110                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] + $serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?>&nbsp;</td>
00111                         </tr>
00112                     </table>
00113                 </td>
00114                 <td valign="top">
00115                     <table border="0">
00116                         <tr>
00117                             <th colspan="2">&nbsp;<?php echo $strConnections; ?>&nbsp;</th>
00118                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
00119                             <th>&nbsp;%&nbsp;</th>
00120                         </tr>
00121                         <tr>
00122                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strFailedAttempts; ?>&nbsp;</td>
00123                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_connects'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00124                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_connects'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00125                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_connects'] * 100 / $serverStatus['Connections']), 2, $number_decimal_separator, $number_thousands_separator) . '&nbsp;%' : '---'; ?>&nbsp;</td>
00126                         </tr>
00127                         <tr>
00128                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo $strAbortedClients; ?>&nbsp;</td>
00129                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Aborted_clients'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00130                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Aborted_clients'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00131                             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo ($serverStatus['Connections'] > 0 ) ? number_format(($serverStatus['Aborted_clients'] * 100 / $serverStatus['Connections']), 2 , $number_decimal_separator, $number_thousands_separator) . '&nbsp;%' : '---'; ?>&nbsp;</td>
00132                         </tr>
00133                         <tr>
00134                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">&nbsp;<?php echo $strTotalUC; ?>&nbsp;</td>
00135                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Connections'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00136                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Connections'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00137                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(100, 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;%&nbsp;</td>
00138                         </tr>
00139                     </table>
00140                 </td>
00141             </tr>
00142         </table>
00143     </li>
00144     <br />
00145     <li>
00146         <!-- Queries -->
00147         <?php echo sprintf($strQueryStatistics, number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator)) . "\n"; ?>
00148         <table border="0">
00149             <tr>
00150                 <td colspan="2">
00151                     <br />
00152                     <table border="0" align="right">
00153                         <tr>
00154                             <th>&nbsp;<?php echo $strTotalUC; ?>&nbsp;</th>
00155                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
00156                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerMinute; ?>&nbsp;</th>
00157                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerSecond; ?>&nbsp;</th>
00158                         </tr>
00159                         <tr>
00160                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00161                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00162                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] * 60 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00163                             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">&nbsp;<?php echo number_format(($serverStatus['Questions'] / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00164                         </tr>
00165                     </table>
00166                 </td>
00167             </tr>
00168             <tr>
00169                 <td valign="top">
00170                     <table border="0">
00171                         <tr>
00172                             <th colspan="2">&nbsp;<?php echo $strQueryType; ?>&nbsp;</th>
00173                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
00174                             <th>&nbsp;%&nbsp;</th>
00175                         </tr>
00176 <?php
00177 
00178 $useBgcolorOne = TRUE;
00179 $countRows = 0;
00180 foreach ($queryStats as $name => $value) {
00181 
00182 // For the percentage column, use Questions - Connections, because
00183 // the number of connections is not an item of the Query types
00184 // but is included in Questions. Then the total of the percentages is 100.
00185 ?>
00186                         <tr>
00187                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo htmlspecialchars($name); ?>&nbsp;</td>
00188                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format($value, 0, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00189                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($value * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;</td>
00190                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo number_format(($value * 100 / ($serverStatus['Questions'] - $serverStatus['Connections'])), 2, $number_decimal_separator, $number_thousands_separator); ?>&nbsp;%&nbsp;</td>
00191                         </tr>
00192 <?php
00193     $useBgcolorOne = !$useBgcolorOne;
00194     if (++$countRows == ceil(count($queryStats) / 2)) {
00195         $useBgcolorOne = TRUE;
00196 ?>
00197                     </table>
00198                 </td>
00199                 <td valign="top">
00200                     <table border="0">
00201                         <tr>
00202                             <th colspan="2">&nbsp;<?php echo $strQueryType; ?>&nbsp;</th>
00203                             <th>&nbsp;&oslash;&nbsp;<?php echo $strPerHour; ?>&nbsp;</th>
00204                             <th>&nbsp;%&nbsp;</th>
00205                         </tr>
00206 <?php
00207     }
00208 }
00209 unset($countRows);
00210 unset($useBgcolorOne);
00211 ?>
00212                     </table>
00213                 </td>
00214             </tr>
00215         </table>
00216     </li>
00217 <?php
00218 //Unset used variables
00219 unset($serverStatus['Aborted_clients']);
00220 unset($serverStatus['Aborted_connects']);
00221 unset($serverStatus['Bytes_received']);
00222 unset($serverStatus['Bytes_sent']);
00223 unset($serverStatus['Connections']);
00224 unset($serverStatus['Questions']);
00225 unset($serverStatus['Uptime']);
00226 
00227 if (!empty($serverStatus)) {
00228 ?>
00229     <br />
00230     <li>
00231         <!-- Other status variables -->
00232         <b><?php echo $strMoreStatusVars; ?></b><br />
00233         <table border="0">
00234             <tr>
00235                 <td valign="top">
00236                     <table border="0">
00237                         <tr>
00238                             <th>&nbsp;<?php echo $strVar; ?>&nbsp;</th>
00239                             <th>&nbsp;<?php echo $strValue; ?>&nbsp;</th>
00240                         </tr>
00241 <?php
00242     $useBgcolorOne = TRUE;
00243     $countRows = 0;
00244     foreach($serverStatus AS $name => $value) {
00245 ?>
00246                         <tr>
00247                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">&nbsp;<?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?>&nbsp;</td>
00248                             <td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align="right">&nbsp;<?php echo htmlspecialchars($value); ?>&nbsp;</td>
00249                         </tr>
00250 <?php
00251         $useBgcolorOne = !$useBgcolorOne;
00252         if (++$countRows == ceil(count($serverStatus) / 3) || $countRows == ceil(count($serverStatus) * 2 / 3)) {
00253             $useBgcolorOne = TRUE;
00254 ?>
00255                     </table>
00256                 </td>
00257                 <td valign="top">
00258                     <table border="0">
00259                         <tr>
00260                             <th>&nbsp;<?php echo $strVar; ?>&nbsp;</th>
00261                             <th>&nbsp;<?php echo $strValue; ?>&nbsp;</th>
00262                         </tr>
00263 <?php
00264         }
00265     }
00266     unset($useBgcolorOne);
00267 ?>
00268                     </table>
00269                 </td>
00270             </tr>
00271         </table>
00272     </li>
00273 <?php
00274 }
00275 $res = PMA_mysql_query('SHOW VARIABLES LIKE "have_innodb";', $userlink);
00276 if ($res) {
00277     $row = PMA_mysql_fetch_row($res);
00278     if (!empty($row[1]) && $row[1] == 'YES') {
00279 ?>
00280     <br />
00281     <li>
00282         <!-- InnoDB Status -->
00283         <a href="./server_status.php?<?php echo $url_query; ?>&amp;innodbstatus=1">
00284             <b><?php echo $strInnodbStat; ?></b>
00285         </a>
00286     </li>
00287 <?php
00288     }
00289 } else {
00290     unset($res);
00291 }
00292 ?>
00293 </ul>
00294 
00295 
00296 <?php
00297 
00298 
00302 require_once('./footer.inc.php');
00303 
00304 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6