# RabbitMQ Management HTTP Stats

## Introduction

Most of the GET requests you can issue to the HTTP API return JSON objects with a large number of keys. While a few of these keys represent things you set yourself in a PUT request or AMQP command (e.g. queue durability or arguments), most of them represent statistics to do with the object in question. This page attempts to document them.

It should be read in conjunction with the manual page for `rabbitmqctl` (see your installation if on Unix / Linux, or the RabbitMQ website for the latest version). Any field which can be returned by a command of the form `rabbitmqctl list_something` will also be returned in the equivalent part of the HTTP API, so all those keys are not documented here. However, the HTTP API also adds a lot of extra fields which are not available in `rabbitmqctl`.

## _details objects

Many fields represent a count of some kind: queue length, messages acknowledged, bytes received and so on. Such absolute counts returned by the HTTP API will often have a corresponding `_details` object which offers information on how this count has changed. So for example, from a queue:

        "messages": 123619,
        "messages_details": {
          "avg": 41206.333333333336,
          "avg_rate": 1030.1583333333333,
          "rate": 24723.8,
          "samples": [
            {
              "sample": 123619,
              "timestamp": 1400680560000
            },
            {
              "sample": 0,
              "timestamp": 1400680500000
            },
            {
              "sample": 0,
              "timestamp": 1400680440000
            }
          ]
        }

Here we have a `messages` count (the total messages in the queue), with some additional data:

`avg` | The average value for the requested time period (see below).
`avg_rate` | The average rate for the requested time period.
`rate` | How much the count has changed per second in the most recent sampling interval.
`samples` | Snapshots showing how the value has changed over the requested time period.

`avg`, `avg_rate` and `samples` will only appear if you request a specific time period by appending query parameters to the URL. To do this you need to set an age and an increment for the samples you want. The end of the range returned will always correspond to the present.

Different types of data take different query parameters to return samples, as in the following table. You can specify more than one set of parameters if the resource you are requesting can generate more than one type of sample (for example, queues can return message rates and queue lengths).

Messages sent and received | `msg_rates_age` / `msg_rates_incr`
Bytes sent and received | `data_rates_age` / `data_rates_incr`
Queue lengths | `lengths_age` / `lengths_incr`
Node statistics (e.g. file descriptors, disk space free) | `node_stats_age` / `node_stats_incr`

For example, appending `?lengths_age=3600&lengths_incr=60` will return the last hour's data on queue lengths, with a sample for every minute.

## message_stats objects

Many objects (including queues, exchanges and channels) will return counts of messages passing through them. These are included in a `message_stats` object (which in turn will contain `_details` objects for each count, as described above).

These can contain:

`publish` | Count of messages published.
`publish_in` | Count of messages published "in" to an exchange, i.e. not taking account of routing.
`publish_out` | Count of messages published "out" of an exchange, i.e. taking account of routing.
`confirm` | Count of messages confirmed.
`deliver` | Count of messages delivered in acknowledgement mode to consumers.
`deliver_noack` | Count of messages delivered in no-acknowledgement mode to consumers.
`get` | Count of messages delivered in acknowledgement mode in response to basic.get.
`get_noack` | Count of messages delivered in no-acknowledgement mode in response to basic.get.
`deliver_get` | Sum of all four of the above.
`redeliver` | Count of subset of messages in `deliver_get` which had the redelivered flag set.
`return` | Count of messages returned to publisher as unroutable.

Only fields for which some activity has taken place will appear.

## Detailed message stats objects

In addition, queues, exchanges and channels can return a breakdown of message stats for each of their neighbours (i.e. adjacent objects in the chain: channel -> exchange -> queue -> channel). This will only happen if the `rates_mode` configuration item has been switched to `detailed` from its default of `basic`.

As this possibly constitutes a large quantity of data, it is also only returned when querying a single channel, queue or exchange rather than a list. Note also that the default sample retention policy means that these detailed message stats do not retain historical data for more than a few seconds.

The detailed message stats objects have different names depending on where they are (documented below). Each set of detailed stats consists of a list of objects with two fields, one identifying the partner object and one `stats` which is a message_stats object as described above.

