Hi all, I know this thread is a bit old, but it might be useful for someone else. I ran in the same problem, in my case I installed the ambari agents manually, so I skipped the set of the agents through the ambari-server.
I noticed the ambari-agent logs and I found that the agent was trying to register itself with localhost, so I edited the file:
/etc/ambari-agent/conf/ambari-agent.ini
And I set the field:
[server]
hostname=XXX
To point to my ambari server, I restarted the agents and then it worked.