remove agent by ip
refactoring