Collectd: Handle counter wrapping

Handle the wrapping of a COUNTER metric at 32 or 64 bits.

Contains relevant tests.