3 // vim: expandtab sw=4 ts=4 sts=4:
9 require('./server_common.inc.php3');
14 require('./server_links.inc.php3');
17 * Displays the sub-page heading
20 . ' ' . $strServerStatus . "\n"
24 * Checks if the user is allowed to do what he tries to...
26 if (!$is_superuser && !$cfg['ShowMysqlInfo']) {
27 echo $strNoPrivileges;
28 include('./footer.inc.php3');
33 * Sends the query and buffers the result
35 $res = @PMA_mysql_query
('SHOW STATUS;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW STATUS;');
36 while ($row = PMA_mysql_fetch_row($res)) {
37 $serverStatus[$row[0]] = $row[1];
39 @mysql_free_result
($res);
47 $res = @PMA_mysql_query
('SELECT UNIX_TIMESTAMP() - ' . $serverStatus['Uptime'] . ';');
48 $row = PMA_mysql_fetch_row($res);
49 echo sprintf($strServerStatusUptime, PMA_timespanFormat($serverStatus['Uptime']), PMA_localisedDate($row[0])) . "\n";
50 mysql_free_result($res);
53 //Get query statistics
54 $queryStats = array();
55 $tmp_array = $serverStatus;
56 while (list($name, $value) = each($tmp_array)) {
57 if (substr($name, 0, 4) == 'Com_') {
58 $queryStats[str_replace('_', ' ', substr($name, 4))] = $value;
59 unset($serverStatus[$name]);
66 <!-- Server Traffic
-->
67 <?php
echo $strServerTrafficNotes; ?
><br
/>
73 <th colspan
="2"> 
;<?php
echo $strTraffic; ?
> 
;</th
>
74 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
77 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strReceived; ?
> 
;</td
>
78 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'])); ?
> 
;</td
>
79 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
82 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strSent; ?
> 
;</td
>
83 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'])); ?
> 
;</td
>
84 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_sent'] * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
87 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
88 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent'])); ?
> 
;</td
>
89 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo join(' ', PMA_formatByteDown(($serverStatus['Bytes_received'] +
$serverStatus['Bytes_sent']) * 3600 / $serverStatus['Uptime'])); ?
> 
;</td
>
96 <th colspan
="2"> 
;<?php
echo $strConnections; ?
> 
;</th
>
97 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
98 <th
> 
;%
 
;</th
>
101 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strFailedAttempts; ?
> 
;</td
>
102 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_connects'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
103 <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
>
104 <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
>
107 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>"> 
;<?php
echo $strAbortedClients; ?
> 
;</td
>
108 <td bgcolor
="<?php echo $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Aborted_clients'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
109 <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
>
110 <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
>
113 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>"> 
;<?php
echo $strTotalUC; ?
> 
;</td
>
114 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;<?php
echo number_format($serverStatus['Connections'], 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
115 <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
>
116 <td bgcolor
="<?php echo $cfg['BgcolorOne']; ?>" align
="right"> 
;100,00 
;%
 
;</td
>
126 <?php
echo sprintf($strQueryStatistics, number_format($serverStatus['Questions'], 0, $number_decimal_separator, $number_thousands_separator)); ?
><br
/>
132 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
133 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
134 <th
> 
;%
 
;</th
>
138 $useBgcolorOne = TRUE;
140 while (list($name, $value) = each($queryStats)) {
143 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars($name); ?
> 
;</td
>
144 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>" align
="right"> 
;<?php
echo number_format($value, 0, $number_decimal_separator, $number_thousands_separator); ?
> 
;</td
>
145 <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
>
146 <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
>
149 $useBgcolorOne = !$useBgcolorOne;
150 if (++
$countRows == ceil(count($queryStats) / 2)) {
151 $useBgcolorOne = TRUE;
158 <th colspan
="2"> 
;<?php
echo $strQueryType; ?
> 
;</th
>
159 <th
> 
;ø
; 
;<?php
echo $strPerHour; ?
> 
;</th
>
160 <th
> 
;%
 
;</th
>
166 unset($useBgcolorOne);
175 //Unset used variables
176 unset($serverStatus['Aborted_clients']);
177 unset($serverStatus['Aborted_connects']);
178 unset($serverStatus['Bytes_received']);
179 unset($serverStatus['Bytes_sent']);
180 unset($serverStatus['Connections']);
181 unset($serverStatus['Questions']);
182 unset($serverStatus['Uptime']);
184 if (!empty($serverStatus)) {
188 <!-- Other status variables
-->
189 <b
><?php
echo $strMoreStatusVars; ?
></b
><br
/>
195 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
196 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
199 $useBgcolorOne = TRUE;
201 while (list($name, $value) = each($serverStatus)) {
204 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
> 
;</td
>
205 <td bgcolor
="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>"> 
;<?php
echo htmlspecialchars($value); ?
> 
;</td
>
208 $useBgcolorOne = !$useBgcolorOne;
209 if (++
$countRows == ceil(count($serverStatus) / 3) ||
$countRows == ceil(count($serverStatus) * 2 / 3)) {
210 $useBgcolorOne = TRUE;
217 <th
> 
;<?php
echo $strVar; ?
> 
;</th
>
218 <th
> 
;<?php
echo $strValue; ?
> 
;</th
>
223 unset($useBgcolorOne);
241 require('./footer.inc.php3');