static Map<Long, ConfigGroup> collectConfigGroupsWithoutServiceName() {
    Map<Long, ConfigGroup> configGroupMap = new HashMap<>();
    Clusters clusters = injector.getInstance(Clusters.class);
    Map<String, Cluster> clusterMap = clusters.getClusters();

    if (MapUtils.isEmpty(clusterMap))
      return configGroupMap;

    for (Cluster cluster : clusterMap.values()) {
      Map<Long, ConfigGroup> configGroups = cluster.getConfigGroups();

      if (MapUtils.isEmpty(configGroups)) {
        continue;
      }

      for (ConfigGroup configGroup : configGroups.values()) {
        if (StringUtils.isEmpty(configGroup.getServiceName())) {
          configGroupMap.put(configGroup.getId(), configGroup);
        }
      }
    }

    return configGroupMap;
  }
This method collects the ConfigGroups with empty or null service name field
ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java