@Override public CollectionSet collect(CollectionAgent agent, Map<String, Object> parameters) throws CollectionException { LOG.debug("collect({}, {}, {})", agent, parameters); final WsmanAgentConfig config = (WsmanAgentConfig)parameters.get(WSMAN_AGENT_CONFIG_KEY); final Groups groups = (Groups)parameters.get(WSMAN_GROUPS_KEY); final WSManEndpoint endpoint = WSManConfigDao.getEndpoint(config, agent.getAddress()); final WSManClient client = m_factory.getClient(endpoint); final CollectionSetBuilder collectionSetBuilder = new CollectionSetBuilder(agent); if (LOG.isDebugEnabled()) { String groupNames = groups.getGroups().stream().map(Group::getName).collect(Collectors.joining(", ")); LOG.debug("Collecting attributes on {} from groups: {}", agent, groupNames); } for (Group group : groups.getGroups()) { try { collectGroupUsing(group, agent, client, config.getRetry() != null ? config.getRetry() : 0, collectionSetBuilder); } catch (InvalidResourceURI e) { LOG.info("Resource URI {} in group named {} is not available on {}.", group.getResourceUri(), group.getName(), agent); } catch (WSManException e) { // If collecting any individual group fails, mark the collection set as // failed, and abort trying to collect any other groups throw new CollectionException(String.format("Collecting group '%s' on %s failed with '%s'. See logs for details.", group.getName(), agent, e.getMessage()), e); } } return collectionSetBuilder.build(); }
@Override public CollectionSet collect(CollectionAgent agent, Map<String, Object> parameters) throws CollectionException { LOG.debug("collect({}, {}, {})", agent, parameters); final WsmanAgentConfig config = (WsmanAgentConfig)parameters.get(WSMAN_AGENT_CONFIG_KEY); final Groups groups = (Groups)parameters.get(WSMAN_GROUPS_KEY); final WSManEndpoint endpoint = WSManConfigDao.getEndpoint(config, agent.getAddress()); final WSManClient client = m_factory.getClient(endpoint); final CollectionSetBuilder collectionSetBuilder = new CollectionSetBuilder(agent); if (LOG.isDebugEnabled()) { String groupNames = groups.getGroups().stream().map(Group::getName).collect(Collectors.joining(", ")); LOG.debug("Collecting attributes on {} from groups: {}", agent, groupNames); } for (Group group : groups.getGroups()) { try { collectGroupUsing(group, agent, client, config.getRetry() != null ? config.getRetry() : 0, collectionSetBuilder); } catch (InvalidResourceURI e) { LOG.info("Resource URI {} in group named {} is not available on {}.", group.getResourceUri(), group.getName(), agent); } catch (WSManException e) { // If collecting any individual group fails, mark the collection set as // failed, and abort trying to collect any other groups throw new CollectionException(String.format("Collecting group '%s' on %s failed with '%s'. See logs for details.", group.getName(), agent, e.getMessage()), e); } } return collectionSetBuilder.build(); }
return PollStatus.down(e.getMessage());
return PollStatus.down(e.getMessage());