[SNMP4J] FW: Need Help

Ashish Kumar Maheshwari Ashish_Maheshwari at hcl.com
Wed Sep 29 06:31:23 CEST 2010


Hi,
      Thanks for your kind help.

Is there is any class in the SNMP4j that can combined all the hosts and then we can send the traps to the multiple host.
Right now I am using the following code,

            Address targetAddress = GenericAddress.parse(addressStr); addressStr that contains the host IP address
            TransportMapping transport = new DefaultUdpTransportMapping();
            Snmp snmp = new Snmp(transport);
            CommunityTarget target = new CommunityTarget();
            target.setCommunity(new OctetString(communityNameStr));
            target.setAddress(targetAddress);
            target.setRetries(retriesInt);
            target.setTimeout(timeoutLong);
            target.setVersion(SnmpConstants.version1);

Is any method is provided in the Address class to support the multiple host IP address , so that in a single line of code
SNMP Traps can be send on the multiple host.

Any suggestions are highly appreciated.

Needless to mention your help in this regard is highly valuable.

Thanks
Ashish




From: Ivan Mladenović [mailto:piffta at gmail.com]
Sent: Wednesday, September 29, 2010 2:21 AM
To: Ashish Kumar Maheshwari
Subject: Re: [SNMP4J] FW: Need Help

Hi,

I'm not sure for SNMP v1, but in version 2c you just need to create multiple instances of CommunityTarget class and then you can use these instances to send alarms

I hope the following example will help:

UdpAddress managerUdpAddress = new UdpAddress(InetAddress.getByName("127.0.0.1"), 162);

CommunityTarget communityTarget = new CommunityTarget(managerUdpAddress,
snmpAlarmConfiguration.getCommunityName());
communityTarget.setVersion(SnmpConstants.version2c);
communityTarget.setRetries(1);
communityTarget.setTimeout(500);

And then you can send alarm:

PDU trapPdu = new PDU();
trapPdu.setType(PDU.TRAP);
trapPdu.add(new VariableBinding(new OID(SYS_UP_TIME), new TimeTicks(sysUpTime)));
trapPdu.add(new VariableBinding(new OID(SNMP_TRAP_OID), alarmOID));
trapPdu.add(new VariableBinding(alarmOID, new Integer32(alarmSeverity)));

snmp.notify(trapPdu, communityTarget);


Best regards




On Tue, Sep 28, 2010 at 7:43 AM, Ashish Kumar Maheshwari <Ashish_Maheshwari at hcl.com<mailto:Ashish_Maheshwari at hcl.com>> wrote:
Hi ,
      Am using SNMP4j for sending the SNMP Traps (Version 1) on a single host, but now I want to send the SNMP Traps on a multiple host. Could anyone guide me in this regard.

Any suggestions in this regard is highly appreciated.

Thanks
Ashish


From: Ashish Kumar Maheshwari
Sent: Tuesday, September 28, 2010 10:16 AM
To: 'snmp4j-request at agentpp.org<mailto:snmp4j-request at agentpp.org>'
Cc: 'snmp4j at agentpp.org<mailto:snmp4j at agentpp.org>'; 'snmp4j-owner at agentpp.org<mailto:snmp4j-owner at agentpp.org>'; 'snmp4j-request at agentpp.org<mailto:snmp4j-request at agentpp.org>'
Subject: FW: Need Help

Hi ,
      Am using SNMP4j for sending the SNMP Traps (Version 1) on a single host, but now I want to send the SNMP Traps on a multiple host. Could anyone guide me in this regard.

Any suggestions in this regard is highly appreciated.

Thanks
Ashish


From: Ashish Kumar Maheshwari
Sent: Tuesday, September 28, 2010 10:10 AM
To: 'snmp4j at agentpp.org<mailto:snmp4j at agentpp.org>'
Subject: Need Help

Hi ,
      Am using SNMP4j for sending the SNMP Traps (Version 1) on a single host, but now I want to send the SNMP Traps on a multiple host.Could any one guide me in this regard.

Any suggestions in this regard is highly appreciated.

Thanks
Ashish

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org<mailto:SNMP4J at agentpp.org>
http://lists.agentpp.org/mailman/listinfo/snmp4j




More information about the SNMP4J mailing list