Director installation on icinga host error

Hello Guys,
I have recently started working on integrating director module on my Icinga host.
I have followed the steps in the documentation on director and at the point of configuring director in the web interface(after database was created) i get the following error:i found no endpoint object called hostname on hostname:5665
When i run icinga2 object list --type Endpoint i do see that the endpoint is recognized and on chrome i do get access to this endpoint’s api.
Would like to get your help on this one.

Thanks in advance,

You need to have the hostname as defined in the constants.conf also be the hostname defiend in the /etc/hostname and /etc/hosts

They Are Identical.
The problem solved and it was that there was a leftover of previous director installation that conflicted the new config.
After it has been deleted the installation proceeded as normal
Thanks for the quick reply