Library & Eventlistener for Supervisord to send events to Graphite

pip install sulphite==1.0.0



Sulphite is an event listener for Supervisor that sends events as generated by Supervisor to Graphite.

The idea behind this project is that events like restarts and backing off a continuously failing process may be recorded in the local logfile, but they'd be far more useful if overlayed with your other (Graphite) data like CPU usage, request per second increase or any other resource change.

Sulphite uses the Supervisor Events Framework and can listen and understand any events emitted.

Installing Sulphite

To install Sulphite, you can either clone this repository and run the install script:

$ git clone
$ cd sulphite
$ python install
# OR
$ pip install -r requirements.pip

Or you can install via pip using the Zip archive autogenerated by Github:

$ pip install

Configuring Sulphite

Sulphite should run as a Supervisor Event Listener. The simplest configuration that makes that work is this:


Sulphite currently only handles 'PROCESS_STATE` events, and safely ignores 'TICK' or 'PROCESS_COMMUNICATION' events. They don't seem useful to log as graphite events, but support for them may be added in the future.

Sulphite Options

You can get a list of the supported options for Sulphite by running it with -h:

$ sulphite -h
Usage: sulphite [options]

  -h, --help            show this help message and exit
                        Graphite server address
  -p GRAPHITE_PORT, --graphite-port=GRAPHITE_PORT
                        Graphite server port
                        Prefix all graphite events with this string
                        Suffix all graphite events with this string
                        Timeout connection to graphite (in seconds)
  -d, --debug           Enable debug output to STDERR

When configuring Sulphite, you may want to supply the --debug option to see what it's doing and then remove it when you run in production.

Sulphite Library

You can use Sulphite as a library as well and wrap your own logic around it's methods. It follows the convention of Python libraries and all the CLI options can be passed to the constructor.

import sulphite

object = Sulphite( ... )

Sulphite Events

Sulphite will generate graphite events for every 'PROCESS_STATE' change that is emitted by Supervisor. For example, if you start Sulphite with these options:

sulphite --graphite-prefix=events --graphite-suffix=`hostname -s`

And you were to restart the 'sample_service' managed by Supervisor, this is what would be sent to graphite:

events.sample_service.running.process_state_stopping.my_hostname 1 1355269824
events.sample_service.stopping.process_state_stopped.my_hostname 1 1355269824
events.sample_service.stopped.process_state_starting.my_hostname 1 1355269824
events.sample_service.starting.process_state_running.my_hostname 1 1355269825

As you can see, the format of the events is 'ServiceName.FromState.ToState', surrounded by the prefix & suffix we specified.

This also shows that a Supervisor restart is 4 distinct events:

  • running -> stopping
  • stopping -> stopped
  • stopped -> starting
  • starting -> started