Integration with Graphite/Carbon
================================

`Graphite <http://graphite.wikidot.com/>`_ is a kick-ass realtime graphing
application built on top of three components: 

- Whisper -- a data storage system
- Carbon -- a server for receiving data
- Python web application for graph rendering and management.

The uWSGI Carbon plugin allows you to send uWSGI's internal statistics to one
or more Carbon servers.  It is compiled in by default as of uWSGI 1.0, though
it can also be built as a plugin.

Quickstart
----------

For the sake of illustration, let's say your Carbon server is listening on
``127.0.0.1:2003`` and your uWSGI instance is on the machine ``debian32``,
listening on ``127.0.0.1:3031`` with 4 processes.  By adding the ``--carbon``
option to your uWSGI instance you'll instruct it to send its statistics to
the Carbon server periodically. The default period is 60 seconds.

.. code-block:: sh

    uwsgi --socket 127.0.0.1:3031 --carbon 127.0.0.1:2003 --processes 4 

Metrics are named like ``uwsgi.<hostname>.<id>.requests`` and
``uwsgi.<hostname>.<id>.worker<n>.requests``, where:

* ``hostname`` -- machine's hostname
* ``id`` -- name of the first uWSGI socket (with dots replaced by underscores)
* ``n`` -- number of the worker processes (1-based).

Examples of names of Carbon metrics generated by uWSGI:

* ``uwsgi.debian32.127_0_0_1:3031.requests``
  (``uwsgi.<hostname>.<id>.requests``)
* ``uwsgi.debian32.127_0_0_1:3031.worker1.requests``
  (``uwsgi.<hostname>.<id>.worker<n>.requests``)
* ``uwsgi.debian32.127_0_0_1:3031.worker2.requests``
  (``uwsgi.<hostname>.<id>.worker<n>.requests``)
* ``uwsgi.debian32.127_0_0_1:3031.worker3.requests``
  (``uwsgi.<hostname>.<id>.worker<n>.requests``)
* ``uwsgi.debian32.127_0_0_1:3031.worker4.requests``
  (``uwsgi.<hostname>.<id>.worker<n>.requests``).

.. seealso:: :doc:`tutorials/GraphiteAndMetrics`