For example, from a queue:

      "incoming": [
        {
          "stats": {
            "publish": 352593,
            "publish_details": {
              "rate": 100.2
            }
          },
          "exchange": {
            "name": "my-exchange",
            "vhost": "/"
          }
        }
        {
          "stats": {
            "publish": 543784,
            "publish_details": {
              "rate": 54.6
            }
          },
          "exchange": {
            "name": "amq.topic",
            "vhost": "/"
          }
        }
      ],

This queue is currently receiving messages from two exchanges: 100.2 msg/s from "my-exchange" and 54.6 msg/s from "amq.topic".

## /api/overview

This has the following fields:

`cluster_name` | The name of the entire cluster, as set with `rabbitmqctl set_cluster_name`.
`contexts` | A list of web application contexts in the cluster.
`erlang_full_version` | A string with extended detail about the Erlang VM and how it was compiled, for the node connected to.
`erlang_version` | A string with the Erlang version of the node connected to. As clusters should all run the same version this can be taken as representing the cluster.
`exchange_types` | A list of all exchange types available.
`listeners` | All (non-HTTP) network listeners for all nodes in the cluster. (See `contexts` in `/api/nodes` for HTTP).
`management_version` | Version of the management plugin in use.
`message_stats` | A message_stats object for everything the user can see - for all vhosts regardless of permissions in the case of `monitoring` and `administrator` users, and for all vhosts the user has access to for other users.
`node` | The name of the cluster node this management plugin instance is running on.
`object_totals` | An object containing global counts of all connections, channels, exchanges, queues and consumers, subject to the same visibility rules as for `message_stats`.
`queue_totals` | An object containing sums of the `messages`, `messages_ready` and `messages_unacknowledged` fields for all queues, again subject to the same visibility rules as for `message_stats`.
`rabbitmq_version` | Version of RabbitMQ on the node which processed this request.
`rates_mode` | 'none', 'basic' or 'detailed'.
`statistics_db_event_queue` | Number of outstanding statistics events yet to be processed by the database.
`statistics_db_node` | Name of the cluster node hosting the management statistics database.

## /api/nodes

This has the following fields:

`applications` | List of all Erlang applications running on the node.
`auth_mechanisms` | List of all SASL authentication mechanisms installed on the node.
`cluster_links` | A list of the other nodes in the cluster. For each node, there are details of the TCP connection used to connect to it and statistics on data that has been transferred.
`config_files` | List of config files read by the node.
`contexts` | List of all HTTP listeners on the node.
`db_dir` | Location of the persistent storage used by the node.
`disk_free` | Disk free space in bytes.
`disk_free_alarm` | Whether the disk alarm has gone off.
`disk_free_limit` | Point at which the disk alarm will go off.
`enabled_plugins` | List of plugins which are both explicitly enabled and running.
`exchange_types` | Exchange types available on the node.
`fd_total` | File descriptors available.
`fd_used` | Used file descriptors.
`io_read_avg_time` | Average wall time (milliseconds) for each disk read operation in the last statistics interval.
`io_read_bytes` | Total number of bytes read from disk by the persister.
`io_read_count` | Total number of read operations by the persister.
`io_reopen_count` | Total number of times the persister has needed to recycle file handles between queues. In an ideal world this number will be zero; if the number is large, performance might be improved by increasing the number of file handles available to RabbitMQ.
`io_seek_avg_time` | Average wall time (milliseconds) for each seek operation in the last statistics interval.
`io_seek_count` | Total number of seek operations by the persister.
`io_sync_avg_time` | Average wall time (milliseconds) for each fsync() operation in the last statistics interval.
`io_sync_count` | Total number of fsync() operations by the persister.
`io_write_avg_time` | Average wall time (milliseconds) for each disk write operation in the last statistics interval.
`io_write_bytes` | Total number of bytes written to disk by the persister.
`io_write_count` | Total number of write operations by the persister.
`log_file` | Location of main log file.
`mem_used` | Memory used in bytes.
`mem_alarm` | Whether the memory alarm has gone off.
`mem_limit` | Point at which the memory alarm will go off.
`mnesia_disk_tx_count` | Number of Mnesia transactions which have been performed that required writes to disk. (e.g. creating a durable queue). Only transactions which originated on this node are included.
`mnesia_ram_tx_count` | Number of Mnesia transactions which have been performed that did not require writes to disk. (e.g. creating a transient queue). Only transactions which originated on this node are included.
`msg_store_read_count` | Number of messages which have been read from the message store.
`msg_store_write_count` | Number of messages which have been written to the message store.
`name` | Node name.
`net_ticktime` | Current kernel net_ticktime setting for the node.
`os_pid` | Process identifier for the Operating System under which this node is running.
`partitions` | List of network partitions this node is seeing.
`proc_total` | Maximum number of Erlang processes.
`proc_used` | Number of Erlang processes in use.
`processors` | Number of cores detected and usable by Erlang.
`queue_index_journal_write_count` | Number of records written to the queue index journal. Each record represents a message being published to a queue, being delivered from a queue, and being acknowledged in a queue.
`queue_index_read_count` | Number of records read from the queue index.
`queue_index_write_count` | Number of records written to the queue index.
`rates_mode` | 'none', 'basic' or 'detailed'.
`run_queue` | Average number of Erlang processes waiting to run.
`running` | Boolean for whether this node is up. Obviously if this is false, most other stats will be missing.
`sasl_log_file` | Location of sasl log file.
`sockets_total` | File descriptors available for use as sockets.
`sockets_used` | File descriptors used as sockets.
`type` | 'disc' or 'ram'.
`uptime` | Time since the Erlang VM started, in milliseconds.

