Memcached

Monitor cache performance, hit ratios, memory utilization, and network throughput for your local Memcached instance. The agent connects to the Memcached service and runs the stats command to collect real-time operational data, helping you optimize cache efficiency and resource allocation.

Setup

Preparing Memcached for monitoring typically requires no additional configuration if it is bound to the local interface, as the agent probes the default port 11211.

  1. Verify bind address: Ensure Memcached is listening on 127.0.0.1. Check your /etc/memcached.conf for the -l 127.0.0.1 directive.
  2. Restart Memcached: If you modified the configuration, restart the service: sudo systemctl restart memcached.
  3. Restart the agent: Restart simob to trigger service discovery for the new endpoint: sudo systemctl restart simob.
  4. Enable in UI: Once discovered, explicitly enable the Memcached collector in your dashboard’s server configuration panel.

Configuration

The agent automatically discovers Memcached if it is running on the default port 11211 on localhost. No additional configuration is required for standard installations.

Metrics

The following metrics are collected from the Memcached stats output:

MetricTypeUnitDescription
memcached_connections_current_totalGauge-Number of open connections to the server.
memcached_connections_rateGaugeconns/sRate of new connections per second.
memcached_items_current_totalGauge-Total number of items currently stored by the server.
memcached_items_rateGaugeitems/sRate of new items being stored in the cache.
memcached_get_rateGaugeops/sNumber of get commands processed per second.
memcached_set_rateGaugeops/sNumber of set commands processed per second.
memcached_get_hits_rateGaugehits/sNumber of keys that have been requested and found per second.
memcached_get_misses_rateGaugemisses/sNumber of keys that have been requested and not found per second.
memcached_delete_hits_rateGaugeops/sNumber of deletion requests that successfully found a key.
memcached_delete_misses_rateGaugeops/sNumber of deletion requests for keys that did not exist.
memcached_incr_hits_rateGaugeops/sNumber of increment requests that successfully found a key.
memcached_incr_misses_rateGaugeops/sNumber of increment requests for keys that did not exist.
memcached_decr_hits_rateGaugeops/sNumber of decrement requests that successfully found a key.
memcached_decr_misses_rateGaugeops/sNumber of decrement requests for keys that did not exist.
memcached_read_bpsGaugebytes/sTotal bytes read by the server from the network per second.
memcached_written_bpsGaugebytes/sTotal bytes written by the server to the network per second.
memcached_limit_bytesGaugebytesMaximum number of bytes the server is allowed to use for items.
memcached_used_bytesGaugebytesCurrent number of bytes used by the server to store items.

Troubleshooting

Verify the endpoint

You can manually verify that Memcached is responding to the stats command using nc (netcat):

echo "stats" | nc 127.0.0.1 11211

Or using memstat if the libmemcached-tools package is installed:

memstat --servers=127.0.0.1

Discovery issues

If Memcached is not appearing in the UI, ensure that it is running and accessible on 127.0.0.1:11211. If you are using a custom port or address, please note that current auto-discovery only supports default settings.