Hi

            I am havin a SNMP Agent which has no storage in it.It will get data from External Application for Each get / get - next /etc.It will set all values in External Application as per request from Manager.

           My External Application is another Program which runs separately .I have some special function in External Application to send Trap .ie tell Agent when some trap occurs in the External Application.


         But problem here is i dont know where to send the message to inform agent that trap has occured at the side of External Application.To which port i should send trap for agent, ie agent is listening for port from external application.


     One more doubt for me is How trap function is started and send to Manager by Agent.Please help me with a sample example how trap is generated and send to Manager by Agent.


With Regards
Karthik.M
        

  • No status
Shall we have a call today at  4.00 pm to know about your project so that it will be helpful for us to assist you further.
please let me know your contact no.


thanks and regards,
 - subarayan -
(C-Agent Support)

Hi Subarayan

                     I will explain my project in detail . my project will be equal to IPC example.

                      My Agent will have NO Storage in it.For the MIB in AGENT the data will be in some External Application.For each GET/SET from Manager request Agent has to contact the External Application and give response accordingly.External Application is a simple tcp Socket program.

                     So for this i followed IPC example , But i IPC example you have only one Tabular file.But in our case we will have both Scalar and Tabular files.

                    I created the connection in MIBNAME.C file and got the Socket Descriptor in scalar and tabular handler files.Using this socket descriptor i am making communication between agent and external application.My external Application will have two file one for SCALAR values and TABULAR values for particular MIB.when External Application get request for Scalar or Tabular values it will be retrieved from the files and send to agent.

                   I have Signal Handlers to produce traps for Agent in External Application,But in that case how can i send that the trap has occured in the External Application to the Agent.How Agent will know that trap has occured

                  The problem i am facing in my project is as follows :

                 1) I can send() and recv() basic data types such as Int and String from Agent to external Application but i can't     send() or recv() a structure and i can't get back response.

                 2) Files in external application will have all datas in it in String format , How can i type cast the string to given toolkit specific data types.
 
                 3) How can i send Trap generated  in external Application  to Agent ???

                      please Help me for this.

with Regards
Karthik.M

 
Dear Karthik,

As per our telephonic conversation, you have an issue in sending an structure / pointer from the agent to the application because of creation of agent.log file at the agent side. We suggest you to set the Debug Mode to NONE instead of DEBUG in the config.h file which is available in
<projctname>/agent/source/system/include/ directory.

i.e. define the Debug mode in the config.h file as mentioned below.

/* Debug mode (NONE/ERRMSG/DEBUG/TRACE). */
#define NONE


For sending traps to the agent , there is no need to send traps from the external application to the agent. Instead , you can send some unique string to the agent through  the tcp socket created between the agent and the application. In the agent, you should write a switch case function for each case say (up/down/restart/etc ... ). and you have a different varbind for each case.

In the agent, if the string matches with any one of the switch case (up / down / restart / etc ) , then you have to call the respective sendv2Trapsof(scalar/tabular)Notifications() function. And in that function, you have to add the varbind which is belongs to the particular string ( up / down / restart / etc ... ) . The function SendV2Trapsof(scalar/tabular)Notifications() trigger the traps to the manager.

To add varbinds to the traps, please refer the below help document link.

The Traps sent out for a particular Trap definition will contain all the VarBinds related to the variables contained in that Trap/Notification definition. In addition to this if you wish to add extra VarBinds with them, you can make use of the extraVarbind Vector parameter. For more information on this, please refer to Adding Extra Varbinds to Traps section.

http://www.adventnet.com/products/cagent/help/snmp/c_snmp_traps.html#addextravarbinds

Hope this helps. Do revert back to us for further support.

Thanks and Regards,
subarayan

Post Actions
Statistics
  • 3
     Replies
  • 286
     Views
  • 0
     Followers
Tags for the post
No tags available for this topic.
© 2009 Corp. All rights reserved. Trademarks | Privacy Policy | Site Map | Contact Us | Careers

Edit Link Delete Link

Edit Link Delete Link

LoadingImage