## /api/nodes/(name)

All of the above, plus:

`memory` | Detailed memory use statistics. Only appears if `?memory=true` is appended to the URL.
`binary` | Detailed breakdown of the owners of binary memory. Only appears if `?binary=true` is appended to the URL. Note that this can be an expensive query if there are many small binaries in the system.

## /api/connections

## /api/connections/(name)

See documentation for `rabbitmqctl list_connections`. No additional fields, although `pid` is replaced by `node`.

Note also that while non-AMQP connections will appear in this list (unlike `rabbitmqctl list_connections`), they will omit many of the connection-level statistics.

## /api/connections/(name)/channels

## /api/channels

See documentation for `rabbitmqctl list_channels`, with `pid` replaced by `node`, plus:

`connection_details` | Some basic details about the owning connection.
`message_stats` | See the section on message_stats above.

## /api/channels/(name)

All the above, plus

`publishes` | Detailed message stats (see section above) for publishes to exchanges.
`deliveries` | Detailed message stats for deliveries from queues.
`consumer_details` | List of consumers on this channel, with some details on each.

## /api/exchanges

## /api/exchanges/(vhost)

See documentation for `rabbitmqctl list_exchanges`, plus:

`message_stats` | See the section on message_stats above.

## /api/exchanges/(vhost)/(name)

All the above, plus:

`incoming` | Detailed message stats (see section above) for publishes from channels into this exchange.
`outgoing` | Detailed message stats for publishes from this exchange into queues.

## /api/queues

## /api/queues/(vhost)

See documentation for `rabbitmqctl list_queues`, with all references to `pid`s replaced by `node`s plus:

`message_stats` | See the section on message_stats above.

## /api/queues/(vhost)/(name)

All the above, plus:

`incoming` | Detailed message stats (see section above) for publishes from exchanges into this queue.
`deliveries` | Detailed message stats for deliveries from this queue into channels.
`consumer_details` | List of consumers on this channel, with some details on each.

## /api/vhosts/

## /api/vhosts/(name)

All the fields from `rabbitmqctl list_vhosts` (i.e. `name` and `tracing`) plus:

`message_stats` | Global message_stats for this vhost. Note that activity for other users in this vhost is shown, even for users without the `monitoring` tag.
`messages` `messages_ready` `messages_acknowledged` | Sum of these fields for all queues in the vhost.
`recv_oct` `send_oct` | Sum of these fields for all connections to the vhost.