Memcached

Memcached is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

Available solutions




This template is for Zabbix version: 7.0

Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/memcached?at=release/7.0

Memcached by Zabbix agent 2

Overview

This template is designed for the effortless deployment of Memcached monitoring by Zabbix via Zabbix agent 2 and doesn't require any external scripts.

Requirements

Zabbix version: 7.0 and higher.

Tested versions

This template has been tested on:

  • Memcached 1.4, 1.5, 1.6

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

Setup and configure zabbix-agent2 compiled with the Memcached monitoring plugin.

Test availability: zabbix_get -s memcached-host -k memcached.ping

Macros used

Name Description Default
{$MEMCACHED.CONN.URI}

Connection string in the URI format (password is not used). This param overwrites a value configured in the "Plugins.Memcached.Uri" option of the configuration file (if it's set), otherwise, the plugin's default value is used: "tcp://localhost:11211"

tcp://localhost:11211
{$MEMCACHED.CONN.THROTTLED.MAX.WARN}

Maximum number of throttled connections per second

1
{$MEMCACHED.CONN.QUEUED.MAX.WARN}

Maximum number of queued connections per second

1
{$MEMCACHED.CONN.PRC.MAX.WARN}

Maximum percentage of connected clients

80
{$MEMCACHED.MEM.PUSED.MAX.WARN}

Maximum percentage of memory used

90

Items

Name Description Type Key and additional info
Get status Zabbix agent memcached.stats["{$MEMCACHED.CONN.URI}"]
Ping Zabbix agent memcached.ping["{$MEMCACHED.CONN.URI}"]

Preprocessing

  • Discard unchanged with heartbeat: 10m

Max connections

Max number of concurrent connections

Dependent item memcached.connections.max

Preprocessing

  • JSON Path: $.max_connections

  • Discard unchanged with heartbeat: 30m

Maximum number of bytes

Maximum number of bytes allowed in cache. You can adjust this setting via a config file or the command line while starting your Memcached server.

Dependent item memcached.config.limit_maxbytes

Preprocessing

  • JSON Path: $.limit_maxbytes

  • Discard unchanged with heartbeat: 30m

CPU sys

System CPU consumed by the Memcached server

Dependent item memcached.cpu.sys

Preprocessing

  • JSON Path: $.rusage_system

CPU user

User CPU consumed by the Memcached server

Dependent item memcached.cpu.user

Preprocessing

  • JSON Path: $.rusage_user

Queued connections per second

Number of times that memcached has hit its connections limit and disabled its listener

Dependent item memcached.connections.queued.rate

Preprocessing

  • JSON Path: $.listen_disabled_num

  • Change per second
New connections per second

Number of connections opened per second

Dependent item memcached.connections.rate

Preprocessing

  • JSON Path: $.total_connections

  • Change per second
Throttled connections

Number of times a client connection was throttled. When sending GETs in batch mode and the connection contains too many requests (limited by -R parameter) the connection might be throttled to prevent starvation.

Dependent item memcached.connections.throttled.rate

Preprocessing

  • JSON Path: $.conn_yields

  • Change per second
Connection structures

Number of connection structures allocated by the server

Dependent item memcached.connections.structures

Preprocessing

  • JSON Path: $.connection_structures

Open connections

The number of clients presently connected

Dependent item memcached.connections.current

Preprocessing

  • JSON Path: $.curr_connections

Commands: FLUSH per second

The flush_all command invalidates all items in the database. This operation incurs a performance penalty and shouldn't take place in production, so check your debug scripts.

Dependent item memcached.commands.flush.rate

Preprocessing

  • JSON Path: $.cmd_flush

  • Change per second
Commands: GET per second

Number of GET requests received by server per second.

Dependent item memcached.commands.get.rate

Preprocessing

  • JSON Path: $.cmd_get

  • Change per second
Commands: SET per second

Number of SET requests received by server per second.

Dependent item memcached.commands.set.rate

Preprocessing

  • JSON Path: $.cmd_set

  • Change per second
Process id

PID of the server process

Dependent item memcached.process_id

Preprocessing

  • JSON Path: $.pid

  • Discard unchanged with heartbeat: 1d

Memcached version

Version of the Memcached server

Dependent item memcached.version

Preprocessing

  • JSON Path: $.version

  • Discard unchanged with heartbeat: 1d

Uptime

Number of seconds since Memcached server start

Dependent item memcached.uptime

Preprocessing

  • JSON Path: $.uptime

Bytes used

Current number of bytes used to store items.

Dependent item memcached.stats.bytes

Preprocessing

  • JSON Path: $.bytes

Written bytes per second

The network's read rate per second in B/sec

Dependent item memcached.stats.bytes_written.rate

Preprocessing

  • JSON Path: $.bytes_written

  • Change per second
Read bytes per second

The network's read rate per second in B/sec

Dependent item memcached.stats.bytes_read.rate

Preprocessing

  • JSON Path: $.bytes_read

  • Change per second
Hits per second

Number of successful GET requests (items requested and found) per second.

Dependent item memcached.stats.hits.rate

Preprocessing

  • JSON Path: $.get_hits

  • Change per second
Misses per second

Number of missed GET requests (items requested but not found) per second.

Dependent item memcached.stats.misses.rate

Preprocessing

  • JSON Path: $.get_misses

  • Change per second
Evictions per second

"An eviction is when an item that still has time to live is removed from the cache because a brand new item needs to be allocated.

The item is selected with a pseudo-LRU mechanism.

A high number of evictions coupled with a low hit rate means your application is setting a large number of keys that are never used again."

Dependent item memcached.stats.evictions.rate

Preprocessing

  • JSON Path: $.evictions

  • Change per second
New items per second

Number of new items stored per second.

Dependent item memcached.stats.total_items.rate

Preprocessing

  • JSON Path: $.total_items

  • Change per second
Current number of items stored

Current number of items stored by this instance.

Dependent item memcached.stats.curr_items

Preprocessing

  • JSON Path: $.curr_items

Threads

Number of worker threads requested

Dependent item memcached.stats.threads

Preprocessing

  • JSON Path: $.threads

Triggers

Name Description Expression Severity Dependencies and additional info
Service is down last(/Memcached by Zabbix agent 2/memcached.ping["{$MEMCACHED.CONN.URI}"])=0 Average Manual close: Yes
Failed to fetch info data

Zabbix has not received any data for items for the last 30 minutes.

nodata(/Memcached by Zabbix agent 2/memcached.cpu.sys,30m)=1 Warning Manual close: Yes
Depends on:
  • Service is down
Too many queued connections

The max number of connections is reached and a new connection had to wait in the queue as a result.

min(/Memcached by Zabbix agent 2/memcached.connections.queued.rate,5m)>{$MEMCACHED.CONN.QUEUED.MAX.WARN} Warning
Too many throttled connections

Number of times a client connection was throttled is too high.
When sending GETs in batch mode and the connection contains too many requests (limited by -R parameter) the connection might be throttled to prevent starvation.

min(/Memcached by Zabbix agent 2/memcached.connections.throttled.rate,5m)>{$MEMCACHED.CONN.THROTTLED.MAX.WARN} Warning
Total number of connected clients is too high

When the number of connections reaches the value of the "max_connections" parameter, new connections will be rejected.

min(/Memcached by Zabbix agent 2/memcached.connections.current,5m)/last(/Memcached by Zabbix agent 2/memcached.connections.max)*100>{$MEMCACHED.CONN.PRC.MAX.WARN} Warning
Version has changed

The Memcached version has changed. Acknowledge to close the problem manually.

last(/Memcached by Zabbix agent 2/memcached.version,#1)<>last(/Memcached by Zabbix agent 2/memcached.version,#2) and length(last(/Memcached by Zabbix agent 2/memcached.version))>0 Info Manual close: Yes
has been restarted

Uptime is less than 10 minutes.

last(/Memcached by Zabbix agent 2/memcached.uptime)<10m Info Manual close: Yes
Memory usage is too high min(/Memcached by Zabbix agent 2/memcached.stats.bytes,5m)/last(/Memcached by Zabbix agent 2/memcached.config.limit_maxbytes)*100>{$MEMCACHED.MEM.PUSED.MAX.WARN} Warning

Feedback

Please report any issues with the template at https://support.zabbix.com

You can also provide feedback, discuss the template, or ask for help at ZABBIX forums

Articles and documentation

+ Propose new article

Didn't find integration you need?