Check if the Wazuh agent package is present or not.
Also, check the Wazuh manager service:
This indicates the agent service is installed but not able to start due to a conflict issue.
In this case, the Wazuh manager ossec.conf file will be replaced with the agent ossec.conf file.
Check if it has changed or not:
If you have added any custom configurations in your old Wazuh manager, run the above commands and check if they exist. If they are still there, take a backup of those custom files outside of the /var/ossec/ directory or copy them to another server.
Then first uninstall the Wazuh agent:
You can follow this Wazuh documentation for removing the agent from the Wazuh manager server.
Based on your server OS, run the correct uninstallation command from the documentation.
Also, if the Wazuh manager package exists, remove that as well:
This documentation is for installing Wazuh manager version 4.12.0. If you are using a different version, you need to change the documentation version at the top of the page and install the exact version of your old Wazuh manager.
After installing Wazuh manager, check if Filebeat is present or not:
If the Filebeat package is present, there is no need to install it again. You can skip all the steps up to the Wazuh indexer connection configuration section in the documentation.
Then follow the remaining steps from the Wazuh indexer connection configuration section.
After that, check if you are able to access the Wazuh dashboard again. If you are, then you can add the backed-up rules, decoder files, etc. to the Wazuh manager again manually.
Also, re-enroll the agents again.
I have tested this on my end and these steps worked for me to resolve the issue.