3 // vim: expandtab sw=4 ts=4 sts=4:
9 require('./server_common.inc.php');
15 require('./server_links.inc.php');
21 if (!empty($innodbstatus)) {
23 . ' ' . $strInnodbStat . "\n"
25 $sql_query = 'SHOW INNODB STATUS;';
26 $res = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query);
27 $row = PMA_mysql_fetch_row($res);
29 . htmlspecialchars($row[0]) . "\n"
31 mysql_free_result($res);
32 require_once('./footer.inc.php');
36 * Displays the sub-page heading
39 . ' ' . $strServerStatus . "\n"
44 * Checks if the user is allowed to do what he tries to...
46 if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
47 echo $strNoPrivileges;
48 require_once('./footer.inc.php');
53 * Sends the query and buffers the result
55 $res = @PMA_mysql_query
('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW STATUS;');
56 while ($row = PMA_mysql_fetch_row($res)) {
57 $serverStatus[$row[0]] = $row[1];
59 @mysql_free_result
($res);
68 $res = @PMA_mysql_query
('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
69 $row = PMA_mysql_fetch_row($res);
70 echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
71 mysql_free_result($res);
74 //Get query statistics
75 $queryStats = array();
76 $tmp_array = $serverStatus;
77 foreach($tmp_array AS $name => $value) {
78 if (substr($name, 0, 4) == 'Com_') {
79 $queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
80 unset($serverStatus[$name]);
87 <!-- Server Traffic
-->
88 <?php
echo $strServerTrafficNotes; ?
><br
/>
94 <th colspan
="2"> 
;<?php
echo $strTraffic; ?
> 
;</th
>
95 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
98 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strReceived; ?
> 
;</td
>
99 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'])); ?
> 
;</td
>
100 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
103 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strSent; ?
> 
;</td
>
104 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'])); ?
> 
;</td
>
105 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
108 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
109 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent'])); ?
> 
;</td
>
110 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
117 <th colspan
="2"> 
;<?php
echo $strConnections; ?
> 
;</th
>
118 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
119 <th
> 
;%
 
;</th
>
122 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strFailedAttempts; ?
> 
;</td
>
123 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_connects'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
124 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Aborted_connects'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
125 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo ($serverStatus['Connections'] > 0 ) ?
number_format(($serverStatus['Aborted_connects'] * 100 / $serverStatus['Connections']), 2, $number_decimal_separator, $number_thousands_separator) . ' %' : '---'; ?
> 
;</td
>
128 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strAbortedClients; ?
> 
;</td
>
129 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_clients'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
130 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Aborted_clients'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
131 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo ($serverStatus['Connections'] > 0 ) ?
number_format(($serverStatus['Aborted_clients'] * 100 / $serverStatus['Connections']), 2 , $number_decimal_separator, $number_thousands_separator) . ' %' : '---'; ?
> 
;</td
>
134 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
135 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Connections'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
136 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Connections'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
137 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format(100, 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;%
 
;</td
>
147 <?php
echo sprintf($strQueryStatistics, number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator)) . "\n"; ?
>
152 <table border
="0" align
="right">
154 <th
> 
;<?php
echo $strTotalUC; ?
> 
;</th
>
155 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
156 <th
> 
;ø
; 
;<?php
echo $strPerMinute; ?
> 
;</th
>
157 <th
> 
;ø
; 
;<?php
echo $strPerSecond; ?
> 
;</th
>
160 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
161 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Questions'] * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
162 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Questions'] * 60 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
163 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format(($serverStatus['Questions'] / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
172 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
173 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
174 <th
> 
;%
 
;</th
>
178 $useBgcolorOne = TRUE;
180 foreach ($queryStats as $name => $value) {
182 // For the percentage column, use Questions - Connections, because
183 // the number of connections is not an item of the Query types
184 // but is included in Questions. Then the total of the percentages is 100.
187 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars($name); ?
> 
;</td
>
188 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($value, 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
189 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format(($value * 3600 / $serverStatus['Uptime']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
190 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format(($value * 100 / ($serverStatus['Questions'] - $serverStatus['Connections'])), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;%
 
;</td
>
193 $useBgcolorOne = !$useBgcolorOne;
194 if (++
$countRows == ceil(count($queryStats) / 2)) {
195 $useBgcolorOne = TRUE;
202 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
203 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
204 <th
> 
;%
 
;</th
>
210 unset($useBgcolorOne);
218 //Unset used variables
219 unset($serverStatus['Aborted_clients']);
220 unset($serverStatus['Aborted_connects']);
221 unset($serverStatus['Bytes_received']);
222 unset($serverStatus['Bytes_sent']);
223 unset($serverStatus['Connections']);
224 unset($serverStatus['Questions']);
225 unset($serverStatus['Uptime']);
227 if (!empty($serverStatus)) {
231 <!-- Other status variables
-->
232 <b
><?php
echo $strMoreStatusVars; ?
></b
><br
/>
238 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
239 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
242 $useBgcolorOne = TRUE;
244 foreach($serverStatus AS $name => $value) {
247 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
> 
;</td
>
248 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo htmlspecialchars($value); ?
> 
;</td
>
251 $useBgcolorOne = !$useBgcolorOne;
252 if (++
$countRows == ceil(count($serverStatus) / 3) ||
$countRows == ceil(count($serverStatus) * 2 / 3)) {
253 $useBgcolorOne = TRUE;
260 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
261 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
266 unset($useBgcolorOne);
275 $res = PMA_mysql_query('SHOW VARIABLES LIKE "have_innodb";', $userlink);
277 $row = PMA_mysql_fetch_row($res);
278 if (!empty($row[1]) && $row[1] == 'YES') {
282 <!-- InnoDB Status
-->
283 <a href
="./server_status.php?<?php echo $url_query; ?>&innodbstatus=1">
284 <b
><?php
echo $strInnodbStat; ?
></b
>
302 require_once('./footer.inc.php');