I've done this for Cassandra. While there are tons of jmx metrics exposed for Cassandra, last I checked the recommended way of logging compaction times was to tail the log. I even have a little project that tails logs and sends timestamps and values to graphite based on regexp: