Need to know how to change hostname of the icinga2 server

Hello there,

Can some give me directions for changing the hostname of the icinga2 server?

Thanks & regards,
Balaji.

Hi Balaji,

Is this server a master/satellite node or a standalone host?

Hi Balaji,

if this is a master server then you have to change the hostname in the following files and generate a new certificate.

/etc/icinga2/constants.conf
/etc/icinga2/zones.conf // Needs to be changed on every server that is connected to the zone of the server.
/etc/icinga2/zones.d/zone-name/your-server.conf

Generate a new certificate:
icinga2 pki new-cert --cn server.fqdn --key /etc/icinga2/pki/server.fqdn.key --csr /etc/icinga2/pki/server.fqdn.csr --cert /etc/icinga2/pki/server.fqdn.crt
icinga2 pki sign-csr --csr /etc/icinga2/pki/server.fqdn.csr --cert /etc/icinga2/pki/server.fqdn.crt
cp /etc/icinga2/pki/server.fqdn.* /var/lib/icinga2/certs/
chown nagios: /var/lib/icinga2/certs/server.fqdn.*

Hi Liam,

It is a standalone host.

Thanks & regards,
Balaji.

Hi Martin,

Thank you, will try and update you.

Thanks & regards,
Balaji.

Hi Martin,

It did not work, could you please provide the steps for a standalone host?

Thanks & regards,
Balaji.

Hi Balaji,

I don’t think there is a difference between a standalone server and a master server for this todo.

What exactly did not work? Please provide some logs.

Best regards,
Martin

Hi Martin,

I found the certs are in /var/lib/icinga2/certs not in /etc/icinga2/pki in my icinga installation.
I used the path /var/lib/icinga2/certs and generated the certificates and it worked fine.

Thank you for the help.

-Balaji.