memcache.php stats like apc.php

by Harun Yayli on Wednesday, May 21st, 2008 at 5:15 pm under Memcached, PHP, Programming

For a long time I was looking for a nice web interface like the apc.php (comes with the apc’s source) that displays whole nine yards of stats. The only good tool is memcache-tool from the danga guys. It’s quite complete but I guess I’m too lazy to go on the command line.

Anyways, I decided to rip write my own. Totally based on the original apc.php (I even recycled some functions) and apart from completeness, here is a memcache.php that you can get stats and dump from multiple memcache servers.
Here is a screenshot:


And here is the the source code.

As usual, this piece of software comes with the warnings:
- Don’t expect something complete, might have bugs and security problems etc.
- Do not install on a prod environment unless you’re sure!
- Feel free to add stuff to it, I’ll put it to google code or sf.net soon.
- Feel free to request features. (no I’m not planning a backup tool , there is memcache-tool for that)
- Enjoy!

Update: Small parse error is fixed

Recent Entries

22 Responses to “memcache.php stats like apc.php”

  1. James McGlinn Says:

    That’s very useful, thanks for publishing it.

    By the way you have an extra comma (,) in the source code around line 486.

  2. Vinu Thomas Says:

    Hey Harun,
    Just a small problem with the code - it throws an error while running. The comma on line 486 has to be a semi-colon. Changing that fixes the problem.

    Cool Script btw !

  3. Lukas Says:

    Have you talked to the pecl/memcache maintainers to get this script included into the package just like with pecl/apc?

  4. Jason Says:

    Nice script!

    There is a parse error on line 488, “menu_entry(2,’Variables’), ” should be “menu_entry(2,’Variables’);”

  5. daniel Says:

    Hi, this is pretty cool, thanks for sharing!
    regards, dz

  6. Glen Says:

    Do you know of anything like this for Postgres?

  7. Harun Yayli Says:

    @James McGlinn, @Vinu Thomas, @Jason,
    Thanks for noticing, parse error should be fixed now.

  8. Harun Yayli Says:

    @Lukas
    Good idea. I’ll contact them to contribute the code to the pecl/memcache.

  9. Harun Yayli Says:

    @Glen
    Hmm.. No I’m not a Postres user at all.

  10. Trophaeum Says:

    No chance for a txt/tarball download? Pasting a phps file is always so ugly :(

  11. Harun Yayli Says:

    @Trophaeum
    Done :)

  12. Glen Says:

    What about a mysql version then?

  13. Harun Yayli Says:

    @Glen
    There are way too many tools for mysql. Mysql Administrator is really great too (http://www.mysql.com/products/tools/administrator/). I don’t really have a good idea that is not covered by MysqlAdministrator.

  14. Michael Says:

    Awesome script. Thanks so much.

  15. Michael Says:

    BTW, I made one small change to the codebase
    I changed this line:
    Header(”WWW-Authenticate: Basic realm=\”APC Login\”");

    to this:
    Header(”WWW-Authenticate: Basic realm=\”Memcache Login\”");

    I actually have APC devices in my network and thought it was a little confusing. Anyway thanks so much. This is much easier to keep dibs on my memory servers than using the command line all the time.

  16. Michael Gauthier Says:

    Thanks,

    I’ve added a flush cache link, fixed the ‘evicted’ text and made HTTP auth optional. Where do I send the patch?

  17. Harun Yayli Says:

    @michael.

    Thank you. I’ve recently corrected those too.
    You can contact me by email. see the About page.

  18. steve Says:

    great script. perfect for keeping an eye on memcached!

  19. Meskalyn Says:

    Thanks for this script. Very usefull to check all of our memcache servers…

  20. Patryk Says:

    Could you please include this line into HTML code? Thanks.

  21. Patryk Says:

    Hm… where did the code it go? Nvm. Here’s a pastebin link:
    http://pastebin.ca/1203462

  22. Matthew Says:

    thank u r information

    it very useful

Leave a Reply

authimage