#173 Post metrics to local database to minimize CloudWatch API accesses

Many changes here, please review carefully.