Page 1 of 1

host host_id

Posted: Wed Dec 19, 2018 8:23 am
by elinagios
Hi

we have a system that gets nagiosxi hosts and services via NagiosXI Rest API. The system uses host ID as primary identifier. Now the problem is that when you change hostname, the ID changes. Is it possible to somehow get the previous ID with the API?

Regards,
Mirgo

Re: host host_id

Posted: Wed Dec 19, 2018 4:02 pm
by npolovenko
Hello, @elinagios. Nagios doesn't keep track of object IDs in the rest API. Is there a particular reason why you can't use a hostname as the identifier?

Re: host host_id

Posted: Thu Dec 20, 2018 8:37 am
by elinagios
You can use, we have a external system that gets Nagios hosts and services via API and we put comments to those services/hosts. Once we change hostname in Nagios XI, it creates a new host+services to our external system and all the comments stay with the old host/service.

Re: host host_id

Posted: Thu Dec 20, 2018 11:34 am
by lmiltchev
As @npolovenko mentioned, there is no way to track the old object ID in the REST API. However, you could track some other attributes instead. Why not adding the "original" id into the host's notes. Then you could use it as a primary identifier (as it won't change after changing the host name), provided you don't put your comments for these services/hosts in notes.

CCM > Hosts > <your host> Misc Settings > Notes
CCM > Services > <your service> Misc Settings > Notes