Fix the TSD blacklisting logic.

Each time pick_connection() is called, we pop out a TSD from the list
of possible TSDs.  Each time blacklist(host, port) is called, we add
the TSD back to a list of blacklisted hosts.  This means that if we
don't *always* call blacklist(host, port) before disposing of the
current connection, then we will forget about that TSD forever.
Eventually tcollector will run out of TSDs to connect to, and
will exit.  We obviously don't want tcollector to exit, especially
when the machine is temporarily disconnected from the rest of the
world.

The blacklisting logic is changed here.  The list of TSDs is never
destructively changed.  Instead when a TSD is blacklisted, we add it
to a set.  We cycle through the list of hosts, checking the set each
time.  We could get away without using a set if we could guarantee
that each (host, port) could be specified twice, but we don't, and
specifying the same (host, port) more than once can be useful to do
some very rudimentary weight-based load balancing.  When we run out
of hosts to try, we clear the set and try again.

This closes #80.
Blacklist host when send fails, fixes error when only one TSD defined

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Don't die if we temporarily fail to resolve a DNS name.
Move copyright info to AUTHORS, and add a THANKS file.
Remove code duplication by introducing a utils library.

Until now collectors didn't really have a good way of sharing code.
We now setup PYTHONPATH so that Python modules under collectors/lib
and collectors/etc can easily be imported by individual collectors.
The most common code duplication was around dropping privileges, so
start by cleaning that up.
procstats.py: Collect interrupt statistics from /proc/interrupts

Collect per CPU interrupts statistics from /proc/interrupts.
Metric name: proc.interrupts
Interrupt types are classified per "type" tag.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Fix possible NameError in error handling.

Thanks to Filippo Giunchedi for catching this one in a review.
Reject timestamps that are unreasonably large.

Set an arbitrary threshold (some time in 2020) beyond which we don't
accept data points.  This is to help catch buggy collectors that
produce timestamps too far out in the future.  It would also have
helped in a recent issue where, in a virtualized environment, the
guest's clock jumped forward 40 years momentarily, and caused some
collectors to produce impossibly high timestamps that were stored
by tcollector, and caused tcollector to discard all subsequent data.
Add a collector to serve as a local UDP bridge.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Add a PostgreSQL collector.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
Add stats on methods used for TCP retransmits.
Add a config file for the UDP bridge collector.

By default the collector is disabled.
Remove unnecessary replacement of forward slash "/" to "_".

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>