Memcached is the world's most widely deployed distributed in-memory key-value cache — powering Facebook, Wikipedia, YouTube, and thousands of high-traffic web applications. Its job is to absorb database read load and accelerate page rendering by serving frequently accessed data from RAM. When Memcached fails silently — the process crashes, the port closes, or memory fills without eviction — applications fall back to the database, causing immediate latency spikes and often cascading failures. Vigilmon lets you catch Memcached failures at the TCP and application layer before users notice the slowdown.
What You'll Set Up
- TCP port monitor for Memcached on port 11211
- Stats endpoint health check via TCP keyword verification
- HTTP monitor for phpMemcachedAdmin (if deployed)
- SSL certificate alerts for TLS-wrapped Memcached deployments
- Heartbeat monitor for application-layer cache health checks
Prerequisites
- Memcached running and bound to port 11211
- phpMemcachedAdmin deployed (optional, for the web UI step)
- A free Vigilmon account
Step 1: Monitor Memcached TCP Port Availability
The most fundamental Memcached check is whether port 11211 is open and accepting connections. A TCP failure here means the Memcached process has crashed or the system has run out of file descriptors.
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
TCP Port. - Host:
YOUR_HOST(use127.0.0.1or your server's IP; Memcached should not be exposed to the public internet). - Port:
11211. - Set Check interval to
1 minute. - Click Save.
If Memcached is bound only to 127.0.0.1 (the recommended production configuration), run Vigilmon's monitoring agent on the same host, or use a lightweight TCP relay/proxy that the external Vigilmon probe can reach. Never expose Memcached port 11211 to the public internet — it has no authentication.
Step 2: Verify the Memcached Stats Endpoint
A TCP connection succeeding only confirms the port is open. Checking the stats command response confirms Memcached is actually processing commands, not just holding the socket open in a broken state.
- Add Monitor →
TCP Port(advanced keyword check). - Host:
YOUR_HOST, Port:11211. - Under Advanced, enable Send string on connect:
stats\r\n - Set Expected response contains:
STAT pid - Set Check interval to
2 minutes. - Click Save.
The STAT pid line is always the first line of a healthy stats response, confirming that Memcached is running, accepting commands, and returning valid output. A missing or malformed response indicates a severely degraded process.
Step 3: Monitor phpMemcachedAdmin (If Deployed)
phpMemcachedAdmin is a popular open-source web interface for monitoring and managing Memcached servers. If you have it deployed, its availability is a proxy for both the web server and Memcached connectivity.
- Add Monitor →
HTTP / HTTPS. - URL:
http://YOUR_HOST/phpMemcachedAdmin/index.php(or your configured path). - Set Expected HTTP status to
200. - Under Advanced, set Expected body contains to
Memcached(the page title). - Set Check interval to
5 minutes. - Click Save.
phpMemcachedAdmin is an admin tool, not a production-critical service, so a longer check interval is appropriate. If it returns an error, it may indicate that phpMemcachedAdmin itself cannot connect to Memcached — a useful secondary signal.
Step 4: SSL Certificate Alerts for TLS-Wrapped Deployments
Modern Memcached (1.6+) supports native TLS, and many deployments wrap Memcached behind stunnel or an nginx TCP proxy to encrypt cache traffic. Monitor the certificate on the TLS terminator to catch renewal failures.
For stunnel or nginx TCP proxy:
- Add Monitor →
HTTP / HTTPS(using the HTTPS endpoint of any service that communicates through your TLS-wrapped Memcached). - Enable Monitor SSL certificate.
- Set Alert when certificate expires in less than
14 days. - Click Save.
If you use native Memcached TLS (port 11211 with TLS), add a TCP monitor with keyword check as in Step 2, and separately monitor the certificate expiry of the cert file via your server's certificate renewal heartbeat (see Step 5).
Step 5: Heartbeat Monitor for Application Cache Health
The most business-critical Memcached check is whether your application is successfully using the cache. High miss rates or connection failures at the application layer may not be visible at the TCP level. Many applications expose a health endpoint that includes cache connectivity status.
Set up a Vigilmon heartbeat that your application health check script pings:
- In Vigilmon, Add Monitor →
Heartbeat. - Name it
App Cache Health. - Set Expected interval to
5 minutes. - Copy the generated heartbeat ping URL.
If your application exposes a health endpoint with cache status (e.g. /health returns {"cache":"ok"}), create a monitoring script:
#!/bin/bash
# Check application-layer Memcached health
RESPONSE=$(curl -sf https://YOUR_APP/health)
if echo "$RESPONSE" | grep -q '"cache":"ok"'; then
curl -fsS YOUR_HEARTBEAT_URL > /dev/null 2>&1
fi
Schedule it via cron:
*/5 * * * * /usr/local/bin/cache-healthcheck.sh
Alternatively, use Vigilmon's HTTP keyword monitor directly on your application's health endpoint:
- Add Monitor →
HTTP / HTTPS. - URL:
https://YOUR_APP/health - Under Advanced, set Expected body contains to
"cache":"ok". - Set Check interval to
2 minutes. - Click Save.
This catches the scenario where Memcached appears up at the TCP level but the application can no longer establish connections (e.g., max connection limit hit, SASL auth failure).
Step 6: Alert Channels and Grouping
- Go to Alert Channels in Vigilmon and configure your preferred channel (email, Slack, or webhook).
- Group Memcached monitors under a
Memcachedservice group. - Set the TCP port monitor (Step 1) with the highest alert priority — a TCP failure means total cache unavailability, which immediately impacts all application database load.
- Set Consecutive failures before alert to
2— transient connection spikes can briefly close and reopen connections without a real outage.
Summary
| Monitor | Target | What It Catches |
|---|---|---|
| TCP port | Port 11211 | Process crash, file descriptor exhaustion |
| Stats keyword | STAT pid response | Command processing failure |
| phpMemcachedAdmin | HTTP UI | Admin UI crash, Memcached connectivity |
| SSL certificate | TLS proxy cert | Certificate renewal failure |
| App cache health | /health endpoint | Connection limit, auth failure, app-layer miss |
Memcached failures are silent and fast — within seconds of the process going down, database queries that the cache was absorbing begin hammering your storage layer directly. Vigilmon's external TCP and heartbeat checks give you the earliest possible warning, before the performance impact becomes visible to users.