public Set<RrdGraphAttribute> getRequiredRrdGraphAttributes(OnmsResource reportResource, PrefabGraph prefabGraph) { Map<String, RrdGraphAttribute> available = reportResource.getRrdGraphAttributes(); Set<RrdGraphAttribute> reqAttrs = new LinkedHashSet<RrdGraphAttribute>(); for (String attrName : prefabGraph.getColumns()) { RrdGraphAttribute attr = available.get(attrName); if (attr != null) { reqAttrs.add(attr); } } return reqAttrs; }
/** * <p>getRequiredRrGraphdAttributes</p> * * @return a {@link java.util.Collection} object. */ public Collection<RrdGraphAttribute> getRequiredRrGraphdAttributes() { Map<String, RrdGraphAttribute> available = m_resource.getRrdGraphAttributes(); Set<RrdGraphAttribute> reqAttrs = new LinkedHashSet<>(); for(String attrName : m_graph.getColumns()) { RrdGraphAttribute attr = available.get(attrName); if (attr != null) { reqAttrs.add(attr); } } return reqAttrs; }
/** * <p>getRequiredRrGraphdAttributes</p> * * @return a {@link java.util.Collection} object. */ public Collection<RrdGraphAttribute> getRequiredRrGraphdAttributes() { Map<String, RrdGraphAttribute> available = m_resource.getRrdGraphAttributes(); Set<RrdGraphAttribute> reqAttrs = new LinkedHashSet<>(); for(String attrName : m_graph.getColumns()) { RrdGraphAttribute attr = available.get(attrName); if (attr != null) { reqAttrs.add(attr); } } return reqAttrs; }
private static String[] getRrdNames(OnmsResource resource, String[] dsNames) { String[] rrds = new String[dsNames.length]; Map<String, RrdGraphAttribute> attributes = resource.getRrdGraphAttributes(); for (int i=0; i < dsNames.length; i++) { RrdGraphAttribute attribute = attributes.get(dsNames[i]); if (attribute == null) { throw new IllegalArgumentException("RRD attribute '" + dsNames[i] + "' is not available on resource '" + resource.getId() + "'. Available RRD attributes: " + StringUtils.collectionToDelimitedString(attributes.keySet(), ", ")); } rrds[i] = RrdFileConstants.escapeForGraphing(attribute.getRrdRelativePath()); } return rrds; }
private static String[] getRrdNames(OnmsResource resource, String[] dsNames) { String[] rrds = new String[dsNames.length]; Map<String, RrdGraphAttribute> attributes = resource.getRrdGraphAttributes(); for (int i=0; i < dsNames.length; i++) { RrdGraphAttribute attribute = attributes.get(dsNames[i]); if (attribute == null) { throw new IllegalArgumentException("RRD attribute '" + dsNames[i] + "' is not available on resource '" + resource.getId() + "'. Available RRD attributes: " + StringUtils.collectionToDelimitedString(attributes.keySet(), ", ")); } rrds[i] = RrdFileConstants.escapeForGraphing(attribute.getRrdRelativePath()); } return rrds; }
/** {@inheritDoc} */ @Override public void promoteGraphAttributesForResource(OnmsResource resource) { final String rrdBaseDir = System.getProperty("rrd.base.dir"); List<String> rrdFiles = new LinkedList<>(); for(RrdGraphAttribute attribute : resource.getRrdGraphAttributes().values()) { rrdFiles.add(rrdBaseDir+File.separator+attribute.getRrdRelativePath()); } EventBuilder bldr = new EventBuilder(EventConstants.PROMOTE_QUEUE_DATA_UEI, "OpenNMS.Webapp"); bldr.addParam(EventConstants.PARM_FILES_TO_PROMOTE, rrdFiles); try { m_eventProxy.send(bldr.getEvent()); } catch (EventProxyException e) { LOG.warn("Unable to send file promotion event to opennms: {}", e, e); } }
/** {@inheritDoc} */ @Override public void promoteGraphAttributesForResource(OnmsResource resource) { final String rrdBaseDir = System.getProperty("rrd.base.dir"); List<String> rrdFiles = new LinkedList<>(); for(RrdGraphAttribute attribute : resource.getRrdGraphAttributes().values()) { rrdFiles.add(rrdBaseDir+File.separator+attribute.getRrdRelativePath()); } EventBuilder bldr = new EventBuilder(EventConstants.PROMOTE_QUEUE_DATA_UEI, "OpenNMS.Webapp"); bldr.addParam(EventConstants.PARM_FILES_TO_PROMOTE, rrdFiles); try { m_eventProxy.send(bldr.getEvent()); } catch (EventProxyException e) { LOG.warn("Unable to send file promotion event to opennms: {}", e, e); } }
Set<String> availableRrdAttributes = new LinkedHashSet<>(resource.getRrdGraphAttributes().keySet()); Set<String> availableStringAttributes = new LinkedHashSet<>(resource.getStringPropertyAttributes().keySet()); Set<String> availableExternalAttributes = new LinkedHashSet<>(resource.getExternalValueAttributes().keySet());
RrdGraphAttribute rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute()); source.setAttribute(source.getFallbackAttribute()); source.setFallbackAttribute(null); rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute());
RrdGraphAttribute rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute()); source.setAttribute(source.getFallbackAttribute()); source.setFallbackAttribute(null); rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute());
RrdGraphAttribute rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute()); source.setAttribute(source.getFallbackAttribute()); source.setFallbackAttribute(null); rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute());
RrdGraphAttribute rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute()); source.setAttribute(source.getFallbackAttribute()); source.setFallbackAttribute(null); rrdGraphAttribute = resource.getRrdGraphAttributes().get(source.getAttribute());
public static ResourceDTO fromResource(final OnmsResource resource, final int depth) { final ResourceDTO dto = new ResourceDTO(); dto.setId(resource.getId().toString()); dto.setLabel(resource.getLabel()); dto.setName(resource.getName()); dto.setLink(resource.getLink()); dto.setTypeLabel(resource.getResourceType().getLabel()); dto.setParentId(resource.getParent() == null ? null : resource.getParent().getId().toString()); dto.setStringPropertyAttributes(resource.getStringPropertyAttributes()); dto.setExternalValueAttributes(resource.getExternalValueAttributes()); dto.setRrdGraphAttributes(resource.getRrdGraphAttributes()); dto.setResource(resource); if (depth == 0) { dto.setChildren(null); } else { List<ResourceDTO> children = new LinkedList<>(); for (final OnmsResource child : resource.getChildResources()) { children.add(ResourceDTO.fromResource(child, depth - 1)); } dto.setChildren(new ResourceDTOCollection(children)); } return dto; } }
.getChildResources()); final OnmsAttribute attribute = resource.getRrdGraphAttributes().get("ifInOctets");