Search in sources :

Example 21 with MibObject

use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.

the class OnmsSnmpCollection method loadAttributeTypes.

/**
     * <p>loadAttributeTypes</p>
     *
     * @param agent a {@link org.opennms.netmgt.collection.api.CollectionAgent} object.
     * @param ifType a int.
     * @return a {@link java.util.List} object.
     */
public List<SnmpAttributeType> loadAttributeTypes(SnmpCollectionAgent agent, int ifType) {
    String sysObjectId = agent.getSysObjectId();
    String hostAddress = agent.getHostAddress();
    List<MibObject> oidList = getDataCollectionConfigDao().getMibObjectList(getName(), sysObjectId, hostAddress, ifType);
    Map<String, AttributeGroupType> groupTypes = new HashMap<String, AttributeGroupType>();
    List<SnmpAttributeType> typeList = new LinkedList<SnmpAttributeType>();
    for (MibObject mibObject : oidList) {
        String instanceName = mibObject.getInstance();
        AttributeGroupType groupType = findGroup(groupTypes, mibObject);
        SnmpAttributeType attrType = SnmpAttributeType.create(getResourceType(agent, instanceName), getName(), mibObject, groupType);
        groupType.addAttributeType(attrType);
        typeList.add(attrType);
    }
    LOG.debug("getAttributeTypes({}, {}): {}", agent, ifType, typeList);
    return typeList;
}
Also used : HashMap(java.util.HashMap) AttributeGroupType(org.opennms.netmgt.collection.api.AttributeGroupType) MibObject(org.opennms.netmgt.config.datacollection.MibObject) LinkedList(java.util.LinkedList)

Example 22 with MibObject

use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.

the class OnmsSnmpCollection method loadAliasAttributeTypes.

/**
     * <p>loadAliasAttributeTypes</p>
     *
     * @param agent a {@link org.opennms.netmgt.collection.api.CollectionAgent} object.
     * @return a {@link java.util.List} object.
     */
public List<SnmpAttributeType> loadAliasAttributeTypes(SnmpCollectionAgent agent) {
    IfAliasResourceType resType = getIfAliasResourceType(agent);
    MibObject ifAliasMibObject = new MibObject();
    ifAliasMibObject.setOid(".1.3.6.1.2.1.31.1.1.1.18");
    ifAliasMibObject.setAlias("ifAlias");
    ifAliasMibObject.setType("string");
    ifAliasMibObject.setInstance("ifIndex");
    ifAliasMibObject.setGroupName("aliasedResource");
    ifAliasMibObject.setGroupIfType(AttributeGroupType.IF_TYPE_ALL);
    AttributeGroupType groupType = new AttributeGroupType(ifAliasMibObject.getGroupName(), ifAliasMibObject.getGroupIfType());
    SnmpAttributeType type = SnmpAttributeType.create(resType, resType.getCollectionName(), ifAliasMibObject, groupType);
    return Collections.singletonList(type);
}
Also used : AttributeGroupType(org.opennms.netmgt.collection.api.AttributeGroupType) MibObject(org.opennms.netmgt.config.datacollection.MibObject)

Example 23 with MibObject

use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.

the class MockDataCollectionConfig method createMibObject.

private MibObject createMibObject(String alias, String oid, String instance, String type) {
    MibObject mibObj = new MibObject();
    mibObj.setGroupName("test");
    mibObj.setAlias(alias);
    mibObj.setOid(oid);
    mibObj.setType(type);
    mibObj.setInstance(instance);
    mibObj.setGroupName("ifIndex".equals(instance) ? "interface" : "node");
    mibObj.setGroupIfType("ifIndex".equals(instance) ? AttributeGroupType.IF_TYPE_ALL : AttributeGroupType.IF_TYPE_IGNORE);
    return mibObj;
}
Also used : MibObject(org.opennms.netmgt.config.datacollection.MibObject)

Example 24 with MibObject

use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.

the class MockDataCollectionConfig method defineAttributeType.

public MibObject defineAttributeType(String alias, String oid, String instance, String type) {
    MibObject mibObj = createAttributeType(alias, oid, instance, type);
    getAttrMap().put(mibObj.getAlias(), mibObj);
    getAttrMap().put(mibObj.getOid(), mibObj);
    return mibObj;
}
Also used : MibObject(org.opennms.netmgt.config.datacollection.MibObject)

Example 25 with MibObject

use of org.opennms.netmgt.config.datacollection.MibObject in project opennms by OpenNMS.

the class MockDataCollectionConfig method addAttributeType.

public void addAttributeType(String alias, String oid, String inst, String type) {
    MibObject attrType = getAttributeType(alias, oid, inst, type);
    getAttrList().add(attrType);
}
Also used : MibObject(org.opennms.netmgt.config.datacollection.MibObject)

Aggregations

MibObject (org.opennms.netmgt.config.datacollection.MibObject)25 AttributeGroupType (org.opennms.netmgt.collection.api.AttributeGroupType)16 Test (org.junit.Test)9 SnmpAttributeType (org.opennms.netmgt.collectd.SnmpAttributeType)9 NumericAttributeType (org.opennms.netmgt.collectd.NumericAttributeType)8 HashMap (java.util.HashMap)6 SnmpCollectionAgent (org.opennms.netmgt.collectd.SnmpCollectionAgent)6 SnmpCollectionResource (org.opennms.netmgt.collectd.SnmpCollectionResource)6 ServiceParameters (org.opennms.netmgt.collection.api.ServiceParameters)6 NodeInfo (org.opennms.netmgt.collectd.NodeInfo)5 NodeResourceType (org.opennms.netmgt.collectd.NodeResourceType)5 MockDataCollectionConfig (org.opennms.netmgt.mock.MockDataCollectionConfig)5 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)5 Date (java.util.Date)4 RrdRepository (org.opennms.netmgt.rrd.RrdRepository)4 SnmpResult (org.opennms.netmgt.snmp.SnmpResult)4 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)4 SnmpAttribute (org.opennms.netmgt.collectd.SnmpAttribute)3 CollectionResource (org.opennms.netmgt.collection.api.CollectionResource)3 RrdPersistOperationBuilder (org.opennms.netmgt.collection.persistence.rrd.RrdPersistOperationBuilder)3