3 // vim: expandtab sw=4 ts=4 sts=4:
9 require('./server_common.inc.php3');
15 require('./server_links.inc.php3');
19 * Displays the sub-page heading
22 . ' ' . $strServerStatus . "\n"
27 * Checks if the user is allowed to do what he tries to...
29 if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
30 echo $strNoPrivileges;
31 include('./footer.inc.php3');
37 * Sends the query and buffers the result
39 $res = @PMA_mysql_query
('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW STATUS;');
40 while ($row = PMA_mysql_fetch_row($res)) {
41 $serverStatus[$row[0]] = $row[1];
43 @mysql_free_result
($res);
52 $res = @PMA_mysql_query
('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
53 $row = PMA_mysql_fetch_row($res);
54 echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
55 mysql_free_result($res);
58 //Get query statistics
59 $queryStats = array();
60 $tmp_array = $serverStatus;
61 while (list($name, $value) = each($tmp_array)) {
62 if (substr($name, 0, 4) == 'Com_') {
63 $queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
64 unset($serverStatus[$name]);
71 <!-- Server Traffic
-->
72 <?php
echo $strServerTrafficNotes; ?
><br
/>
78 <th colspan
="2"> 
;<?php
echo $strTraffic; ?
> 
;</th
>
79 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
82 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strReceived; ?
> 
;</td
>
83 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'])); ?
> 
;</td
>
84 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
87 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strSent; ?
> 
;</td
>
88 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'])); ?
> 
;</td
>
89 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
92 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
93 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent'])); ?
> 
;</td
>
94 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
101 <th colspan
="2"> 
;<?php
echo $strConnections; ?
> 
;</th
>
102 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
103 <th
> 
;%
 
;</th
>
106 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strFailedAttempts; ?
> 
;</td
>
107 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_connects'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
108 <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
>
109 <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
>
112 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strAbortedClients; ?
> 
;</td
>
113 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_clients'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
114 <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
>
115 <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
>
118 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
119 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Connections'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
120 <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
>
121 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;100,00 
;%
 
;</td
>
131 <?php
echo sprintf($strQueryStatistics, number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator)); ?
><br
/>
137 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
138 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
139 <th
> 
;%
 
;</th
>
143 $useBgcolorOne = TRUE;
145 while (list($name, $value) = each($queryStats)) {
148 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars($name); ?
> 
;</td
>
149 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($value, 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
150 <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
>
151 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format(($value * 100 / $serverStatus['Questions']), 2, $number_decimal_separator, $number_thousands_separator); ?
> 
;%
 
;</td
>
154 $useBgcolorOne = !$useBgcolorOne;
155 if (++
$countRows == ceil(count($queryStats) / 2)) {
156 $useBgcolorOne = TRUE;
163 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
164 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
165 <th
> 
;%
 
;</th
>
171 unset($useBgcolorOne);
180 //Unset used variables
181 unset($serverStatus['Aborted_clients']);
182 unset($serverStatus['Aborted_connects']);
183 unset($serverStatus['Bytes_received']);
184 unset($serverStatus['Bytes_sent']);
185 unset($serverStatus['Connections']);
186 unset($serverStatus['Questions']);
187 unset($serverStatus['Uptime']);
189 if (!empty($serverStatus)) {
193 <!-- Other status variables
-->
194 <b
><?php
echo $strMoreStatusVars; ?
></b
><br
/>
200 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
201 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
204 $useBgcolorOne = TRUE;
206 while (list($name, $value) = each($serverStatus)) {
209 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
> 
;</td
>
210 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars($value); ?
> 
;</td
>
213 $useBgcolorOne = !$useBgcolorOne;
214 if (++
$countRows == ceil(count($serverStatus) / 3) ||
$countRows == ceil(count($serverStatus) * 2 / 3)) {
215 $useBgcolorOne = TRUE;
222 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
223 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
228 unset($useBgcolorOne);
247 require('./footer.inc.php3');