Run the following query to generate a list of hosts (including their groups) without a defined host check:
SELECT e.name, eg.name from entity e, entity_group eg WHERE e.entity_group_id = eg.entity_group_id AND e.entity_id IN (select e.entity_id from entity e left join erdc_instance ei on e.entity_id = ei.entity_id and ei.is_host_check = 1 where ei.is_host_check is null)
Next, run the following query to generate a list of every service monitor attached to all the hosts that are currently without a host check:
SELECT e.entity_id, e.name, ei.erdc_instance_id, ei.name, ei.is_host_check FROM entity e, erdc_configuration ec, erdc_instance ei WHERE ei.configuration_id = ec.id and e.entity_id = ei.entity_id and e.entity_id IN (select e.entity_id from entity e left join erdc_instance ei on e.entity_id = ei.entity_id and ei.is_host_check = 1 where ei.is_host_check is null)
Because the second query lists every service monitor for each of these hosts, you will see the entity_id and the entity_name every time a service monitor is listed.
To update the host check for each of these hosts, use the output from the queries above to determine which service monitor you want as the host check for each particular host and then run the following update statement for each host:
UPDATE erdc_instance ei, entity e set ei.is_host_check = 'true' WHERE ei.erdc_instance_id = <the erdc_instance_id of the service monitor you want to set as the host check> AND e.entity_id = <the entity_id of the host you want to set the host check for>