Package com.ibm.di.protocols
Class SNMP
- java.lang.Object
-
- com.ibm.di.protocols.SNMP
-
public class SNMP extends java.lang.ObjectThis class offers the functionality of the Simple Network Management. Typically SNMP is used, when there are a number of systems to be managed, and one or more systems managing them. The managed system that report information via SNMP to the managing systems.
-
-
Field Summary
Fields Modifier and Type Field Description static intretriesA parameter determining the number of retries to be made.static java.lang.StringSNMP_COMMUNITYSNMP community string.static java.lang.StringSNMP_ENTERPRISEThe default value for the manage object's type.static inttimeoutA timeout parameter.
-
Constructor Summary
Constructors Constructor Description SNMP()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.tivoli.snmp.data.BadValuecreateBadValue()Creates a SNMP BadValue object.static com.tivoli.snmp.data.BooleancreateBoolean(boolean value)Creates a SNMP Boolean object.static com.tivoli.snmp.data.CountercreateCounter(long value)Creates a SNMP Counter object.static com.tivoli.snmp.data.Counter64createCounter64(long value)Creates a 64-bit SNMP Counter object.static com.tivoli.snmp.data.FixedLengthOctetStringcreateFixedLengthOctetString(java.lang.String value)Creates a SNMP OctetString object with fixed length.static com.tivoli.snmp.data.FullCounter64createFullCounter64(java.math.BigInteger value)Creates a SNMP FullCounter64 object.static com.tivoli.snmp.data.GaugecreateGauge(long value)Creates a SNMP Gauge object.static com.tivoli.snmp.data.IPAddresscreateIPAddress(java.lang.String value)Creates a SNMP IPAddress object.static com.tivoli.snmp.data.NoChangecreateNoChange()Creates a SNMP NoChange object.static com.tivoli.snmp.data.NoSuchInstancecreateNoSuchInstance()Creates a SNMP NoSuchInstance object.static com.tivoli.snmp.data.NoSuchObjectcreateNoSuchObject()Creates a SNMP NoSuchObject object.static com.tivoli.snmp.data.NotSupportedcreateNotSupported()Creates a SNMP NotSupported object.static com.tivoli.snmp.data.NullcreateNull()Creates a SNMP Null object.static com.tivoli.snmp.data.OctetStringcreateOctetString(java.lang.String value)Creates a SNMP OctetString object.static com.tivoli.snmp.data.OIDcreateOID(java.lang.String value)Creates a SNMP OID (object identifier) object.static com.tivoli.snmp.data.OpaquecreateOpaque(byte[] value)Creates a SNMP Opaque object.static com.tivoli.snmp.data.TimeTickscreateTimeTicks(long value)Creates a SNMP TimeTicks object.static voidsendTrap(java.lang.String host, int port, java.lang.String oid, java.lang.Object value)Sends an unsolicited SNMP TRAP message for an occurred event.static voidsendTrap(java.lang.String host, int port, java.lang.String community, java.lang.String enterprise, int genericTrap, int specificTrap, java.lang.String oid, java.lang.Object value)Sends an unsolicited SNMP TRAP message for an occurred event.static voidsendTrap(java.lang.String agentIP, java.lang.String host, int port, java.lang.String community, java.lang.String enterprise, int genericTrap, int specificTrap, java.lang.String oid, java.lang.Object value)Sends an unsolicited SNMP TRAP message for an occurred event.
-
-
-
Field Detail
-
SNMP_ENTERPRISE
public static final java.lang.String SNMP_ENTERPRISE
The default value for the manage object's type.- See Also:
- Constant Field Values
-
SNMP_COMMUNITY
public static final java.lang.String SNMP_COMMUNITY
SNMP community string.- See Also:
- Constant Field Values
-
timeout
public static int timeout
A timeout parameter.
-
retries
public static int retries
A parameter determining the number of retries to be made.
-
-
Method Detail
-
sendTrap
public static void sendTrap(java.lang.String host, int port, java.lang.String oid, java.lang.Object value) throws java.lang.ExceptionSends an unsolicited SNMP TRAP message for an occurred event. Uses the local host address as agent IP and default values for community string, managed object's type, generic and specific trap types.- Parameters:
host- the host where the management system is.port- the TCP port to connect to.oid- the object identifier. If oid is null, value must be an Entry where the Attribute names will be used as OIDs.value- the value(s).- Throws:
java.lang.Exception- if a problem occurs.
-
sendTrap
public static void sendTrap(java.lang.String host, int port, java.lang.String community, java.lang.String enterprise, int genericTrap, int specificTrap, java.lang.String oid, java.lang.Object value) throws java.lang.ExceptionSends an unsolicited SNMP TRAP message for an occurred event. Uses the local host address as agent IP.- Parameters:
host- the host where the management system is.port- the TCP port to connect to.community- the SNMP community string.enterprise- the type of managed object that generates the trap.genericTrap- indicates one of a number of generic trap types (coldStart, warmStart, linkUp, linkDown, ...).specificTrap- indicates one of a number of enterprise specific trap codes.oid- the object identifier. If oid is null, value must be an Entry where the Attribute names will be used as OIDs.value- the value(s).- Throws:
java.lang.Exception- if a problem occurs.
-
sendTrap
public static void sendTrap(java.lang.String agentIP, java.lang.String host, int port, java.lang.String community, java.lang.String enterprise, int genericTrap, int specificTrap, java.lang.String oid, java.lang.Object value) throws java.lang.ExceptionSends an unsolicited SNMP TRAP message for an occurred event. It is initialized by the network element and sent to its management system. This way the management system does not have to check all the time the state of each agent's objects. Thus the effectiveness is significantly improved.- Parameters:
agentIP- the IP of the agent sending the message.host- the host where the management system is.port- the TCP port to connect to.community- the SNMP community string.enterprise- the type of managed object that generates the trap.genericTrap- indicates one of a number of generic trap types (coldStart, warmStart, linkUp, linkDown, ...).specificTrap- indicates one of a number of enterprise specific trap codes.oid- the object identifier. If oid is null, value must be an Entry where the Attribute names will be used as OIDs.value- the value(s).- Throws:
java.lang.Exception- if a problem occurs.
-
createBadValue
public static com.tivoli.snmp.data.BadValue createBadValue()
Creates a SNMP BadValue object.- Returns:
- the created object.
-
createBoolean
public static com.tivoli.snmp.data.Boolean createBoolean(boolean value)
Creates a SNMP Boolean object.- Parameters:
value- the boolean parameter to be converted.- Returns:
- the created object.
-
createCounter
public static com.tivoli.snmp.data.Counter createCounter(long value)
Creates a SNMP Counter object.- Parameters:
value- the long parameter to be converted.- Returns:
- the created object.
-
createCounter64
public static com.tivoli.snmp.data.Counter64 createCounter64(long value)
Creates a 64-bit SNMP Counter object.- Parameters:
value- the long parameter to be converted.- Returns:
- the created object.
-
createFixedLengthOctetString
public static com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString(java.lang.String value)
Creates a SNMP OctetString object with fixed length.- Parameters:
value- the String parameter to be converted.- Returns:
- the created object.
-
createFullCounter64
public static com.tivoli.snmp.data.FullCounter64 createFullCounter64(java.math.BigInteger value)
Creates a SNMP FullCounter64 object.- Parameters:
value- the BigInteger parameter to be converted.- Returns:
- the created object.
-
createGauge
public static com.tivoli.snmp.data.Gauge createGauge(long value)
Creates a SNMP Gauge object.- Parameters:
value- the long parameter to be converted.- Returns:
- the created object.
-
createIPAddress
public static com.tivoli.snmp.data.IPAddress createIPAddress(java.lang.String value)
Creates a SNMP IPAddress object.- Parameters:
value- the String parameter to be converted.- Returns:
- the created object.
-
createNoChange
public static com.tivoli.snmp.data.NoChange createNoChange()
Creates a SNMP NoChange object.- Returns:
- the created object.
-
createNoSuchInstance
public static com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
Creates a SNMP NoSuchInstance object.- Returns:
- the created object.
-
createNoSuchObject
public static com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
Creates a SNMP NoSuchObject object.- Returns:
- the created object.
-
createNotSupported
public static com.tivoli.snmp.data.NotSupported createNotSupported()
Creates a SNMP NotSupported object.- Returns:
- the created object.
-
createNull
public static com.tivoli.snmp.data.Null createNull()
Creates a SNMP Null object.- Returns:
- the created object.
-
createOctetString
public static com.tivoli.snmp.data.OctetString createOctetString(java.lang.String value)
Creates a SNMP OctetString object.- Parameters:
value- the String parameter to be converted.- Returns:
- the created object.
-
createOID
public static com.tivoli.snmp.data.OID createOID(java.lang.String value)
Creates a SNMP OID (object identifier) object.- Parameters:
value- the String parameter to be converted.- Returns:
- the created object.
-
createOpaque
public static com.tivoli.snmp.data.Opaque createOpaque(byte[] value)
Creates a SNMP Opaque object.- Parameters:
value- the byte array parameter to be converted.- Returns:
- the created object.
-
createTimeTicks
public static com.tivoli.snmp.data.TimeTicks createTimeTicks(long value)
Creates a SNMP TimeTicks object.- Parameters:
value- the long parameter to be converted.- Returns:
- the created object.
-
-