Skip to content

Memcached

Common parts of every card (states, backoff, Unit and ExecReload, Test config, manual commands) are described in Monitor window.

Detected by systemd units memcached, memcached@* or binaries memcached
Read every 60 s while the Monitor window shows the tab
Active probe yes, off by default
Test config none

Memcached: running instances with their options, the configuration files of the packages, the version; with the active probe the stats counters of each verified instance (memory against the limit, hit ratio, evictions, connections against the limit).

Passive: on the host the probe finds memcached processes in /proc (real and effective uid in {root, this account, memcache, memcached}, the same PID namespace, a trusted exe) and filters their argv on the host to a closed list: -p -U -l -s -a -m -c -t -u, the switches -S (SASL), -Z (TLS), -Y (auth file: only that it is set), -v, and from -o only ssl_chain_cert/ssl_ca_cert (paths), ssl_verify_mode, idle_timeout, hashpower (numbers), modern and “some ssl_* key” (TLS). /etc/memcached.conf, /etc/memcached_*.conf (Debian) and /etc/sysconfig/memcached (RHEL: PORT, USER, MAXCONN, CACHESIZE, OPTIONS) go through the same filter. memcached -V of trusted binaries with the active probe only. SASL files and passwords are never read.

Active (off by default): stats (and quit) through a unix socket of -s whose path passed the ownership check, or TCP to 127.0.0.1 when /proc/net/tcp shows the port listening and owned by the verified process’s uid; never with SASL, an auth file or TLS. Client socat/nc (trusted, not setuid) under env -i, GNU timeout and its own -T/-w; on the host only a closed list of counters with digits leaves it.

Values from the processes and files stay shell variables on the host; binaries run only after the trust check.

  • Version per binary (unknown (exit N) when -V failed; -V only with the active probe without it).
  • Processes: pid, account (orange when not root, this account, memcache or memcached), the binary check (orange when it failed), PID namespace unknown; under it the listen line (TCP
    port ; UDP …, every interface (no -l), unix socket (mask …); no TCP/UDP, TCP off (-p 0)) and the options: -m memory, -c connections, -t threads, -u, SASL (-S), auth file (-Y, path not shown), TLS, -v, -o keys, not shown: ….
  • Configuration files: the same lines for each file on disk (not necessarily what the running process got).
  • Probe targets: socket or TCP address per process, verified or why not.

Warnings above the lists (orange):

Text Condition
: listens on (TCP port N) without SASL (-S) or an auth file (-Y): no authentication at memcached level TCP on and at least one address other than loopback; with TLS but without required client certificates (ssl_verify_mode 2 or 3) (TLS is on, without required client certificates) is added.
: UDP port N is on (-U) on : memcached over UDP is used for DDoS amplification … -U other than 0 on a non-loopback address.
: no -U and memcached (before 1.5.6 UDP is on by default, on the -p port N) on : DDoS amplification Versions older than 1.5.6 without -U.
: its binary was replaced or deleted on disk (an upgrade without restart?): not used /proc/<pid>/exe points to a deleted file.

With the active probe, one block per instance (at most 4; the rest under Not asked (limit 4 instances)): socket or TCP address, pid, a state tag (green answered; orange incomplete answer, no answer in time; red permission denied, needs authentication, connection refused), version and uptime, then:

Line Content
Memory bytes of limit_maxbytes with percent; items (curr_items).
Hit ratio Since start, and over the time since the previous reading with the number of gets.
Evictions Since start; orange +N since the last reading (N/min): the memory limit pushes out items when they grow.
Connections curr_connections of the limit (max_connections, else -c), rejected, limit reached (listen_disabled_num), threads.
Ran: The exact command.

Orange warnings per instance: memory above 90 % of the limit (memory … is N% of the limit … (-m): new items push out old ones (evictions)), connections at 90 % of the limit or more (N connections of the limit M (-c): at the limit memcached stops accepting new ones), and the connection limit was reached N times since start (listen_disabled_num): clients waited or failed. Rejected connections since start are noted in grey.

Runs: stats then quit (nothing else: no get, no cachedump, no metadump, no stats settings) to at most 4 instances, through socat -T 3 -t 3 stdio UNIX-CONNECT:<socket> or nc -U -w 3 <socket> for a -s socket owned by root, this account, memcache or memcached on a path whose directories belong to those accounts and are not writable by others (unless sticky); without -s through TCP to 127.0.0.1 only when /proc/net/tcp shows the port listening and owned by the verified memcached process. Never with SASL (-S), an auth file (-Y) or TLS (-Z). The client (trusted, not setuid) runs under env -i and GNU timeout 5; only a closed list of counters leaves the host

Traces on the host: one connection per instance and probe (every 60 s): total_connections grows and curr_connections shows it for a moment; with -v/-vv memcached logs every connection (“new auto-negotiating client connection”) to its log or the journal

None: memcached has no configuration test: its configuration is the command line (from the unit, /etc/memcached.conf or /etc/sysconfig/memcached), checked only when it starts; memcached -h lists the options of the installed version.

Scroll or pinch to zoom · drag to move · double-click to zoom · Esc or click outside to close