> ## Documentation Index
> Fetch the complete documentation index at: https://docs-xcor.paloaltonetworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Memcached

> Memcached cache, operation, and connection metrics.

The Memcached integration requires CXDOT Collector 1.4.0 or greater.

[Memcached](https://memcached.org/) is a distributed memory object caching system. Use
the Memcached CXDOT Collector integration with the CXDOT Collector to collect cache,
operation, and connection metrics from Memcached servers running in your environment.

The integration supports Memcached 1.6 or greater.

## Supported telemetry types

The integration supports these telemetry types:

| Type | Supported |
| - | - |
| Logs | No |
| Metrics | Yes |
| Traces | No |
| Events | No |

## Prerequisites

The integration has the following prerequisites:

* A Memcached server that listens on a TCP port the CXDOT Collector can reach. Unix domain
  sockets aren't supported.
* A Memcached server that accepts unauthenticated connections. The integration uses
  the plain-text `stats` command and doesn't support servers that require SASL
  authentication.

## Configure

The Memcached integration is enabled by default. You can configure targets either by
annotating pods in your Kubernetes cluster or by listing static endpoints in your Helm
values. To configure the integration, follow these steps:

1. To collect from Memcached pods in Kubernetes, add a CXDOT integration annotation to
   the pod template. The annotation key must end with the container name. For example,
   add the following annotation to your Memcached workload:

   ```yaml theme={null}
   spec:
     template:
       metadata:
         annotations:
           integrations.cxdot.paloaltonetworks.com/memcached: |
             schema_version: v1.14
             memcached:
               endpoints:
                 - endpoint: ${target.host}:${target.port.memcached}
       spec:
         containers:
           - name: memcached
             image: memcached:1.6
             ports:
               - name: memcached
                 containerPort: 11211
   ```

   The Collector replaces `${target.host}` with the pod IP address and
   `${target.port.memcached}` with the container port named `memcached`.

   The Collector also discovers Memcached pods that carry the
   `app.kubernetes.io/name: memcached` label and listen on port `11211`. A CXDOT
   integration annotation takes precedence over the label for its container. To stop
   collecting from a container, set `memcached: {enabled: false}` in the annotation. For
   more information, see
   [autodiscovery](https://docs-xcor.paloaltonetworks.com/ingest/xcor/collector/discover/kubernetes.md).

2. Optional: To collect from Memcached servers outside your Kubernetes cluster,
   configure static targets. For example, add the following to the `values.yaml` for
   your CXDOT Collector Helm chart:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         memcached:
           endpoints:
             - endpoint: memcached.example.com:11211
   ```

   When you configure static targets, this integration instance collects from exactly
   those targets instead of discovered targets.

3. Optional: Configure a second integration instance to collect from both discovered
   pods and static targets. For example, add the following to the `values.yaml` for
   your CXDOT Collector Helm chart:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         memcached: {}
         memcached/external:
           endpoints:
             - endpoint: memcached.example.com:11211
   ```

   The `memcached/external` key defines a named instance for the static targets. The
   bare `memcached` key continues to discover pods.

4. Optional: Disable the integration when you don't want the CXDOT Collector to collect
   Memcached metrics. For example, add the following to the `values.yaml` for your CXDOT
   Collector Helm chart:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         memcached:
           enabled: false
   ```

### Validate

To validate the integration, follow these steps:

1. In Live Telemetry Analyzer, filter for
   `__name__=cxdot.integration.target.health` and
   `cxdot.integration.name=memcached`. Confirm that each expected target reports `1`.
   A value of `1` means that the `stats` command succeeded. A value of `0` means that
   it failed. Use the `server.address` and `server.port` attributes to identify each
   target.

2. In Metrics Explorer, run the following query:

   ```text theme={null}
   count by ("server.address", "server.port") ({"memcached.uptime"})
   ```

   Confirm that the query returns one time series per target.

## Configuration reference

Configure one Memcached integration instance with the following settings. In Helm values, place
these settings under `collection.cxdot.integrations.memcached`. In a Collector configuration
file, place them under `cxdot.integrations.memcached`.

### Optional settings

* **`enabled`**
  Type: `boolean`. Optional. Default: `true`.
  Whether to run the Memcached integration. If true, the Collector collects Memcached metrics.
  If false, the Collector doesn't run this integration.

* **`endpoints`**
  Type: `array of object`. Optional. Default: `[]`.
  Memcached targets. Each entry's `endpoint` is `host:port`, for example,
  `memcached.default.svc:11211`. When this list isn't empty, the integration collects from
  exactly these targets instead of discovered targets. The integration uses the plain-text
  `stats` command and doesn't support servers that require authentication.

* **`endpoints[].endpoint`**
  Type: `string`. Required.
  Memcached target in `host:port` format.

* **`collection_interval`**
  Type: `duration`. Optional. Default: `10s`.
  Time between metric collections from each Memcached target.

* **`timeout`**
  Type: `duration`. Optional. Default: `10s`.
  Maximum time to wait for each Memcached metric collection.


## Related topics

- [CXDOT Collector integrations](https://docs-xcor.paloaltonetworks.com/ingest/xcor/integrations/collector.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.