Api and FQDN endpoint


#1

Hello,

I set all endpoints with fqdn even the master.
But when I try to check the configuration I have this error:

information/ApiListener: My API identity: bunny
critical/config: Error: Endpoint object for 'bunny' is missing.
Location: in /etc/icinga2/features-enabled/api.conf: 5:1-5:24
/etc/icinga2/features-enabled/api.conf(3):  */
/etc/icinga2/features-enabled/api.conf(4): 
/etc/icinga2/features-enabled/api.conf(5): object ApiListener "api" {
                                           ^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/features-enabled/api.conf(6):   cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"
/etc/icinga2/features-enabled/api.conf(7):   key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"

bunny is the short name of my VM. My endpoint name is bunny.domain

How can I set the API identity to the FQDN ? I tried to force the NodeName to FQDN in constants.conf, but it’s the same.

I’ve the same problem when I setup the API with:

icinga2 api setup

The certificate name is bunny.crt instead of bunny.domain.crt.

If I do:
hostname -f
it returns bunny.domain

If duplicate the endpoint bunny.domain with bunny, it works, but it’s ugly.

I’m missing something. A little help would be appreciate :slight_smile:


(Michael Friedrich) #2

Hi,

the CLI commands read the cached NodeName constant after a successful configuration validation. So if you’re changing the value in constants.conf, you’ll need to follow it with icinga2 daemon -C and then icinga2 api setup. If NodeName is blank (or commented out), the CLI command attempts to resolve the local hostname which likely is set wrong in /etc/hosts.

Can you share the content of constants.conf and likewise the output of icinga2 variable get NodeName?

And which icinga2 --version is involved here?

Cheers,
Michael