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.

Version:
$Id: $
Author:
brozow , OpenNMS , 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)
          getAdminStatus
 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)
          getIfAlias
 String getIfDescr(int ifIndex)
          getIfDescr
 int getIfIndex(InetAddress address)
          getIfIndex
 String getIfName(int ifIndex)
          getIfName
 IfTable getIfTable()
          Returns the collected interface table.
 int getIfType(int ifIndex)
          getIfType
 IfXTable getIfXTable()
          Returns the collected interface extensions table.
 Long getInterfaceSpeed(int ifIndex)
          getInterfaceSpeed
 IpAddrTable getIpAddrTable()
          Returns the collected IP Interface Address table.
 int getOperStatus(int ifIndex)
          getOperStatus
 String getPhysAddr(int ifIndex)
          getPhysAddr
 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.

Parameters:
address - a InetAddress object.
Method Detail

failed

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

Returns:
a boolean.

hasSystemGroup

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

Returns:
a boolean.

getSystemGroup

public SystemGroup getSystemGroup()
Returns the collected system group.

Returns:
a SystemGroup object.

hasIfTable

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

Returns:
a boolean.

getIfTable

public IfTable getIfTable()
Returns the collected interface table.

Returns:
a IfTable object.

hasIpAddrTable

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

Returns:
a boolean.

getIpAddrTable

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

Returns:
a IpAddrTable object.

hasIfXTable

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

Returns:
a boolean.

getIfXTable

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

Returns:
a IfXTable object.

getCollectorTargetAddress

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

Returns:
a InetAddress object.

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.
Returns:
an array of InetAddress objects.
Throws:
IndexOutOfBoundsException - Thrown if the index cannot be resolved due to an incomplete table.

getAdminStatus

public int getAdminStatus(int ifIndex)

getAdminStatus

Parameters:
ifIndex - a int.
Returns:
a int.

getOperStatus

public int getOperStatus(int ifIndex)

getOperStatus

Parameters:
ifIndex - a int.
Returns:
a int.

getIfType

public int getIfType(int ifIndex)

getIfType

Parameters:
ifIndex - a int.
Returns:
a int.

getIfIndex

public int getIfIndex(InetAddress address)

getIfIndex

Parameters:
address - a InetAddress object.
Returns:
a int.

getIfName

public String getIfName(int ifIndex)

getIfName

Parameters:
ifIndex - a int.
Returns:
a String object.

getIfDescr

public String getIfDescr(int ifIndex)

getIfDescr

Parameters:
ifIndex - a int.
Returns:
a String object.

getInterfaceSpeed

public Long getInterfaceSpeed(int ifIndex)

getInterfaceSpeed

Parameters:
ifIndex - a int.
Returns:
a Long object.

getPhysAddr

public String getPhysAddr(int ifIndex)

getPhysAddr

Parameters:
ifIndex - a int.
Returns:
a String object.

getIfAlias

public String getIfAlias(int ifIndex)

getIfAlias

Parameters:
ifIndex - a int.
Returns:
a String object.

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 © 2011. All Rights Reserved.