|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sun.management.snmp.agent.SnmpTrapReceiver
com.sun.management.snmp.agent.SnmpTrapForwarder
This MBean allows you to receive traps of subagents and forward them to managers.
This trap forwarder listen on a dedicated port and forward traps according to its configuration.
If you activate V1, V2 and V3 protocols, every received trap (in V1 / V2 or V3) will be forwarded in all SNMP protocols. It can be useful when you don't know which protocol the managers are using.
You can pass specific manager addresses when forwarding for a
specific protocol. By default the InetAddressAcl is also
parsed. So the set of actual manager addresses is the trap blocks located
in the acl file and the set of added targets. You can disable the use of
InetAddressAcl by calling the method
isInetAddressAclUsed.
To enable trap forwarding you must start the forwarder.
WARNING : In case you have some manager addresses in your set of
targets that are also present in InetAddressAcl (or no InetAddressAcl
activated but a target equals to localhost), your manager will receive
the trap twice. In order to protect yourself against this behavior,
configure carefully the SnmpTrapForwarder. You can, for
example, disable the InetAddressAcl parsing by calling
isInetAddressAclUsed(false).
| Constructor Summary | |
SnmpTrapForwarder(SnmpV3AdaptorServer server,
int port)
Instantiate a SnmpTrapForwarder that will forward
received traps according to its configuration. |
|
SnmpTrapForwarder(SnmpV3AdaptorServer server,
int port,
InetAddress address)
Instantiate a SnmpTrapForwarder that will
forward received traps according to its configuration. |
|
| Method Summary | |
void |
addV1Target(String address,
int port,
String communityString)
Add a target to which SNMP V1 traps will be forwarded to. |
void |
addV1Target(String address,
String communityString)
Add a target to which SNMP V1 traps will be forwarded to. |
void |
addV2Target(String address,
int port,
String communityString)
Add a target to which SNMP V2 traps will be forwarded to. |
void |
addV2Target(String address,
String communityString)
Add a target to which SNMP V2 traps will be forwarded to. |
void |
addV3Target(String address,
int port,
String principal,
String contextName,
int securityLevel)
Add a target to which SNMP V3 traps will be forwarded to. |
void |
addV3Target(String address,
String principal,
String contextName,
int securityLevel)
Add a target to which SNMP V3 traps will be forwarded to. |
void |
forwardAsNotificationOriginator()
By default a trap is sent as a notification originator. |
void |
forwardAsProxy()
By default a trap is sent as a notification originator. |
boolean |
isInetAddressAclUsed()
Says if The SnmpTrapForwarder parses or not the
InetAddressAcl when forwarding traps. |
boolean |
isOriginatorWay()
By default a trap is sent as a notification originator. |
boolean |
isProxyWay()
By default a trap is sent as a notification originator. |
boolean |
isV1Activated()
Return true if Snmp V1 forwarding is activated. |
boolean |
isV2Activated()
Return true if Snmp V2 forwarding is activated. |
boolean |
isV3Activated()
Return true if Snmp V3 forwarding is activated. |
protected void |
receivedTrap(SnmpTrap trap)
You must implement this method in order to handle received traps in a generic way. |
boolean |
removeV1Target(String address)
Remove the first occurrence of the passed target. |
boolean |
removeV1Target(String address,
int port)
Remove the first occurrence of the passed target. |
boolean |
removeV2Target(String address)
Remove the first occurrence of the passed target. |
boolean |
removeV2Target(String address,
int port)
Remove the first occurrence of the passed target. |
boolean |
removeV3Target(String address)
Remove the first occurrence of the passed target. |
boolean |
removeV3Target(String address,
int port)
Remove the first occurrence of the passed target. |
void |
setCommunityString(String cs)
When forwarding in SNMP V1 and or V2, if useInetAddressAcl is activated and no ACL file or no destinations are available, the trap is sent to the local host using this specified community string. |
void |
setInetAddressAclUsed(boolean use)
By default if an InetAddressAcl file is loaded by the
SNMP adaptor, it will be parsed in order to find manager IP addresses. |
void |
setSourceIpAddress(InetAddress addr)
When a trap is received, localhost is set as the source of the forwarded trap. |
void |
setV3Parameters(String principal,
String contextName,
int securityLevel)
When forwarding in Snmp V3, the default principal, context and security level to use. |
void |
snmpV1forwarding(boolean status)
Activate or deactivate SNMP V1 trap forwarding without providing targets (using the method addV1Target). |
void |
snmpV2forwarding(boolean status)
Activate or deactivate SNMP V2 trap forwarding without providing targets (using the method addV2Target). |
void |
snmpV3forwarding(boolean status)
Activate or deactivate SNMP V3 trap forwarding without providing targets (using the method addV3Target). |
| Methods inherited from class com.sun.management.snmp.agent.SnmpTrapReceiver |
createCallbackTaskServer, createDispatcherThread, createPacketTaskServer, receiveAsGeneric, receivedV1Trap, receivedV2Trap, receivedV3Trap, start, stop |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SnmpTrapForwarder(SnmpV3AdaptorServer server,
int port)
SnmpTrapForwarder that will forward
received traps according to its configuration.
server - The current adaptor.port - The port the forwarder is listening to.
public SnmpTrapForwarder(SnmpV3AdaptorServer server,
int port,
InetAddress address)
SnmpTrapForwarder that will
forward received traps according to its configuration.
server - The current adaptor.port - The port the forwarder is listening to.address - The address used to listen for incoming traps.| Method Detail |
public void setCommunityString(String cs)
cs - The default community string to use.
public void setV3Parameters(String principal,
String contextName,
int securityLevel)
principal - Will be used by Usm in order to find security
parameters.contextName - The forwarded trap contextName.securityLevel - The message security level.public void setInetAddressAclUsed(boolean use)
InetAddressAcl file is loaded by the
SNMP adaptor, it will be parsed in order to find manager IP addresses.
This parsing is done when forwarding in SNMP V1 V2 and V3. In the
case of SNMP V3 forwarding, the parsed targets are used only if the
SNMP V3 parameters have been provided (via setV3Parameters method).
If you provided some targets (addV1/2/3Target methods) they are
also used when forwarding traps. The set of targets is
InetAddressAcl trap blocks + added targets.
If you don't use InetAddressAcl (passing false to this
method), only the set of added targets is used.
setInetAddressAclUsed in interface SnmpTrapForwarderMBeanuse - The use of InetAddressAclpublic boolean isInetAddressAclUsed()
SnmpTrapForwarder parses or not the
InetAddressAcl when forwarding traps.
isInetAddressAclUsed in interface SnmpTrapForwarderMBeanpublic boolean isV1Activated()
isV1Activated in interface SnmpTrapForwarderMBeanpublic boolean isV2Activated()
isV2Activated in interface SnmpTrapForwarderMBeanpublic boolean isV3Activated()
isV3Activated in interface SnmpTrapForwarderMBeanpublic void snmpV1forwarding(boolean status)
addV1Target). InetAddressAcl
or localhost are used as the default targets.
snmpV1forwarding in interface SnmpTrapForwarderMBeanstatus - True activate it, false deactivate it.public void snmpV2forwarding(boolean status)
addV2Target). InetAddressAcl
or localhost are used as the default targets.
snmpV2forwarding in interface SnmpTrapForwarderMBeanstatus - True activate it, false deactivate it.public void snmpV3forwarding(boolean status)
addV3Target). InetAddressAcl
or localhost are used as the default targets.
snmpV3forwarding in interface SnmpTrapForwarderMBeanstatus - True activate it, false deactivate it.public boolean removeV1Target(String address)
removeV1Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).
public boolean removeV2Target(String address)
removeV2Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).
public boolean removeV3Target(String address)
removeV3Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).
public boolean removeV1Target(String address,
int port)
removeV1Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).port - The port to which the trap is sent.
public boolean removeV2Target(String address,
int port)
removeV2Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).port - The port to which the trap is sent.
public boolean removeV3Target(String address,
int port)
removeV3Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name).port - The port to which the trap is sent.
public void addV1Target(String address,
int port,
String communityString)
SnmpV3AdaptorServer is impacted. The port changing is
effective when sending the trap. Concurrent call to
SnmpV3AdaptorServer trap API can lead to unpredictable
behavior.
The same target can be added multiple time.
addV1Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);port - The port to which the trap is sent. If port == -1, the
adaptor port is used.communityString - The associated community string.
IllegalArgumentException - If the the port is == 0 or
the address is invalid (cause field set to
java.net.UnknownHostException if JDK Version >= 1.4).
public void addV2Target(String address,
int port,
String communityString)
SnmpV3AdaptorServer is impacted. The port changing is
effective when sending the trap. Concurrent call to
SnmpV3AdaptorServer trap API can lead to unpredictable
behavior.
The same target can be added multiple time.
addV2Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);port - The port to which the trap is sent. If port == -1, the
adaptor port is used.communityString - The associated community string.
IllegalArgumentException - If the the port is == 0 or
the address is invalid (cause field set to
java.net.UnknownHostException if JDK Version >= 1.4).
public void addV3Target(String address,
int port,
String principal,
String contextName,
int securityLevel)
SnmpV3AdaptorServer is impacted. The port changing is
effective when sending the trap. Concurrent call to
SnmpV3AdaptorServer trap API can lead to unpredictable
behavior.
The same target can be added multiple time.
addV3Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);port - The port to which the trap is sent. If port == -1, the
adaptor port is used.principal - The user.contextName - The context name.securityLevel - The security level.
IllegalArgumentException - If the the port is == 0,
if the principal is null, if the security level is not valid or if
the address is invalid (cause field set to
java.net.UnknownHostException if JDK Version >= 1.4).
public void addV1Target(String address,
String communityString)
SnmpV3AdaptorServer one.
The same target can be added multiple time.
addV1Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);communityString - The associated community string.
IllegalArgumentException - If the address is invalid
(cause field set to java.net.UnknownHostException
if JDK Version >= 1.4).
public void addV2Target(String address,
String communityString)
SnmpV3AdaptorServer one.
The same target can be added multiple time.
addV2Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);communityString - The associated community string.
IllegalArgumentException - If the address is invalid
(cause field set to java.net.UnknownHostException
if JDK Version >= 1.4).public void forwardAsNotificationOriginator()
public void forwardAsProxy()
public boolean isOriginatorWay()
public boolean isProxyWay()
public void setSourceIpAddress(InetAddress addr)
isProxyWay() returns
true, the source address is the received one.
addr - The source address to use when forwarding the trap.
public void addV3Target(String address,
String principal,
String contextName,
int securityLevel)
SnmpV3AdaptorServer one.
The same target can be added multiple time.
addV3Target in interface SnmpTrapForwarderMBeanaddress - The target address (IP or name);principal - The user.contextName - The context name.securityLevel - The security level.
IllegalArgumentException - If the principal is null,
if the security level is not valid or if the address is invalid
(cause field set to java.net.UnknownHostException
if JDK Version >= 1.4).protected void receivedTrap(SnmpTrap trap)
SnmpTrapReceiver
receivedTrap in class SnmpTrapReceivertrap - The received trap pdu.
|
FCS Release jdmk-5_1-b34.2 2005.11.29_16:24:00_MET |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||