fix import
rename messages -> commands
schedule writing and resetting the metrics
set correct mode on the metrics file
add the metrics file to the confguration