Last active
August 3, 2018 12:33
-
-
Save jbraithwaite/39fb54c5456c8cef0504 to your computer and use it in GitHub Desktop.
Memcached Status page in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Memcached</title> | |
<style type="text/css" media="screen"> | |
body { | |
font-family: Consolas, "Lucida Console", Monaco, monospace; | |
} | |
table { | |
margin: 0 auto; | |
width: 500px; | |
} | |
caption { | |
font-size: 4em; | |
padding: 20px 0; | |
} | |
td { | |
padding: 5px; | |
} | |
tr td { | |
text-align: right; | |
} | |
tr td:first-child { | |
font-weight: bold; | |
width: 100px; | |
text-align: left; | |
} | |
tbody tr:nth-child(even) { | |
background-color: #eee; | |
} | |
tr:hover { | |
background-color: #298D84 !important; | |
color: #fff; | |
} | |
thead { | |
display: none; | |
} | |
table { | |
border-collapse:collapse; | |
} | |
</style> | |
</head> | |
<body> | |
<table> | |
<caption>Memcached</caption> | |
<thead> | |
<tr> | |
<th>Field</th> | |
<th>Value</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
$m = new Memcached; | |
$host = 'localhost'; | |
$port = 11211; | |
$m->addServer($host, $port); | |
$stats = $m->getstats()[$host.':' . $port]; | |
foreach($stats as $key => $value): | |
?> | |
<tr> | |
<td><?=$key?></td> | |
<td><?=$value?></td> | |
</tr> | |
<? endforeach; ?> | |
</tbody> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment