add mysql database monitoring and refactoring