Rename Icinga 2 hosts / services

Hi folks,

I’m looking for a possibility to rename hosts and services in Icinga 2 without losing their state history.
If I rename a host in my config files, a new one will be created with an empty state history.

I guess it would be pretty unsafe to modify the object_id colum in the relevant tables (icinga_commenthistory, icinga_comments, icinga_downtimehistory, icinga_flappinghistory, icinga_statehistory)?

Is there a preferred method to achieve this?

I know that there are other things to consider (e.g. naming of InfluxDB measurements), but as of now, I’m only concerned about the Icinga 2 side of things.


Would setting the “display_name” attribute for your host and service
definitions achieve what you want?

That leaves the objects themselves still with the same name (and therefore
ID), but anywhere they’re displayed (for example in Icingaweb2), they’ll have
the alternative names.

Maybe that helps?


Hi Anthony,

thanks alot for your suggestion with setting the display_name.

Unfortunately I’m looking for a “true” rename, since we would like to implement a consistent naming scheme and want to align all currently existing objects to that scheme.

I would like to reserve the display name for cases where someone needs to find a host / service by a completely different alias, if that makes sense :slight_smile:

There is no preferred or even suported mode. I’d test these steps in a temporary environment:

  1. stop icinga2
  2. delete /var/lib/icinga2/icinga2.state
  3. change conf files
  4. update coresponding entries in icinga_objects table (hostname is in colum name1)
  5. start icinga2

You could try using the Director mode with {icingacli}; don’t know if that also nixes the state histories. This is assuming you are using the Director module in Icinga2 at all.