Skip to content
Snippets Groups Projects
Commit ed0a944b authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

adding memcache stats dict and template

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1321 44740490-163a-0410-bde0-09ae8108e29a
parent 784e722d
No related branches found
No related tags found
No related merge requests found
<?php
$lang = array(
'pid' => array ('en' => 'Process ID'),
'uptime' => array ('en' => 'Uptime'),
'time' => array ('en' => 'Current time'),
'version' => array ('en' =>'Version'),
'rusage_user' => array ('en' =>'CPU Seconds (User)'),
'rusage_system' => array ('en' =>'CPU Seconds (System)'),
'curr_items' => array ('en' =>'Currently number of items'),
'total_items' => array ('en' =>'Total items ever'),
'bytes' => array ('en' => 'Total bytes in use currently'),
'curr_connections' => array ('en' =>'Current open connections'),
'total_connections' => array('en' => 'Total connections'),
'connection_structures' => array ('en' =>'Connection structures'),
'cmd_get' => array ('en' =>'Total GET commands'),
'cmd_set' => array ('en' =>'Total SET commands'),
'get_hits' => array ('en' =>'Total GET commands (success)'),
'get_misses' => array ('en' =>'Total GET commands (failed)'),
'bytes_read' => array ('en' =>'Bytes in to the server'),
'bytes_written' => array ('en' =>'Bytes written by the server'),
'limit_maxbytes' => array ('en' =>'Total storage avail'),
);
?>
\ No newline at end of file
<?php
$this->data['head'] = '<style>
table.statustable td, table.statustable th {
border: 1px solid #eee;
padding: 2px 6px;
}
table.statustable {
border-collapse: collapse;
}
.bmax {
border: 1px solid #555;
background: #eee;
}
.bused {
border-right: 1px solid #555;
border-bottom: 1px solid #555;
color: white;
background: #833;
}
</style>
';
$this->includeAtTemplateBase('includes/header.php');
$title = $this->data['title'];
$table = $this->data['table'];
/* Identify column headings. */
$column_titles = array();
foreach($table as $row_title => $row_data) {
foreach($row_data as $ct => $foo) {
if(!in_array($ct, $column_titles)) {
$column_titles[] = $ct;
}
}
}
?>
<h2><?php echo htmlspecialchars($title); ?></h2>
<table class="statustable">
<tr>
<th></th>
<?php
foreach($column_titles as $ct) {
echo '<th>' . htmlspecialchars($ct) . '</th>' . "\n";
}
?>
</tr>
<?php
foreach($table as $row_title => $row_data) {
echo '<tr>' . "\n";
echo '<th class="rowtitle" style="text-align: right">' . $this->t('{memcacheMonitor:memcachestat:' . $row_title . '}') . '</th>' . "\n";
# echo '<th class="rowtitle" style="text-align: right">' . $row_title . '</th>' . "\n";
foreach($column_titles as $ct) {
echo '<td>';
if(array_key_exists($ct, $row_data)) {
echo htmlspecialchars($row_data[$ct]);
}
echo '</td>' . "\n";
}
echo '</tr>' . "\n";
}
?>
</table>
<?php
#echo('<pre>'); print_r($this->data['statsraw']); exit;
if (array_key_exists('bytes', $this->data['statsraw']) && array_key_exists('limit_maxbytes', $this->data['statsraw'])) {
foreach($this->data['statsraw']['bytes'] as $key => $row_data) {
echo ('<h3>Storage usage on [' . $key . ']</h3>');
$maxpix = 400;
$pix = floor($this->data['statsraw']['bytes'][$key]*$maxpix / $this->data['statsraw']['limit_maxbytes'][$key]);
echo('<div class="bmax" style="width: ' . $maxpix. 'px"><div class="bused" style="width: ' . $pix . 'px">
Used: ' . $table['bytes'][$key] . '
</div>Total available: ' . $table['limit_maxbytes'][$key] . '</div>');
}
}
?>
<?php
$this->includeAtTemplateBase('includes/footer.php');
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment