public DetectResults isServiceDetected(InetAddress address, WSManEndpoint endpoint) { // Issue the query! List<Node> nodes = Lists.newLinkedList(); final WSManClient client = m_factory.getClient(endpoint); try { LOG.debug("Issuing an ENUM on '{}' with query '{}'", resourceUri, wql); client.enumerateAndPullUsingFilter(resourceUri, WSManConstants.XML_NS_WQL_DIALECT, wql, nodes, true); } catch (WSManException e) { LOG.debug("ENUM failed for address '{}' with endpoint '{}', resourceUri '{}', query '{}'", address, endpoint, resourceUri, wql, e); } return new DetectResultsImpl(nodes.size() > 0); }
public DetectResults isServiceDetected(InetAddress address, WSManEndpoint endpoint) { // Issue the query! List<Node> nodes = Lists.newLinkedList(); final WSManClient client = m_factory.getClient(endpoint); try { LOG.debug("Issuing an ENUM on '{}' with query '{}'", resourceUri, wql); client.enumerateAndPullUsingFilter(resourceUri, WSManConstants.XML_NS_WQL_DIALECT, wql, nodes, true); } catch (WSManException e) { LOG.debug("ENUM failed for address '{}' with endpoint '{}', resourceUri '{}', query '{}'", address, endpoint, resourceUri, wql, e); } return new DetectResultsImpl(nodes.size() > 0); }
public DetectResults isServiceDetected(InetAddress address, WSManEndpoint endpoint) { // Issue the "Identify" request final WSManClient client = m_factory.getClient(endpoint); Identity identity = null; final Map<String, String> attributes = new HashMap<>(); try { identity = client.identify(); LOG.info("Identify succeeded for address {} with product vendor '{}' and product version '{}'.", address, identity.getProductVendor(), identity.getProductVersion()); attributes.put(UPDATE_ASSETS, Boolean.toString(m_updateAssets)); attributes.put(PRODUCT_VENDOR, identity.getProductVendor()); attributes.put(PRODUCT_VERSION, identity.getProductVersion()); } catch (WSManException e) { LOG.info("Identify failed for address {} with endpoint {}.", address, endpoint, e); } return new DetectResultsImpl(identity != null, attributes); }
public DetectResults isServiceDetected(InetAddress address, WSManEndpoint endpoint) { // Issue the "Identify" request final WSManClient client = m_factory.getClient(endpoint); Identity identity = null; final Map<String, String> attributes = new HashMap<>(); try { identity = client.identify(); LOG.info("Identify succeeded for address {} with product vendor '{}' and product version '{}'.", address, identity.getProductVendor(), identity.getProductVersion()); attributes.put(UPDATE_ASSETS, Boolean.toString(m_updateAssets)); attributes.put(PRODUCT_VENDOR, identity.getProductVendor()); attributes.put(PRODUCT_VERSION, identity.getProductVersion()); } catch (WSManException e) { LOG.info("Identify failed for address {} with endpoint {}.", address, endpoint, e); } return new DetectResultsImpl(identity != null, attributes); }
@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(); }
final WSManClient client = m_factory.getClient(endpoint); final RetryNTimesLoop retryLoop = new RetryNTimesLoop(config.getRetry() != null ? config.getRetry() : 0);
final WSManClient client = m_factory.getClient(endpoint); LOG.debug("doAdd: m_config: {} ", m_config);
final WSManClient client = m_factory.getClient(endpoint); final RetryNTimesLoop retryLoop = new RetryNTimesLoop(config.getRetry() != null ? config.getRetry() : 0);
final WSManClient client = m_factory.getClient(endpoint); LOG.debug("doUpdate: m_config: \"{}\"", m_config);