public String getServiceState(String serviceName) {
    if (isClientOnlyService(serviceName)) return "INSTALLED";
    Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
    if (serviceHostComponents != null) {

      for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
        String      hostName       = entry.getKey();
        Set<String> componentNames = entry.getValue();

        for (String componentName : componentNames) {
          if (isClientOnlyComponent(componentName)) continue;
          if (stateProvider.getRunningState(hostName, componentName) != StateProvider.State.Running) {
            return "INSTALLED";
          }
        }
      }
    }

    return "STARTED";
  }
Get the service state from the given service name.

@param serviceName  the service name

@return the service state
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java