Writing trap listener using netsnmpj for net-snmp apis

I wanted to write a trap listener using netsnmpj.
Could anybody help me regarding this.

The following is the code for trap listener which i took from the example provided in the netsnmpj
I am new to coding as well as to this forum so i am little bit confused.
public class TrapListener {
static OID sysDescrOID ;
static class MyListener implements NetSNMPAction {
public synchronized boolean actionPerformed(int result, NetSNMPSession sess, PDU rcvPdu, Object o) {
System.out.println("Received Trap");
ASNValue val = rcvPdu.findValue(sysDescrOID) ;
this.notify() ;
if( result == NetSNMP.STAT_TIMEOUT ) {
System.err.println("Timeout no response") ;
return false ; // don't call other registered listeners
System.out.println("got sysDescr = " + val) ;
return true ; // continue to call other registered listeners
public static void main(String[] args) throws MIBItemNotFound, NetSNMPSendError, IllegalStateException, InterruptedException {
NetSNMPSession sess ;
NetSNMPAction myListener = new MyListener() ;
String host, community ;
host = "<IP>:162" ;
community = "public" ;
* Open a session to the agent
     sess = new NetSNMPSession(host, community) ;
//sess = new NetSNMPSession();
System.out.println("The NetSNMPSession is : "+sess);
//sess.setSNMPVersion(NetSNMP.SNMPv2c);
sess.setSNMPVersion(NetSNMP.SNMPv1);
          sess.setCommunity(community) ;
     sess.setPeerName(host) ;
                    sess.addListener(myListener) ;
try {
sess.open() ;
catch( IllegalStateException e ) {
System.err.println("caught " + e + " " + host ) ;
System.out.println("SNMP Version is : "+sess.getSnmpVersion());
sysDescrOID = new DefaultOID("SNMPv2-MIB::sysDescr.0") ;
     //PDU pdu = new PDU(NetSNMP.MSG_GET) ;
//pdu.addNullEntry(sysDescrOID) ;
synchronized( myListener ) {
                         //sess.send(pdu, null) ;
System.out.println("Waiting for the Trap");
                         myListener.wait() ;
System.out.println("Waiting for the Trap 1");
                    } // synchronized
}

Similar Messages

  • Reading/Writing .xlsx files using Webdynpro for Java

    Dear All
    I have a requirement to read/write excel files in .xlsx format. I am good in doing it with .xls format using jxl.jar. The jxl.jar doesn't support .xlsx format. Kindly help me in understanding how do I need to proceed on reading/writing .xlsx files using Webdynpro for Java.
    Thanks and Regards
    Ramamoorthy D

    i am using jdk 1.6.22 and IBM WebSphere
    when i use poi-3.6-20091214.jar and poi-ooxml-3.6-20091214.jar  to read .xlsx file. but i am getting following errors
    The project was not built since its classpath is incomplete. Cannot find the class
    file for java.lang.Iterable. Fix the classpath then try rebuilding this project.
    This compilation unit indirectly references the missing type java.lang.Iterable
    (typically some required class file is referencing a type outside the classpath)
    how can i resolve it
    here is the code that i have used
    public class HomeAction extends DispatchAction {
         public ActionForward addpage(
                             ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                             throws Exception {     
                             String name = "C:/Documents and Settings/bharath/Desktop/Book1.xlsx";
               FileInputStream fis = null;
               try {
                   Object workbook = null;
                    fis = new FileInputStream(name);
                    XSSFWorkbook wb = new XSSFWorkbook(fis);
                    XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0);
                    Iterator rows = sheet.rowIterator();
                    int number=sheet.getLastRowNum();
                    System.out.println(" number of rows"+ number);
                    while (rows.hasNext())
                        XSSFRow row = ((XSSFRow) rows.next());
                        Iterator cells = row.cellIterator();
                        while(cells.hasNext())
                    XSSFCell cell = (XSSFCell) cells.next();
                    String Value=cell.getStringCellValue();
                    System.out.println(Value);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    if (fis != null) {
                         fis.close();
                return mapping.findForward("returnjsp");

  • How to use d2kwutil for calling win-api programs in form 6i

    I WANT TO USE d2kwutil for calling win-api programs in form 6i.
    PLEASE GIVE ME IT'S SOLUTION.

    D2kwutil comes with a Demo Form WAPIDEMO - you can run this to see every function demonstrated. You can even run a function using the demo form and copy the syntax required directly into your own form -------------------------
    yes in have got that WAPIDEMO from web and run successfully but
    i can not do those codes in my owdn form.Because i do not get those apis like
    win_app_session in form 6i.
    Again i could not understand how that form runs without connecting to database.
    Please describe the solution.

  • How to configure traps when using snmpv3 for Airwave and controller communication

    Requirement:
    Airwave monitoring or managing controllers, using SNMPv3 for communication.
    Solution:
    Usage of SNMP v3 for communication over SNMP V2c is increasing rapidly for its enhanced security. Like wise, SNMP v3 informs are also more secured compare to SNMP v2c traps.
    SNMP v3 informs work differently, when compared to SNMP v2c traps.  As, informs would need a received receipt from the trap receiver. Therefore it requires more configuration from Airwave side as well.
    Configuration:
    We need to configure the SNMP v3 inform user on Airwave, under device setup --> communication as shown below:
    We need to use the same user name to configure on the controller as well, as shown below:
    Controller GUI > Configuration > under management > SNMP > Trap recievers:
    Verification
    After the configuration, we could see the traps(Informs) showing on the Airwave GUI, System --> Syslogs & Traps, as shown below:
    We could also see in the packet capture taken from Airwave, that the controller is sending the Traps and Airwave is Acknowledging them as shown below:
    In the above example, .116 is the Airwave IP and .231 is the controller IP.

    My first question is how to create Sync-Async bridge in XI without using BPM.
    Just make a search on SDN, there is blog which mentiones how to do Sync_Async bridge without BPM (for JMS)
    "how to route this Interface mapping in Integration directory as in this case there is no backend call....its just the Java
    mapping inside an Interface mapping"
    Include the Interface mapping in the appropriate Interface Determination in ID for a particular set of source and target.
    and third I m trying to call an IDOC which is populated with the response of the Java mapping....but how to route it in
    Integration Directory ??
    same as mentioned for Q2....in Interface Determination....if it is a Sync call then the Request & Response Mapping will be in same Interface Mapping and then in same Interface Determination......it is the normal way.....I hope that i have not missed/ overlooked something from your queries!
    Regards,
    Abhishek.

  • OEL 5.9: Effect of removing net-snmp to kernal

    Hi,
    I have situation where i have to install custom rpms for net-snmp.
    What will happen or what ll be the effect of removing the net-snmp,net-snmp-utils and net-snmp-perl rpms from the system forcefully?
    I see a dependency to oracle-linux kernal rpms.
    Please help me in this regards
    Thanks in advance
    Kushal

    I have situation where i have to install custom rpms for net-snmp.Why? How are the distribution RPM packages deficient?
    What will happen or what ll be the effect of removing the net-snmp,net-snmp-utils and net-snmp-perl rpms from the system forcefully?
    I see a dependency to oracle-linux kernal rpms.The oracle-linux RPM lists these as requirements; that is not the kernel. So, whatever you do with the net utils, you won't hurt the kernel; you may just disable your SNMP support.
    Any approach that mentions "--force" is automatically suspect. You can only use the "--force" switch once in your career; are you sure this is the time? :)
    So if you want to use your own RPM packages they should have higher revision number than your currently-installed packages, so they should just update normally.
    What am I missing?

  • Net snmp&&labwindows

     i need make a snmp tool with labwindows,but i use net-snmp api ,and complie it,but there are many fails,
    i have no idea to deal with them.
    include two h file----
           #include <net-snmp/net-snmp-config.h>
           #include <net-snmp/net-snmp-includes.h>
    1.typedef unsigned __int32 uint32_t; fail
    2.winnt.h                                        fail
     somebody can help me ??
    Attachments:
    1.JPG ‏85 KB

    I'm sorry, maybe the SNMP is not supported in NI production now.

  • Failed to start Oracle Net Listener using

    hi
    I ' trying to configure oracle 10g in ubuntu machine. I got the following errors like
    Starting Oracle Database 10g Express Edition Instance.
    Failed to start Oracle Net Listener using /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr and Oracle Express Database using /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus
    when ever i try to start oracle,i have got above issue

    ya .... i hav found listener.log file.
    Also when i try to run this cmd # sqlplus / as sysdba
    i got following error like
    Error 46 initializing SQL*Plus
    HTTP proxy setting has incorrect value
    SP2-1502: The HTTP proxy server specified by http_proxy is not accessible
    also when i stop the listener and try try to restart it again ....i got error message like
    Starting /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnr: please wait...
    TNSLSNR for Linux: Version 10.2.0.1.0 - Production
    NL-00280: error creating log stream /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/log/listener.log
    NL-00278: cannot open log file
    SNL-00016: snlfohd: error opening file
    Linux Error: 13: Permission denied
    Listener failed to start. See the error message(s) above...

  • Different Source Address for a SNMP trap paquet

    We use a common platform to manage the CISCO routers for several customers. We are using to manage the devices w/ a loopback address as source of snmp paquet.
    We use something like this ...
    Router(config)#snmp-server host 172.25.1.1 ORATRAP
    Router(config)#snmp-server trap-source loopback0
    Router(config)#end
    Now, there is some customers that request us to receipt the snmp-traps w/ an ip source of their own ip space (192.168.2.x/24).I cannot imagine how this can be achieve?... Please any idea?. Thks. Eduard.

    Thks., for your help. This is important matter to us. We also working in the idea of snmp track collector close to our own NMC... but this may cost also money... . So, we are going to try another approach first..
    Somewhat like this below....
    snmp-server enable traps
    snmp-server informs
    snmp-server source-interface traps
    snmp-server source-interface informs
    snmp-server host traps version 1 community string publicCust
    snmp-server host informs version 2 community string publicBT
    For the get's every MNC sends to the declared IP, so We thing that will use the same IP in answer.
    I will let you know. Eduard.

  • Database configuration warning use netca for listener

    Hi,
    I am using Red Hat 5.4 AS 32 bit and want to install oracle 11gR2 32 bit.
    Problem is occurring when installation is going on last
    Warning Message is like "listener is not configure use netca"
    Thanks in advance

    After correction port in listener
    [oracle@tsh admin]$ lsnrctl start
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-OCT-2012 15:06:01
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Starting /oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
    TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    System parameter file is /oracle/product/11.2.0/db_1/network/admin/listener.ora
    Log messages written to /oracle/diag/tnslsnr/tsh/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.170.200.96)(PORT=1538)))
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 27-OCT-2012 15:06:03
    Uptime 0 days 0 hr. 0 min. 0 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File /oracle/diag/tnslsnr/tsh/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.170.200.96)(PORT=1538)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "tsh" has 1 instance(s).
    Instance "tsh", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    [oracle@tsh admin]$
    Listener.ora
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.170.200.96)(PORT = 1538))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /oracle/product/11.2.0/db_1)
    (PROGRAM = extproc)
    (SID_DESC =
    (ORACLE_HOME = /oracle/product/11.2.0/db_1)
    (SID_NAME = tsh)
    ADR_BASE_LISTENER = /oracle
    tnsanes.ora
    TSH =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.170.200.96)(PORT = 1538))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = tsh.ag.com)
    )

  • I just installed the Lion operating system, basically to upgrade my iPhone. I didn't realize that my Microsoft Office 2004 application would no longer work. I have been using Word for my writing and I receive most of my emails with Word attachments. I hav

    I just installed the Lion operating system, basically to upgrade my iPhone. I didn't realize that my Microsoft Office 2004 application would no longer work. I have been using Word for my writing and I receive most of my emails with Word attachments. I have been using Apple products for years, always touting their reliability and customer service. I am not a techie, I just want to be able to do what I do on the computer and Apple always fulfilled my needs. Now I am told because of some operating system gobbledygook, I have to go out and purchase new software to use Word. This is despicable. I see no particular benefit to using Lion, but I do see a lot of detriments. Apple now seems to have turned into Microsoft, making software obsolete so they can make more money and to **** with the customer. You can be sure that my next computer will be a PC. I have completely lost confidence in Apple.

    I seem to never tire of saying this. It was for Apple when they first announced 10.7 to disclose this. Yes, it was widely reported -- or rather, rumored -- but not by Apple. And many people who have gotten caught by this assumed that Apple itself would have told them beforehand about the loss of this very important feature which they had come to rely on. As far as I know, not even in fine print, does this appear anywhere on the Lion announcement or any of its links.
    I am not saying Apple had to continue Rosetta in Lion, or forever, just that if it was going to be dropped, it should have been made known.
    As relative "insiders" we should not forget that many people don't have the time, habit or interest to do this kind of research. I think it is a breach of trust that Apple has never directly made this announcement or given people the opportunity to decide beforehand if giving up their PPC apps for a new OS is a worthwhile tradeoff.

  • Net Price showing zero while using BAPI_PO_CREATE1 for me21n

    Dear All,
    I am using BAPI_PO_CREATE1 for ME21N. The problem is, after execution of the program the error msg it shows-
    No instance of object type PurchaseOrder has been created. External reference:
    Purchase order still contains faulty items
    Net price must be greater than 0
    The values are coming from excel file.
    Please tell me where I am doing wrong.
    With regards,
    Rosaline.

    Hi,
    Symptom
    You create a purchase order with BAPI_PO_CREATE1 or you add an item to an existing purchase order with BAPI_PO_CHANGE. You assign a value in field POITEM-NET_PRICE. However, this value is not transferred. If it was not possible for you to determine any conditions, the system generated the error message 06218 'Net price must be greater than 0'.
    Other terms
    BAPI_PO_CREATE1, BAPI_PO_CHANGE, price, net price, gross price, conditions, price determination, condition type, 06218, EKPO-NETPR, NETPR, POITEM-NET_PRICE, NET_PRICE, PO_PRICE, BAPI_PO_PRICE, BUS2012, PurchaseOrder.CreateFromData1, CreateFromData1, PurchaeOrder.Change
    Reason and Prerequisites
    This function has not been available up to now. You could also assign conditions via the condition tables.
    Read also Notes 399791, 428621, 529287, 578253 and 539950 for this.
    Solution
    The present note adds field PO_PRICE to table POITEM. PO_PRICE can have the values ' ', '1' or '2' with the following meaning:
        PO_PRICE = ' ': The price determination is carried out as before.
        PO_PRICE = '1': The value assigned in field NET_PRICE is transferred as a gross price, that is it is set in the condition type that is defined as a base price in the calculation schema. All other condition types remain unchanged. No conditions are copied from the last document.
        PO_PRICE = '2': The value assigned in field NET_PRICE is transferred as a net price, that is it is set in the condition type that is defined as base price in the calculation scheme. All other condition types are deleted.
    Note the following
    The following restrictions apply to field PO_PRICE:
        If you assign conditions via the BAPI interface, these are always transferred. This is carried out independently of the value that you assign in field PO_PRICE.
        If you add a new item to a purchase order with BAPI_PO_CHANGE, it does not suffice to fill field POITEM-NET_PRICE on item level. The corresponding currency must be specified explicitly on header level.
        You can only use field PO_PRICE during the creation of a purchase order item. If you want to change the price of an already existing item, you can only do this via the conditions.
        If you fill field POITEM-PO_PRICE, you must enter an 'X' in POITEMX-PO_PRICE so that the value is transferred.
    Correction
    The correction is made available via R/3 support package. If you want to implement the note manually, proceed as follows:
        1. Make sure that your system contains Notes 494759, 552189 and 578253.
        2. Create data type BAPI_PO_PRICE with the following attributes:
                        Short text:
                           Price transfer indicator: 1  = gross, 2 = net
                        Package: ME
                        Domain: BPUEB
        3. Extend structure BAPIMEPOITEM (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPI_PO_PRICE
        4. Extend structure BAPIMEPOITEMX (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPIUPDATE
        5. Extend structure MEPOITEM_DATA (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPI_PO_PRICE
        6. Extend structure MEPOITEM_DATAX (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPIUPDATE
        7. Implement the correction instructions in your system.
    regards,
    Ravi
    Edited by: Parupelly on Dec 14, 2011 1:30 PM

  • Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    It may be best to recreate the folder and the smart playlists from scratch.
    tt2

  • Net-SNMP 5.0.9 used in Solaris 10 sma

    We are using AgentX protocol in an application sub-agent
    According to Net-SNMP change log, AgentX protocol support was experimental up to release 5.0.7 but going to the following link:
    http://net-snmp.sourceforge.net/tutorial/tutorial-5/toolkit/demon/index.html
    "The AgentX support in net-snmp versions prior to 5.1 is beta level quality. Although many people have used it successfully, we strongly recommend AgentX sub-agent developers use 5.1.2 or higher."
    Why is the Net-SNMP version so low in the Solaris 10 sma build? Cureent version is 5.3.0.1

    Hello.
    I would also like to know how to upgrade the version of net-snmp that the System Management Agent uses so that I can monitor servers with more than one CPU.
    Any guidance much appreciated.
    Thanks

  • I have been using itunes for 6 years now, and was listening to my music the other day and noticed that some of my songs were stopping short of finishing.

    I have been using itunes for 6 years now, and was listening to my music the other day and noticed that some of my albums songs were stopping short of finishing. They just stop and go to the next song. Any solutions? 

    I have experienced the same problem on my my iPad1, my former iPhone 4 my laptop and even my new iPhone5  though I had really hoped that the new phone and IOS would solve the problem.  About 5% of the songs are affected and the stoppage can range from seconds short to a minute and a half.  The file shows more of the music left, but it stops playing and goes to the next song.  Very aggravating.  Appears to happen on purchased and uploaded music.
    Any help Apple?

  • TS3276 I use Mail for my email and lately, if I get an email coming in while writing one, the program freezes for a few seconds. Frustrating.

    I have a 27" iMac 3.06 GHz Intel Core 2 Duo. I use Mail for my email. Just in the past 2 -3 months, if I'm writing an email while another one is coming in to the inbox, the program freezes, the spinning colour ball appears and I can't continue typing for 5 seconds or more. I get and write a lot of emails so it's frustrating.
    I've also noticed that sending messages is taking longer than it used to. The program spins its wheels for a few seconds before sending. Definitely noticeably longer than prior to this situation. Any ideas anyone?

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

Maybe you are looking for

  • Java permission errors

    I'm running loadjava logged in as sys and I keep running into errors creating : class org/joda/time/tz/DateTimeZoneBuilder$OfYear loading : class org/joda/time/tz/DateTimeZoneBuilder$OfYear Error while creating class org/joda/time/tz/DateTimeZoneBuil

  • H-61MU-E35 (B3) 4MB BIOS Chip Vs 8MB BIOS BIN File - WinBond 25Q32BV

    Hello, I have MSI H-61MU-E35 (B3) motherboard with Ivy Bridge Processor, and everything was working fine,  Using Windows XP, I may have updated BIOS with different model no, so upon booting I was getting message that "BIOS File Not Found..."  In past

  • Which is better. . . a Canon Sure Shot or a Canon Power Shot?

    I need to purchase a camera good enough to get good close-ups for items to sell on eBay.  Which is better...a Canon Sure Shot or a Canon Power Shot?

  • My file is read only how do i turn it off?

    the only page that appears under www.simon-gideons.com is read only how do i turn that off so i can edit that page?

  • Invoice report requirement

    Hello Gurus, In MIR4 we can see invoice lines. I want to display invoice lines with exchange rates. For example : I have a invoice numbered 1234567 This invoice have 2 lines. 1st line amount is 1000$, 2nd line is 1500$ I want to display this invoice