简体   繁体   English

使用PHP脚本监控Memcached

[英]Monitoring Memcached with PHP script

I've written a PHP script that I've scheduled with CRON to run every minute. 我编写了一个PHP脚本,该脚本已与CRON安排为每分钟运行一次。 The goal of the script is to verify that the memcached server is online. 该脚本的目标是验证Memcached服务器是否处于联机状态。 My strategy is simply to attempt to connect to the memcached server. 我的策略只是尝试连接到memcached服务器。 If I connect successfully, I close the connection. 如果连接成功,则关闭连接。 If I do not successfully connect, I send an email alerting that memcached is offline. 如果我没有成功连接,我会发送一封电子邮件,提醒memcached处于脱机状态。

My question: is this a sufficient test that memcached is up and running, or is it common practice to do more than just connect to memcached? 我的问题是:这是否足以证明memcached已启动并正在运行,还是除了连接到memcached以外还要做更多的常规做法? Should I also test that I can set and retrieve a key/value pair? 我还应该测试我可以设置和检索键/值对吗?

Also, in the future, we may want to do more extensive monitoring of memcached so we can track memory usage, connections, number of requests, etc. Are there open source libraries for doing this from PHP? 另外,在将来,我们可能希望对memcached进行更广泛的监视,以便我们可以跟踪内存使用情况,连接,请求数量等。是否有开放源代码库可用于PHP? If so, which ones have performed nicely in your experience? 如果是这样,在您的体验中哪些表现良好?

You don't need to build anything. 您不需要构建任何东西。 There are a number of PHP scripts intended for monitoring, debugging and displaying stats for a Memchached server. 有许多PHP脚本旨在监视,调试和显示Memchached服务器的统计信息。

There are two that I know of and work well: 我知道有两种方法并能很好地工作:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM