|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.collectd.SnmpIfCollector
The SnmpIfCollector class is responsible for performing the actual SNMP data collection for a node over a specified network interface. The SnmpIfCollector implements the SnmpHandler class in order to receive notifications when an SNMP reply is received or error occurs. The SnmpIfCollector is provided a list of MIB objects to collect and an interface over which to collect the data. Data collection can be via SNMPv1 GetNext requests or SNMPv2 GetBulk requests depending upon the parms used to construct the collector.
Field Summary | |
private SNMPCollectorEntry |
m_collectorEntry
For SNMPv1, used to store the collected MIB data. |
private java.util.List |
m_entries
Used to store all the generated maps of the MIB data for each interface. |
private boolean |
m_error
Flag indicating the success or failure of the informational query. |
private int |
m_errorIndex
If the SNMP collection failed due to a problem with one or more varbinds (for example if a particular object oid is requested which is not implemented in the target's SNMP agent) then this value will be set equal to the *first* failing varbind in the request. |
private int |
m_errorStatus
Reason that the SNMP request failed. |
private static java.lang.String[] |
m_errorText
Array of SNMPv1 error strings. |
private java.util.Map |
m_ifMap
Map of IfInfo objects representing each of the nodes interfaces. |
private java.lang.String[] |
m_indexArray
Used for keeping track of all the possible indexes. |
private int |
m_maxVarsPerPdu
Max number of variables permitted in a single outgoing SNMP PDU request.. |
private int |
m_numInterfaces
The number of interfaces associated with the remote host. |
private java.util.List |
m_objList
List of MibObject objects to be collected. |
private java.util.List |
m_objList_v2
Copy of m_objList list that will used solely by version 2. |
private int |
m_oidListIndex
For SNMPv1, keeps track of current oid list index. |
private java.lang.String |
m_primaryIf
Holds the IP Address of the primary SNMP iterface. |
private java.lang.String |
m_primaryIfIndex
Holds the ifIndex of the primary SNMP interface. |
private int |
m_responses
For SNMPv1, used for keeping track of the SNMP response PDUs received. |
private java.util.List |
m_responseVbList
Used as temporary storage for variables coming from Snmp v2 PDU reponses. |
private Signaler |
m_signal
Used to synchronize the class to ensure that the session has finished collecting data before the value of success or failure is set, and control is returned to the caller. |
private boolean |
m_timeout
Flag indicating if the SNMP collection failed due to the SNMP request timing out. |
private int |
m_version
Used for classifying the SNMP version of the session. |
Constructor Summary | |
private |
SnmpIfCollector()
The default constructor is marked private and will always throw an exception. |
|
SnmpIfCollector(SnmpSession session,
Signaler signaler,
java.lang.String primaryIfIndex,
java.util.Map ifMap,
int ifCount,
int maxVarsPerPdu)
The class constructor is used to initialize the collector and send out the initial SNMP packet requesting data. |
Method Summary | |
private static java.util.List |
buildV2CombinedOidList(java.util.Map ifMap)
This method is responsible for building a new object list consisting of all unique oids to be collected for all interfaces represented within the interface map. |
boolean |
failed()
Returns the success or failure code for collection of the data. |
java.util.List |
getEntries()
Returns the list of all entry maps that can be used to access all the information from the service polling. |
private SnmpPduPacket |
getNextSnmpV1Pdu(java.lang.String ifAddress)
This method constructs the next SnmpPduPacket (pdu) for sending to the remote node. |
private SnmpPduPacket |
getNextSnmpV2Pdu(java.lang.String ifAddress)
This method constructs the next SnmpPduPacket (pdu) for sending to the remote node. |
void |
snmpInternalError(SnmpSession session,
int error,
SnmpSyntax pdu)
This method is part of the SnmpHandler interface and called when an internal error happens in a session. |
void |
snmpReceivedPdu(SnmpSession session,
int command,
SnmpPduPacket pdu)
This method is used to process received SNMP PDU packets from the remote agent. |
void |
snmpTimeoutError(SnmpSession session,
SnmpSyntax pdu)
This method is part of the SnmpHandler interface and is invoked when the SnmpSession does not receive a reply after exhausting the retransmission attempts. |
static SnmpObjectId |
stop_oid(java.lang.String oid)
This method will take an OID, and generate the succeeding OID. |
boolean |
timedout()
Returns true if SNMP collection failed due to timeout. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean m_error
private int m_errorStatus
private static java.lang.String[] m_errorText
private int m_errorIndex
private boolean m_timeout
private Signaler m_signal
private java.util.List m_objList
private java.util.List m_objList_v2
private java.util.List m_entries
private int m_version
private java.lang.String[] m_indexArray
private java.util.List m_responseVbList
private int m_responses
private SNMPCollectorEntry m_collectorEntry
private int m_oidListIndex
private java.lang.String m_primaryIfIndex
private java.lang.String m_primaryIf
private int m_numInterfaces
private int m_maxVarsPerPdu
private java.util.Map m_ifMap
Constructor Detail |
private SnmpIfCollector() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
- Always thrown from this method since it is not supported.public SnmpIfCollector(SnmpSession session, Signaler signaler, java.lang.String primaryIfIndex, java.util.Map ifMap, int ifCount, int maxVarsPerPdu)
session
- The SNMP session with the remote agent.signaler
- The object signaled when data collection is done.primaryIfIndex
- The ifIndex value linked to the primary IP.ifMap
- Map of org.opennms.netmgt.poller.collectd.IfInfo objects.ifCount
- Number of interfaces found in node's MIB-II ifTablemaxVarsPerPdu
- Max number of variables permitted in a single PDU.Method Detail |
public static SnmpObjectId stop_oid(java.lang.String oid)
oid
- Object identifier from which to generate the stop oid
private SnmpPduPacket getNextSnmpV1Pdu(java.lang.String ifAddress)
ifAddress
- Interface address of the remote agent
SnmpNull
,
SnmpPduPacket
private SnmpPduPacket getNextSnmpV2Pdu(java.lang.String ifAddress)
ifAddress
- Interface address of the remote agent
SnmpNull
,
SnmpPduPacket
public void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu)
snmpReceivedPdu
in interface SnmpHandler
session
- The SNMP Session that received the PDUcommand
- The command contained in the received pdupdu
- The actual received PDU.public void snmpInternalError(SnmpSession session, int error, SnmpSyntax pdu)
snmpInternalError
in interface SnmpHandler
session
- The session that had an unexpected errorerror
- The error conditionpdu
- The PDU being sent when the error occuredsnmpTimeoutError(org.opennms.protocols.snmp.SnmpSession, org.opennms.protocols.snmp.SnmpSyntax)
,
SnmpHandler
public void snmpTimeoutError(SnmpSession session, SnmpSyntax pdu)
snmpTimeoutError
in interface SnmpHandler
session
- The session invoking the error handlerpdu
- The PDU that the remote failed to respond to.SnmpHandler
public boolean failed()
public boolean timedout()
public java.util.List getEntries()
private static java.util.List buildV2CombinedOidList(java.util.Map ifMap)
ifMap
- Map of IfInfo objects indexed by ifIndex
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |