[SNMP4J] Trap sending from snmp4j agent problem

Vinoj Louis Vinoj.Louis at aricent.com
Wed Nov 21 11:16:06 CET 2007


Yes the remote machine is reachable. 

the exception is coming from socket connection.

 java.io.IOException: Invalid argument
> >         at java.net.PlainDatagramSocketImpl.send(Native Method)
> >         at java.net.DatagramSocket.send(DatagramSocket.java:612)
> >         at
> > org.snmp4j.transport.DefaultUdpTransportMapping.sendMessage(Unknown
> > Source)
> >         at org.snmp4j.MessageDispatcherImpl.sendMessage(Unknown 
Source)
> >         at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
> >         at org.snmp4j.Snmp.sendMessage(Unknown Source)
> >         at org.snmp4j.Snmp.send(Unknown Source)
> >         at org.snmp4j.Snmp.send(Unknown Source)
> >         at
> > 
> 
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.sendNotification(NotificationOriginatorImpl.java:252)
> >         at
> > 
> 
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:318)
> >         at
> > 

-Vinoj.




Jothi P Neelamegam <jothi at verarisoft.com> 
11/21/2007 02:56 PM


To
Vinoj Louis/CHE/HSS at HSS
cc
snmp4j at agentpp.org
Subject
Re: [SNMP4J] Trap sending from snmp4j agent problem






I was wrong, actually you do not need to be a super user to send traps 
to a remote machine, you just need to be a super user to bind to 
privileged ports...

I use the same syntax and it works for me in Linux. Is  your remote 
system reachable from your agent?

Jothi


Vinoj Louis wrote:
>
> I am running it as an super user. even then the problem exists...
>
> Vinoj.
>
>
>
> *Jothi P Neelamegam <jothi at verarisoft.com>*
>
> 11/21/2007 02:38 PM
>
> 
> To
>                Vinoj Louis/CHE/HSS at HSS
> cc
>                snmp4j at agentpp.org
> Subject
>                Re: [SNMP4J] Trap sending from snmp4j agent problem
>
>
>
> 
>
>
>
>
>
> Are you running your agent as root? You need superuser (root) previleges
> to use port 162 in Linux.
>
> Jothi
>
> Vinoj Louis wrote:
> > Hi,
> >
> > I tried using TestAgent.java to send a trap. It worked well in windows
> > machine when I used localhost or 127.0.0.1 in
> >
> >  targetMIB.addTargetAddress(new OctetString("notification"),
> > TransportDomains.transportDomainUdpIpv4,
> >                                new OctetString(new
> > UdpAddress("localhost/162").getValue()),
> >                                200, 1,
> >                                new OctetString("notify"),
> >                                new OctetString("v2c"),
> >                                StorageType.permanent);
> >
> >
> >
> > But when i tried this in a Linux machine with localhost it works. 
> But when
> > i changed to remote host it gives the below exception.....
> >
> >
> >  targetMIB.addTargetAddress(new OctetString("notification"),
> > TransportDomains.transportDomainUdpIpv4,
> >                                new OctetString(new
> > UdpAddress("10.203.121.88/162").getValue()),
> >                                200, 1,
> >                                new OctetString("notify"),
> >                                new OctetString("v2c"),
> >                                StorageType.permanent);
> >
> >
> >
> >
> > java.io.IOException: Invalid argument
> >         at java.net.PlainDatagramSocketImpl.send(Native Method)
> >         at java.net.DatagramSocket.send(DatagramSocket.java:612)
> >         at
> > org.snmp4j.transport.DefaultUdpTransportMapping.sendMessage(Unknown
> > Source)
> >         at org.snmp4j.MessageDispatcherImpl.sendMessage(Unknown 
Source)
> >         at org.snmp4j.MessageDispatcherImpl.sendPdu(Unknown Source)
> >         at org.snmp4j.Snmp.sendMessage(Unknown Source)
> >         at org.snmp4j.Snmp.send(Unknown Source)
> >         at org.snmp4j.Snmp.send(Unknown Source)
> >         at
> > 
> 
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.sendNotification(NotificationOriginatorImpl.java:252)
> >         at
> > 
> 
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:318)
> >         at
> > 
> 
org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:143)
> >         at
> > 
org.snmp4j.agent.BaseAgent.sendColdStartNotification(BaseAgent.java:412)
> >         at org.snmp4j.agent.test.TestAgent.main(TestAgent.java:345)
> >
> >
> > Please give a solution if you have....
> >
> > Thanks in advance,
> >
> > Vinoj.
> >
> >
> >
> >
> >
> >
> > ***********************  Aricent- Confidential ***********************
> > "DISCLAIMER: This message is proprietary to Aricent and is intended 
> solely for the use of
> > the individual to whom it is addressed. It may contain privileged or 
> confidential information and should not be
> > circulated or used for any purpose other than for what it is 
> intended. If you have received this message in error,
> > please notify the originator immediately. If you are not the 
> intended recipient, you are notified that you are strictly
> > prohibited from using, copying, altering, or disclosing the contents 
> of this message. Aricent accepts no responsibility for
> > loss or damage arising from the use of the information transmitted 
> by this email including damage from virus."
> > 
> > 
------------------------------------------------------------------------
> >
> > _______________________________________________
> > SNMP4J mailing list
> > SNMP4J at agentpp.org
> > http://lists.agentpp.org/mailman/listinfo/snmp4j
> > 
>
>
> --
>
> The information contained in this communication may be confidential and 
is
> intended only for the use of the recipient(s) named above.  If the 
reader
> of this communication is not the intended recipient(s), you are hereby
> notified that any dissemination, distribution, or copying of this
> communication, or any of its contents, is strictly prohibited.  If you 
are
> not a named recipient or received this communication by mistake, please
> notify the sender and delete the communication and all copies of it.
>
>
>
>
>
> ***********************  Aricent- Confidential   ***********************
> "DISCLAIMER: This message is proprietary to Aricent and is intended 
solely for the use of 
> the individual to whom it is addressed. It may contain privileged or 
confidential information and should not be 
> circulated or used for any purpose other than for what it is intended. 
If you have received this message in error, 
> please notify the originator immediately. If you are not the intended 
recipient, you are notified that you are strictly
> prohibited from using, copying, altering, or disclosing the contents of 
this message. Aricent accepts no responsibility for 
> loss or damage arising from the use of the information transmitted by 
this email including damage from virus."
> 
>


--

The information contained in this communication may be confidential and is
intended only for the use of the recipient(s) named above.  If the reader
of this communication is not the intended recipient(s), you are hereby
notified that any dissemination, distribution, or copying of this
communication, or any of its contents, is strictly prohibited.  If you are
not a named recipient or received this communication by mistake, please
notify the sender and delete the communication and all copies of it.
 




***********************  Aricent- Confidential   ***********************
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of 
the individual to whom it is addressed. It may contain privileged or confidential information and should not be 
circulated or used for any purpose other than for what it is intended. If you have received this message in error, 
please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for 
loss or damage arising from the use of the information transmitted by this email including damage from virus."


More information about the SNMP4J mailing list