/** * <p>getTrackersFor</p> * * @param columns an array of {@link org.opennms.netmgt.snmp.NamedSnmpVar} objects. * @return an array of {@link org.opennms.netmgt.snmp.CollectionTracker} objects. */ public static CollectionTracker[] getTrackersFor(final NamedSnmpVar[] columns) { return getTrackersFor(columns, null); }
/** * <p>getTrackersFor</p> * * @param columns an array of {@link org.opennms.netmgt.snmp.NamedSnmpVar} objects. * @param instances a {@link java.util.Set} object. * @return an array of {@link org.opennms.netmgt.snmp.CollectionTracker} objects. */ public static CollectionTracker[] getTrackersFor(final NamedSnmpVar[] columns, final Set<SnmpInstId> instances) { if (columns == null) { return new CollectionTracker[0]; } final CollectionTracker[] trackers = new CollectionTracker[columns.length]; for(int i = 0; i < columns.length; i++) trackers[i] = columns[i].getCollectionTracker(instances); return trackers; }
/** {@inheritDoc} */ @Override public void storeResult(final SnmpResult res) { final SnmpObjId base = res.getBase(); final SnmpValue value = res.getValue(); putValue(base.toString(), value); for (final NamedSnmpVar var : ms_elemList) { if (base.equals(var.getSnmpObjId())) { if (value.isError()) { LOG.error("storeResult: got an error for alias {} [{}].[{}], but we should only be getting non-errors: {}", var.getAlias(), base, res.getInstance(), value); } else if (value.isEndOfMib()) { LOG.debug("storeResult: got endOfMib for alias {} [{}].[{}], not storing", var.getAlias(), base, res.getInstance()); } else { final SnmpValueType type = SnmpValueType.valueOf(value.getType()); LOG.debug("Storing Result: alias: {} [{}].[{}] = {}: {}", var.getAlias(), base, res.getInstance(), (type == null ? "Unknown" : type.getDisplayString()), toLogString(value)); putValue(var.getAlias(), value); } } } }
/** * <p>getCollectionTracker</p> * * @param instances a {@link java.util.Set} object. * @return a {@link org.opennms.netmgt.snmp.CollectionTracker} object. */ public CollectionTracker getCollectionTracker(final Set<SnmpInstId> instances) { if ( instances == null ) { return m_isTabular ? new ColumnTracker(getSnmpObjId()) : new SingleInstanceTracker(getSnmpObjId(), SnmpInstId.INST_ZERO); } else { final Collection<Collectable> trackers = new ArrayList<>(); for(final SnmpInstId inst : instances) { trackers.add(new SingleInstanceTracker(getSnmpObjId(), inst)); } return new AggregateTracker(trackers); } }
public void testStoreResultWithValueThenEndOfMibView() { String baseOid = ".1.3.6.1.2.1.31.1.1.1.18"; String ifAliasName = "ifAlias"; String ifAliasValue = "Foo!"; SnmpStore store = new SnmpStore(new NamedSnmpVar[] { new NamedSnmpVar(NamedSnmpVar.SNMPOCTETSTRING, ifAliasName, baseOid, 18) }); SnmpObjId base = SnmpObjId.get(baseOid); SnmpInstId inst = new SnmpInstId("1"); store.storeResult(new SnmpResult(base, inst, SnmpUtils.getValueFactory().getOctetString(ifAliasValue.getBytes()))); store.storeResult(new SnmpResult(base, inst, SnmpUtils.getValueFactory().getValue(SnmpValue.SNMP_END_OF_MIB, null))); assertEquals("ifAlias value", ifAliasValue, store.getDisplayString(ifAliasName)); } }
/** * <p>Constructor for SnmpTable.</p> * * @param address a {@link java.net.InetAddress} object. * @param tableName a {@link java.lang.String} object. * @param columns an array of {@link org.opennms.netmgt.snmp.NamedSnmpVar} objects. * @param instances a {@link java.util.Set} object. */ protected SnmpTable(InetAddress address, String tableName, NamedSnmpVar[] columns, Set<SnmpInstId> instances) { super(NamedSnmpVar.getTrackersFor(columns, instances)); m_address = address; m_tableName = tableName; }
/** * <p>Constructor for SnmpTable.</p> * * @param address a {@link java.net.InetAddress} object. * @param tableName a {@link java.lang.String} object. * @param columns an array of {@link org.opennms.netmgt.capsd.snmp.NamedSnmpVar} objects. * @param <T> a T object. */ protected SnmpTable(InetAddress address, String tableName, NamedSnmpVar[] columns) { super(NamedSnmpVar.getTrackersFor(columns)); m_address = address; m_tableName = tableName; }
/** * <p>Constructor for SnmpTable.</p> * * @param address a {@link java.net.InetAddress} object. * @param tableName a {@link java.lang.String} object. * @param columns an array of {@link org.opennms.netmgt.snmp.NamedSnmpVar} objects. * @param instances a {@link java.util.Set} object. */ protected SnmpTable(InetAddress address, String tableName, NamedSnmpVar[] columns, Set<SnmpInstId> instances) { super(NamedSnmpVar.getTrackersFor(columns, instances)); m_address = address; m_tableName = tableName; }
public OspfGeneralGroupTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
public IsisSysObjectGroupTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
/** * <P>The class constructor is used to initialize the collector * and send out the initial SNMP packet requesting data. The * data is then received and store by the object. When all the * data has been collected the passed signaler object is <EM>notified</em> * using the notifyAll() method.</P> * * @param address a {@link java.net.InetAddress} object. */ public Dot1dBaseTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
/** * <P>The class constructor is used to initialize the collector * and send out the initial SNMP packet requesting data. The * data is then received and store by the object. When all the * data has been collected the passed signaler object is <EM>notified</em> * using the notifyAll() method.</P> * * @param address a {@link java.net.InetAddress} object. */ public CiscoVtpTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
public LldpLocalGroupTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
/** * <P>The class constructor is used to initialize the collector * and send out the initial SNMP packet requesting data. The * data is then received and store by the object. When all the * data has been collected the passed signaler object is <EM>notified</em> * using the notifyAll() method.</P> * * @param address a {@link java.net.InetAddress} object. */ public CdpGlobalGroupTracker() { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_store = new SnmpStore(ms_elemList); }
/** * <P> * The class constructor is used to initialize the collector and send out * the initial SNMP packet requesting data. The data is then received and * store by the object. When all the data has been collected the passed * signaler object is <EM>notified</em> using the notifyAll() method. * </P> * * @param address TODO */ public SystemGroup(InetAddress address) { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_address = address; m_store = new SnmpStore(ms_elemList); }
/** * <P> * The class constructor is used to initialize the collector and send out * the initial SNMP packet requesting data. The data is then received and * store by the object. When all the data has been collected the passed * signaler object is <EM>notified</em> using the notifyAll() method. * </P> * * @param address TODO */ public SystemGroup(InetAddress address) { super(NamedSnmpVar.getTrackersFor(ms_elemList)); m_address = address; m_store = new SnmpStore(ms_elemList); }