The problem may be due to the connection being lost, so after 5 failed reconnection attempts the agent tries to register again.
This can be avoided by modifying the enrrollment block of the agent's /var/ossec/etc/ossec.conf
file with the agent name you need it to have:agent-enrollment documentationagent-name reference
If you want to register them again with the previous names, you can configure the force block of the manager's /var/ossec/etc/ossec.conf
I hope this solves your need. Let me know if you need anything else!