Symptoms:
One of your pollers / collectors has been deleted and your hosts are now orphaned.
Solutions :
When a poller is deleted by mistake, we recommend that you take the following steps:
Check that orphaned hosts are returned via this query (initially attached to the deleted poller)
mysql -e "select host_id,host_name from centreon.host where host_register='1' and host.host_id not in (select host_host_id from centreon.ns_host_relation);"
If yes, you can continue the procedure.
If not, please contact our Customer Care department with a new ticket.
Find out the ID of the poller you've created (to replace the old one) :
mysql -e “select id from centreon.nagios_server where ns_ip_address = ‘ip_du_nouveau_poller’;”
Or via the interface :
- Create the script as shown below (be careful to fill in these 3 parts VOTREUSER VOTREPASSWORD id_du_nouveau_poller)
vi attachehoteservice.sh
#!/bin/bash
host_id=`mysql -u VOTREUSER -pVOTREPASSWORD centreon --skip-column-names --execute="select host_id from host where host_register='1' and host.host_id not in (select host_host_id from ns_host_relation);"`
while read line;do
mysql -u VOTREUSER -pVOTREPASSWORD centreon --execute="insert into ns_host_relation (nagios_server_id,host_host_id) values('id_du_nouveau_poller', '$line');"
done <<< "$host_id"
Save&Quit
- Add execution rights :
chmod +x attachehoteservice.sh
- Then run it:
sh attachehoteservice.sh
Or
./attachehoteservice.sh
This should attach all orphaned hosts to your new poller.
Then you can export the poller + host configuration and the problem should be solved.