refactor heartbeat module, add user defined rule type