---
title: Gnatsd
description: Monitor gnatsd cluster with Datadog.
breadcrumbs: Docs > Integrations > Gnatsd
---

# Gnatsd
Supported OS Integration version2.0.0
## Overview{% #overview %}

Get metrics from Gnatsd service in real time to:

- Visualize and monitor Gnatsd states
- Be notified about Gnatsd failovers and events.

## Setup{% #setup %}

The Gnatsd check is not included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package, so you need to install it.

### Installation{% #installation %}

For Agent v7.21+ / v6.21+, follow the instructions below to install the Gnatsd check on your host. See [Use Community Integrations](https://docs.datadoghq.com/agent/guide/use-community-integrations/) to install with the Docker Agent or earlier versions of the Agent.

1. Run the following command to install the Agent integration:

   ```shell
   datadog-agent integration install -t datadog-gnatsd==<INTEGRATION_VERSION>
   ```

1. Configure your integration similar to core [integrations](https://docs.datadoghq.com/getting_started/integrations/).

### Configuration{% #configuration %}

1. Edit the `gnatsd.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) to start collecting your Gnatsd metrics. See the [sample gnatsd.d/conf.yaml](https://github.com/DataDog/integrations-extras/blob/master/gnatsd/datadog_checks/gnatsd/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)

### Validation{% #validation %}

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

## Compatibility{% #compatibility %}

The gnatsd check is compatible with all major platforms

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

### Metrics{% #metrics %}

|  |
|  |
| **gnatsd.connz.connections.in\_bytes**(count)      | The number of bytes incoming*Shown as byte*                         |
| **gnatsd.connz.connections.in\_msgs**(count)       | The number of messages received*Shown as unit*                      |
| **gnatsd.connz.connections.out\_bytes**(count)     | The number of bytes outgoing*Shown as byte*                         |
| **gnatsd.connz.connections.out\_msgs**(count)      | The number of messages sent*Shown as unit*                          |
| **gnatsd.connz.connections.pending\_bytes**(gauge) | The number of bytes pending ack on a subscription*Shown as unit*    |
| **gnatsd.connz.connections.subscriptions**(gauge)  | The number of subscriptions on a connection*Shown as unit*          |
| **gnatsd.connz.num\_connections**(gauge)           | The number of current connections to the NATS broker*Shown as unit* |
| **gnatsd.connz.total**(count)                      | The number of connections ever to the NATS broker*Shown as unit*    |
| **gnatsd.routez.num\_routes**(gauge)               | The number of routes in the cluster*Shown as unit*                  |
| **gnatsd.routez.routes.in\_bytes**(count)          | The number of bytes incoming*Shown as byte*                         |
| **gnatsd.routez.routes.in\_msgs**(count)           | The number of messages received*Shown as unit*                      |
| **gnatsd.routez.routes.out\_bytes**(count)         | The number of bytes outgoing*Shown as byte*                         |
| **gnatsd.routez.routes.out\_msgs**(count)          | The number of messages sent*Shown as unit*                          |
| **gnatsd.routez.routes.pending\_bytes**(gauge)     | The number of bytes pending*Shown as unit*                          |
| **gnatsd.routez.routes.subscriptions**(gauge)      | The number of subscriptions on a connection*Shown as unit*          |
| **gnatsd.varz.connections**(gauge)                 | The number of connections to the NATS broker*Shown as unit*         |
| **gnatsd.varz.in\_bytes**(count)                   | Amount of traffic sent into the cluster*Shown as byte*              |
| **gnatsd.varz.in\_msgs**(count)                    | The number of messages passed into the cluster*Shown as unit*       |
| **gnatsd.varz.mem**(gauge)                         | Amount of memory currently used by the process*Shown as byte*       |
| **gnatsd.varz.out\_bytes**(count)                  | Amount of traffic sent from the cluster*Shown as byte*              |
| **gnatsd.varz.out\_msg**(count)                    | The number of messages sent out of the cluster*Shown as unit*       |
| **gnatsd.varz.remotes**(gauge)                     | The number of currently connected remotes*Shown as unit*            |
| **gnatsd.varz.routes**(gauge)                      | The number of current routes*Shown as unit*                         |
| **gnatsd.varz.slow\_consumers**(count)             | The number of slow consumers ever connected*Shown as unit*          |
| **gnatsd.varz.subscriptions**(gauge)               | The number of subscriptions currently handled*Shown as unit*        |

**Note**: If you use custom Nats cluster names, your metrics may look like this: `gnatsd.connz.connections.cluster_name.in_msgs`

### Events{% #events %}

The gnatsd check does not include any events.

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

**gnatsd.can\_connect**

Returns `CRITICAL` if the Agent can't connect to the Gnastd endpoint, OK otherwise

*Statuses: ok, critical*

## Troubleshooting{% #troubleshooting %}

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