5 Replies Latest reply on Jul 13, 2011 1:45 PM by yuling chen

    snmp example

    yuling chen Newbie

      Hi,

       

      Does anyone have the idea about how to use the out-of-box servicemix-snmp component? how to write some sample code to use the snmp poller and trap consumer?

       

      Thanks,

        • 1. Re: snmp example
          Claus Ibsen Master

          Hi

           

          You can maybe check the unit tests of the servicemix-snmp component?

          http://svn.apache.org/repos/asf/servicemix/components/trunk/bindings/servicemix-snmp/

           

          Instead of JBI component you may consider using pure Camel. There is also a camel-snmp component

          http://camel.apache.org/snmp

          • 2. Re: snmp example
            yuling chen Newbie

            Hi,

             

            Thanks very much for the help. Now I used subversion and checked out the unit test code. I compiled the tests successfully using 'mvn install'. However, I'm not sure how to run the tests?

             

            Thanks,

            • 3. Re: snmp example
              yuling chen Newbie

              Hi,

               

              Actually I just found out that 'mvn install' would execute the tests.  However, it seems only the SnmpTrapConsumerEndpointTest.java runs, but not the SnmpPollingEndpointTest.java. 

               

              For the SnmpTrapConsumerEndpointTest.java, if I understand correctly, this test sends a trap to the address first, and then construct a receiver to receive the trap message and print it out. The only issue that I have with the example is that the st.ToDOMDocument(msg) would give 'null'. The only way that I can see the text is from st.contentToString(msg).

               

              For the SnmpPollingEndpointTest.java, I'm not sure if this is a completed test case? what exactly does it do? why there is a testDummy() method and a xtestPolling()? if I renamge the xtestPolling() to testPolling(), the test would just fail...

               

              Thanks,

              • 4. Re: snmp example
                Claus Ibsen Master

                The unit tests may help you to be able to use the component in your system.

                 

                Some of the components unit test is disabled / supposed to be run manually. As they depend on some remote resource running. So in this case it may depend on a management server where it can send the traps etc.

                 

                So just use the code to give you an idea how to use the component.

                • 5. Re: snmp example
                  yuling chen Newbie

                  Thanks very much for the reply. I thought the polling test would show how to send a snmp get pdu down to a dummy snmp device and obtain a request from it...if you know of any example showing this scenario, that would be great.

                   

                  One more question about camel snmp... what would be the advantages of using it instead of JBI snmp? Is there any examples or sample codes showing how to use it?

                   

                  Thanks,