Re: [SNMP4J] VLANs

2010-11-08 Thread jaikar gupta
Dear Chaim,

My suggestion would be.

 Put the IP Address in some property file.
 then do the following

ResourceBundle msgBundle = ResourceBundle.getBundle(propertyFile_PATH);

String nic_ip=msgBundle.getString(SPECIFIED_NIC_IP);

InetAddress inetAddress= InetAddress.getByName(nic_ip);
UdpAddress udp=new UdpAddress(inetAddress,0);

TransportMapping transport = new DefaultUdpTransportMapping(udp);

Snmp snmp = new Snmp(transport);


Thanks  Regards

keepFaith,
Jaikar Gupta



On Tue, Nov 9, 2010 at 12:38 PM, Chaim Turkel - HQ cha...@gilat.com wrote:

 I need to add support for Vlans.
 In the case the machine has multiple nic's I needs to option to send the
 snmp packit via the correct nic and cannot use the default gateway,
 How can I do this?

 Chaim Turkel

 Network Management Systems
 Gilat Network Systems
 Tel: +972-3-929-3142


 IMPORTANT - This email and any attachments is intended for the above named
 addressee(s), and may contain information which is confidential or
 privileged. If you are not the intended recipient, please inform the sender
 immediately and delete this email: you should not copy or use this e-mail
 for any purpose nor disclose its contents to any person.

 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j

___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Re: [SNMP4J] A Simple Trap Receiver using snmp4j

2010-08-17 Thread jaikar gupta
Hi,

I had also the same problem, i had uses the the same methodology, but when i
change the
TRAP_ADRESS to 0.0.0.0/162, the it starts receiving TRAPS.

try this may this will help you.

Thanks  Regards
Jaikar Gupta


On Tue, Aug 17, 2010 at 2:06 PM, Tsiyona tsiy...@gmail.com wrote:

 Hello,

 I am trying to write a simple snmp manager that listens to traps on port
 162
 and processes them. This manager will only handle traps, and does not need
 to send commands to agents.

 Attached is the code I wrote. It is straightforward, but it does not work -
 I do not get any snmp traps.
 I make sure that the snmp agent really constantly generates traps, by using
 a network sniffer, so my
 problem is not lack of traps on the agent side. I am probably doing
 something wrong.

 Can anyone please help me?

 Thanks,
 Tsiyona



 -
My code:

 -

 package snmpmanager;

 import java.io.IOException;

 import org.snmp4j.CommandResponder;
 import org.snmp4j.CommandResponderEvent;
 import org.snmp4j.PDU;
 import org.snmp4j.Snmp;
 import org.snmp4j.TransportMapping;
 import org.snmp4j.smi.UdpAddress;
 import org.snmp4j.transport.DefaultUdpTransportMapping;
 import org.snmp4j.transport.TransportMappings;

 /**
 * A Simple Trap receiver using snmp4j.
 */
 public class SnmpClient
 {

 public static final String TRAP_ADDRESS = 127.0.0.1/162;//udp:
 127.0.0.1/162;
  private TransportMapping transport;
 private String listeningAddress;
  private Snmp snmp;

 public SnmpClient(String address)
 {
  this.listeningAddress = address;
 try {
 start();
  } catch (IOException e) {
 e.printStackTrace();
 throw new RuntimeException(e);
  }
 }

 private void start() throws IOException
  {
 UdpAddress udpAddress = new UdpAddress(this.listeningAddress);
 transport = new DefaultUdpTransportMapping(udpAddress);
  snmp = new Snmp(transport);
 transport.listen();
  CommandResponder pduHandler = new CommandResponder() {
 public synchronized void processPdu(CommandResponderEvent e) {
   PDU pdu = e.getPDU();
   if (pdu != null) {
   System.out.println(pdu);
   }
 }
 };
  snmp.addCommandResponder(pduHandler);
 }
  public void stop() throws IOException
 {
  snmp.close();
 }

 public static void main(String[] args)
  {
 SnmpClient client = new SnmpClient(TRAP_ADDRESS);
 System.out.println(Listening for traps on address  + TRAP_ADDRESS);
  }
 }

 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j


___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


[SNMP4J] SNMP Traps V1 V2

2010-05-31 Thread jaikar gupta
Hello All,

Can any please tell the format of V1  V2 traps so that i can figure out the
important information from it regardless of the device which sends it.
basically i would like to know the following things.

1) Version of the Trap.
2) and how to find the important information e.g. Link Up/down info, port no
etc.


Thanks  Regards
Jaikar Gupta
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Re: [SNMP4J] TRAP source IP on manager side

2010-05-28 Thread jaikar gupta
One can get it by using below code in public void
processPdu(CommandResponderEvent e) method:-

UdpAddress udpHostAdress = (UdpAddress) e.getStateReference().getAddress();


Thanks  Regards
Jaikar Gupta


On Sat, May 29, 2010 at 10:48 AM, Prakash Kolandaivelu 
visitprakashin...@gmail.com wrote:

 If you know answer you can post here , it may be helpful for other people
 who are looking for the answers.

 Thanks,
 Prakash
 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j

___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


[SNMP4J] geting the IP address and sender OID of trap sending equipment

2010-05-20 Thread jaikar gupta
Hello Friends,

I would like to know, how i can get the IP address and sender OID of trap
sending equipment in processPdu method.


Thanks  Regards
Jaikar Gupta
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Re: [SNMP4J] geting the IP address and sender OID of trap sending equipment

2010-05-20 Thread jaikar gupta
Hello Aidan Diffey
*
*
*Thanks for the quick response.*
*
*Thanks  Regards
Jaikar Gupta


On Thu, May 20, 2010 at 3:27 PM, Aidan Diffey
aidan.dif...@googlemail.comwrote:

 The processPdu method takes a CommandResponderEvent object.

 Using this, you can do

   UdpAddress udpHostAdress = (UdpAddress) event.getStateReference().

 getAddress();

 Then, you can do
udpHostAdress.getInetAddress().getHostAddress()

 Cheers



 On Thu, May 20, 2010 at 10:15 AM, jaikar gupta gupta.jai...@gmail.comwrote:

 Hello Friends,

 I would like to know, how i can get the IP address and sender OID of trap
 sending equipment in processPdu method.


 Thanks  Regards
 Jaikar Gupta

 ___
 SNMP4J mailing list
 SNMP4J@agentpp.org
 http://lists.agentpp.org/mailman/listinfo/snmp4j



___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j