Statistics server which sends data to Graphite.
Install Statsite from PyPi:
pip install statsite
Or download and install from source:
python setup.py install
Statsite preferably should be configured using a file, although all configuration parameters can be set via the command line as well. Here is an example configuration file:
# Settings for the "collector" which is the UDP listener [collector] host = 0.0.0.0 port = 8125 # Specify settings for the metrics "store" which is where graphite is [store] host = 0.0.0.0 port = 2003
Then run statsite, pointing it to that file (assuming /etc right now):
statsite -c /etc/statsite.conf
By default, Statsite will listen for UDP packets, which makes it extremely cheap for your application to fire and forget packets to the server. A message looks like the following (where the flag is optional):
Messages should be separated by newlines (n) if multiple are sent in the same packet.
Currently supported message types:
The following is a simple key/value pair, in this case reporting how many queries we’ve seen in the last second on MySQL:
The following is a timer, timing the response speed of an API call:
The following is another timer, but this time saying we sample this data in 1/10th of the API requests.
The next example is increments the “rewards” counter by 1:
And this example decrements the “inventory” counter by 7:
As said earlier, multiple messages can be joined together by newlines.