As with many applications, there's an exporter for memcached.

To demonstrate, let's get a memcached up and running using Docker so you don't have to compile it by hand:

docker run -p11211:11211 -d memcached:1.5.16

You can see the stats it provides with:

echo stats | nc localhost 11211

To get this into a format usable by Prometheus, you can use the memcached_exporter:

tar -xzf memcached_exporter-0.5.0.linux-amd64.tar.gz
cd memcached_exporter-0.5.0.linux-amd64/

Which will expose metrics on :9150/metrics. Now you can run a Prometheus to scrape this:

tar -xzf prometheus-2.10.0.linux-amd64.tar.gz
cd prometheus-*
cat <<'EOF' > prometheus.yml
 scrape_interval: 10s
 evaluation_interval: 10s
 - job_name: 'memcached'
    - targets:
      - localhost:9150
./prometheus &

From there you can go to :9090/graph and plot expressions such as rate(memcached_commands_total[1m]) to get the query rate.


Have questions about monitoring applications with Prometheus? Contact us.