org.opennms.netmgt.capsd
Class IfSnmpCollector

java.lang.Object
  extended by org.opennms.netmgt.capsd.IfSnmpCollector
All Implemented Interfaces:
Runnable

public final class IfSnmpCollector
extends Object
implements Runnable

This class is designed to collect the necessary SNMP information from the target address and store the collected information. When the class is initially constructed no information is collected. The SNMP Session creating and colletion occurs in the main run method of the instance. This allows the collection to occur in a thread if necessary.

Author:
brozow , OpenNMS

Constructor Summary
IfSnmpCollector(InetAddress address)
          Constructs a new snmp collector for a node using the passed interface as the collection point.
 
Method Summary
 boolean failed()
          Returns true if any part of the collection failed.
 int getAdminStatus(int ifIndex)
           
 InetAddress getCollectorTargetAddress()
          Returns the target address that the collection occured for.
 InetAddress[] getIfAddressAndMask(int ifIndex)
          Returns the Internet address at the corresponding index.
 String getIfAlias(int ifIndex)
           
 String getIfDescr(int ifIndex)
           
 int getIfIndex(InetAddress address)
           
 String getIfName(int ifIndex)
           
 IfTable getIfTable()
          Returns the collected interface table.
 int getIfType(int ifIndex)
           
 IfXTable getIfXTable()
          Returns the collected interface extensions table.
 Long getInterfaceSpeed(int ifIndex)
           
 IpAddrTable getIpAddrTable()
          Returns the collected IP Interface Address table.
 int getOperStatus(int ifIndex)
           
 String getPhysAddr(int ifIndex)
           
 SystemGroup getSystemGroup()
          Returns the collected system group.
 boolean hasIfTable()
          Returns true if the interface table was collected.
 boolean hasIfXTable()
          Returns true if the interface extensions table was collected.
 boolean hasIpAddrTable()
          Returns true if the IP Interface Address table was collected.
 boolean hasSystemGroup()
          Returns true if the system group was collected successfully
 void run()
           Preforms the collection for the targeted internet address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IfSnmpCollector

public IfSnmpCollector(InetAddress address)
Constructs a new snmp collector for a node using the passed interface as the collection point. The collection does not occur until the run method is invoked.

Method Detail

failed

public boolean failed()
Returns true if any part of the collection failed.


hasSystemGroup

public boolean hasSystemGroup()
Returns true if the system group was collected successfully


getSystemGroup

public SystemGroup getSystemGroup()
Returns the collected system group.


hasIfTable

public boolean hasIfTable()
Returns true if the interface table was collected.


getIfTable

public IfTable getIfTable()
Returns the collected interface table.


hasIpAddrTable

public boolean hasIpAddrTable()
Returns true if the IP Interface Address table was collected.


getIpAddrTable

public IpAddrTable getIpAddrTable()
Returns the collected IP Interface Address table.


hasIfXTable

public boolean hasIfXTable()
Returns true if the interface extensions table was collected.


getIfXTable

public IfXTable getIfXTable()
Returns the collected interface extensions table.


getCollectorTargetAddress

public InetAddress getCollectorTargetAddress()
Returns the target address that the collection occured for.


getIfAddressAndMask

public InetAddress[] getIfAddressAndMask(int ifIndex)
Returns the Internet address at the corresponding index. If the address cannot be resolved then a null reference is returned.

Parameters:
ifIndex - The index to search for.
Throws:
IndexOutOfBoundsException - Thrown if the index cannot be resolved due to an incomplete table.

getAdminStatus

public int getAdminStatus(int ifIndex)

getOperStatus

public int getOperStatus(int ifIndex)

getIfType

public int getIfType(int ifIndex)

getIfIndex

public int getIfIndex(InetAddress address)

getIfName

public String getIfName(int ifIndex)

getIfDescr

public String getIfDescr(int ifIndex)

getInterfaceSpeed

public Long getInterfaceSpeed(int ifIndex)

getPhysAddr

public String getPhysAddr(int ifIndex)

getIfAlias

public String getIfAlias(int ifIndex)

run

public void run()

Preforms the collection for the targeted internet address. The success or failure of the collection should be tested via the failed method.

No synchronization is preformed, so if this is used in a separate thread context synchornization must be added.

Specified by:
run in interface Runnable


Copyright © 2009. All Rights Reserved.