# Memcached

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from the results of database calls, API calls, or page rendering. If Memcached is installed on your environment, the Sysdig agent will automatically connect. See the Default Configuration section, below. The Sysdig agent automatically collects basic metrics. You can also edit the configuration to collect additional metrics related to items and slabs.

This page describes the default configuration settings, how to edit the configuration to collect additional information, the metrics available for integration, and a sample result in the Sysdig Monitor UI.

## Memcached Setup

Memcached will automatically expose all metrics. You do not need to add anything on Memcached instance.

## Sysdig Agent Configuration

### Default Configuration

By default, Sysdig's dragent.default.yaml uses the following code to connect with Memcached and collect basic metrics:

app_checks:
- name: memcached
check_module: mcache
pattern:
comm: memcached
conf:
url: localhost
port: "{port}"

Additional metrics can be collected by editing Sysdig's configuration file dragent.yaml. If SASL is enabled, authentication parameters must be added to dragent.yaml.

### Warning

Remember! Never edit dragent.default.yaml directly; always edit only dragent.yaml.

### Example 1: Additional Metrics

 memcache.items.* and memcache.slabs.* can be collected by setting flags in the options section, as follows . Either value can be set to false if you do not want to collect metrics from them.

app_checks:
- name: memcached
check_module: mcache
pattern:
comm: memcached
conf:
url: localhost
port: "{port}"
options:
items: true       # Default is false
slabs: true       # Default is false

### Example 2: SASL

SASL authentication can be enabled with Memcached (see instructions here). If enabled, credentials must be provided against username and password fields as shown in Example 2.

app_checks:
- name: memcached
check_module: mcache
pattern:
comm: memcached
conf:
url: localhost
port: "{port}"
username: <username>
# Some memcached version will support <username>@<hostname>.
# If memcached is installed as a container, hostname of memcached container will be used as username
password: <password>