/** * Adds the handler. */ private void addHandler() { MibObj obj = new MibObj(); obj.setOid(".1.1.1.1"); obj.setInstance("0"); obj.setType("gauge"); obj.setAlias("test"); table.select(container.addOnmsBean(obj)); }
aMibObject.setGroupName(groupName); aMibObject.setGroupIfType(groupIfType); aMibObject.setOid(mibObj.getOid()); aMibObject.setAlias(mibObj.getAlias()); aMibObject.setType(mibObj.getType()); aMibObject.setInstance(mibObj.getInstance()); aMibObject.setMaxval(mibObj.getMaxval()); aMibObject.setMinval(mibObj.getMinval()); final ResourceType resourceType = getConfiguredResourceTypes().get(mibObj.getInstance()); if (resourceType != null) { aMibObject.setResourceType(resourceType);
@Override public void visitMibObj(final MibObj mibObj) { final String instance = mibObj.getInstance(); if (m_currentTable == null && m_currentGroup == null) { if (m_groupName == null) { final ColumnImpl column = new ColumnImpl(mibObj.getOid(), mibObj.getAlias(), mibObj.getType()); m_currentTable.addColumn(column); m_columns.put(column.getAlias(), column); } else if (m_currentGroup != null) { final MibObjectImpl obj = new MibObjectImpl(); obj.setOid(mibObj.getOid()); obj.setInstance(instance); obj.setAlias(mibObj.getAlias()); obj.setType(mibObj.getType()); m_currentGroup.addMibObject(obj); m_mibs.put(obj.getAlias(), obj);
private void validateResourceTypes(final Collection<SnmpCollection> snmpCollections, final Set<String> allowedResourceTypes) { final String configuredString; if (allowedResourceTypes.size() == 0) { configuredString = "(none)"; } else { configuredString = StringUtils.join(allowedResourceTypes, ", "); } final String allowableValues = "any positive number, 'ifIndex', or any of the configured resourceTypes: " + configuredString; for (final SnmpCollection collection : snmpCollections) { final Groups groups = collection.getGroups(); if (groups != null) { for (final Group group : groups.getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { final String instance = mibObj.getInstance(); if (instance == null) continue; if (MibObject.INSTANCE_IFINDEX.equals(instance)) continue; if (allowedResourceTypes.contains(instance)) continue; try { // Check to see if the value is a non-negative integer if (Integer.parseInt(instance.trim()) >= 0) { continue; } } catch (NumberFormatException e) {} // XXX this should be a better exception throw new IllegalArgumentException("instance '" + instance + "' invalid in mibObj definition for OID '" + mibObj.getOid() + "' in collection '" + collection.getName() + "' for group '" + group.getName() + "'. Allowable instance values: " + allowableValues); } } } } }
/** * Gets the parent groups. * <p>The list of groups per SNMP collection that are referencing a given resourceTypeName</p> * * @param dataCollectionConfigDao the data collection configuration DAO * @param resourceTypeName the resource type name * @return the parent groups. */ private Set<String> getParentGroups(final DataCollectionConfigDao dataCollectionConfigDao, String resourceTypeName) { Set<String> groupMap = new TreeSet<>(); for (final SnmpCollection collection : dataCollectionConfigDao.getRootDataCollection().getSnmpCollections()) { for (final Group group : collection.getGroups().getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { if (mibObj.getInstance().equals(resourceTypeName)) { groupMap.add(group.getName() + '@' + collection.getName()); } } } } return groupMap; }
/** * Gets the parent groups. * <p>The list of groups per SNMP collection that are referencing a given resourceTypeName</p> * * @param dataCollectionConfigDao the data collection configuration DAO * @param resourceTypeName the resource type name * @return the parent groups. */ private Set<String> getParentGroups(final DataCollectionConfigDao dataCollectionConfigDao, String resourceTypeName) { Set<String> groupMap = new TreeSet<>(); for (final SnmpCollection collection : dataCollectionConfigDao.getRootDataCollection().getSnmpCollections()) { for (final Group group : collection.getGroups().getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { if (mibObj.getInstance().equals(resourceTypeName)) { groupMap.add(group.getName() + '@' + collection.getName()); } } } } return groupMap; }
/** * Adds the handler. */ private void addHandler() { MibObj obj = new MibObj(); obj.setOid(".1.1.1.1"); obj.setInstance("0"); obj.setType("gauge"); obj.setAlias("test"); table.select(container.addOnmsBean(obj)); }
MibObj mibObj = new MibObj(); mibObj.setOid('.' + v.getOidStr()); mibObj.setInstance(resourceType == null ? "0" : resourceType); mibObj.setAlias(alias); mibObj.setType(typeName); group.addMibObj(mibObj); if (typeName.equals("string") && resourceType != null) {
MibObj mibObj = new MibObj(); mibObj.setOid('.' + v.getOidStr()); mibObj.setInstance(resourceType == null ? "0" : resourceType); mibObj.setAlias(alias); mibObj.setType(typeName); group.addMibObj(mibObj); if (typeName.equals("string") && resourceType != null) {