Tsiyona,
I have done similar checking on after extracting the ip-address using
getPeerAddress method of the CommandResponderEvent.
For example you do something like:
public void processPdu(CommandResponderEvent event) {
String ipAddr = getIpAddr(event.getPeerAddress().toString());
........
........
}
private String getIpAddr(String ipAddr) {
String ipAddress = null;
ipAddress = ipAddr.split("/")[0].trim();
return ipAddress;
}
-Amarnath
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of [email protected]
Sent: Monday, August 23, 2010 3:30 PM
To: [email protected]
Subject: SNMP4J Digest, Vol 79, Issue 17
Send SNMP4J mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.agentpp.org/mailman/listinfo/snmp4j
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of SNMP4J digest..."
Today's Topics:
1. How to handle traps that come from a specific ip address only
(Tsiyona)
----------------------------------------------------------------------
Message: 1
Date: Mon, 23 Aug 2010 10:08:24 +0300
From: Tsiyona <[email protected]>
Subject: [SNMP4J] How to handle traps that come from a specific ip
address only
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Hello,
I am writing a trap receiver that only intercepts traps and analyzes
them.
In our system we have two servers on which snmp agents are generating
traps.
At a given time, only one server out of the two is an active server,
meaning
that only this
server's traps are to be processed, while the other server's traps are
to be
ignored.
These two servers have distinct ip addresses (different from one
another's).
Is there a way I can open an snmp session and start listening only for
traps
that
arrive from a specific ip address (i.e. from the active serve's ip
address
only) ?
Of course I could check the agent address in each received trap pdu and
ignore those
traps that come from a non-active server, but I am asking here whether
snmp4j infrastructure
itself provides means of doing that.
Thanks,
Tsiyona
------------------------------
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j
End of SNMP4J Digest, Vol 79, Issue 17
**************************************
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j