---
title: Twemproxy
description: >-
  Visualize twemproxy performance and correlate with the rest of your
  applications
breadcrumbs: Docs > Integrations > Twemproxy
---

# Twemproxy
Supported OS Integration version3.3.0
## Overview{% #overview %}

Track overall and per-pool stats on each of your Twemproxy servers. This Agent check collects metrics for client and server connections and errors, request and response rates, bytes in and out of the proxy, and more.

**Minimum Agent version:** 6.0.0

## Setup{% #setup %}

### Installation{% #installation %}

The Agent's Twemproxy check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package, so you don't need to install anything else on your Twemproxy servers.

### Configuration{% #configuration %}

{% tab title="Host" %}
#### Host{% #host %}

To configure this check for an Agent running on a host:

1. Edit the `twemproxy.d/conf.yaml` file in the `conf.d/` folder at the root of your [Agent's configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory). See the [sample twemproxy.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/twemproxy/datadog_checks/twemproxy/data/conf.yaml.example) for all available configuration options:

   ```yaml
   init_config:
   
   instances:
     - host: localhost
       port: 2222
   ```

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent) to begin sending Twemproxy metrics to Datadog.

##### Log collection{% #log-collection %}

1. Collecting logs is disabled by default in the Datadog Agent, you need to enable it in `datadog.yaml`:

   ```yaml
   logs_enabled: true
   ```

1. Add this configuration block to your `twemproxy.d/conf.yaml` file to start collecting your Apache Logs:

   ```yaml
   logs:
     - type: file
       path: "<LOG_FILE_PATH>"
       source: twemproxy
       service: "<SERVICE_NAME>"
   ```

Change the `path` and `service` parameter values and configure them for your environment. See the [sample twemproxy.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/twemproxy/datadog_checks/twemproxy/data/conf.yaml.example) for all available configuration options.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent).

{% /tab %}

{% tab title="Containerized" %}
#### Containerized{% #containerized %}

For containerized environments, see the [Autodiscovery Integration Templates](https://docs.datadoghq.com/agent/kubernetes/integrations/) for guidance on applying the parameters below.

| Parameter            | Value                                  |
| -------------------- | -------------------------------------- |
| `<INTEGRATION_NAME>` | `twemproxy`                            |
| `<INIT_CONFIG>`      | blank or `{}`                          |
| `<INSTANCE_CONFIG>`  | `{"host": "%%host%%", "port":"22222"}` |

##### Log collection{% #log-collection %}

Collecting logs is disabled by default in the Datadog Agent. To enable it, see [Kubernetes log collection documentation](https://docs.datadoghq.com/agent/kubernetes/log/).

| Parameter      | Value                                                  |
| -------------- | ------------------------------------------------------ |
| `<LOG_CONFIG>` | `{"source": "twemproxy", "service": "<SERVICE_NAME>"}` |

{% /tab %}

### Validation{% #validation %}

Run the [Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information) and look for `twemproxy` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **twemproxy.client\_connections**(gauge) | number of active client connections*Shown as connection*                  |
| **twemproxy.client\_eof**(gauge)         | number of eof on client connections*Shown as error*                       |
| **twemproxy.client\_err**(gauge)         | number of errors on client connections*Shown as error*                    |
| **twemproxy.curr\_connections**(gauge)   | number of current connections*Shown as connection*                        |
| **twemproxy.forward\_error**(gauge)      | number of times we encountered a forwarding error*Shown as error*         |
| **twemproxy.fragments**(gauge)           | number of fragments created from a multi-vector request*Shown as request* |
| **twemproxy.in\_queue**(gauge)           | number of requests in incoming queue*Shown as request*                    |
| **twemproxy.in\_queue\_bytes**(gauge)    | current request bytes in incoming queue*Shown as byte*                    |
| **twemproxy.out\_queue**(gauge)          | number of requests in outgoing queue*Shown as request*                    |
| **twemproxy.out\_queue\_bytes**(gauge)   | current request bytes in outgoing queue*Shown as byte*                    |
| **twemproxy.request\_bytes**(gauge)      | total request bytes*Shown as byte*                                        |
| **twemproxy.requests**(gauge)            | number of requests*Shown as request*                                      |
| **twemproxy.response\_bytes**(gauge)     | total response bytes*Shown as byte*                                       |
| **twemproxy.responses**(gauge)           | number of responses*Shown as response*                                    |
| **twemproxy.server\_connections**(gauge) | number of active server connections*Shown as connection*                  |
| **twemproxy.server\_ejects**(gauge)      | number of times backend server was ejected*Shown as event*                |
| **twemproxy.server\_eof**(gauge)         | number of eof on server connections*Shown as error*                       |
| **twemproxy.server\_err**(gauge)         | number of errors on server connections*Shown as error*                    |
| **twemproxy.server\_timedout**(gauge)    | number of timeouts on server connections*Shown as timeout*                |
| **twemproxy.total\_connections**(gauge)  | rate of new connections*Shown as connection*                              |

### Events{% #events %}

The Twemproxy check does not include any events.

### Service Checks{% #service-checks %}

**twemproxy.can\_connect**

Returns Critical if the Agent cannot send data to the Twemproxy endpoint, OK otherwise.

*Statuses: ok, critical*

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
