[SNMP4J] Trap sending from snmp4j agent problem

Jothi P Neelamegam jothi at verarisoft.com
Wed Nov 21 10:08:19 CET 2007


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.
 




More information about the SNMP4J mailing list