]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commit
stats: add a simple stats gathering system
authorrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 31 Jan 2008 03:11:07 +0000 (20:11 -0700)
committerrobk-tahoe <robk-tahoe@allmydata.com>
Thu, 31 Jan 2008 03:11:07 +0000 (20:11 -0700)
commit7b9f3207d0447cf2a371d8a72ea3ed5ee167e9a9
treed65a5c6e70237d8f04e8574b6344c954cda62035
parent22071c00e0ebc7df4ca6385c628095cbce3e24b5
stats: add a simple stats gathering system

We have a desire to collect runtime statistics from multiple nodes primarily
for server monitoring purposes.   This implements a simple implementation of
such a system, as a skeleton to build more sophistication upon.

Each client now looks for a 'stats_gatherer.furl' config file.  If it has
been configured to use a stats gatherer, then it instantiates internally
a StatsProvider.  This is a central place for code which wishes to offer
stats up for monitoring to report them to, either by calling
stats_provider.count('stat.name', value) to increment a counter, or by
registering a class as a stats producer with sp.register_producer(obj).

The StatsProvider connects to the StatsGatherer server and provides its
provider upon startup.  The StatsGatherer is then responsible for polling
the attached providers periodically to retrieve the data provided.
The provider queries each registered producer when the gatherer queries
the provider.  Both the internal 'counters' and the queried 'stats' are
then reported to the gatherer.

This provides a simple gatherer app, (c.f. make stats-gatherer-run)
which prints its furl and listens for incoming connections.  Once a
minute, the gatherer polls all connected providers, and writes the
retrieved data into a pickle file.

Also included is a munin plugin which knows how to read the gatherer's
stats.pickle and output data munin can interpret.  this plugin,
tahoe-stats.py can be symlinked as multiple different names within
munin's 'plugins' directory, and inspects argv to determine which
data to display, doing a lookup in a table within that file.
It looks in the environment for 'statsfile' to determine the path to
the gatherer's stats.pickle.  An example plugins-conf.d file is
provided.
Makefile
misc/munin/tahoe-stats.plugin-conf [new file with mode: 0644]
misc/munin/tahoe-stats.py [new file with mode: 0644]
src/allmydata/client.py
src/allmydata/interfaces.py
src/allmydata/stats.py [new file with mode: 0644]
src/allmydata/storage.py