Re: How to write own application in c ?

mass mass <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Ok Benix, see ..

I am looking to
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent

I have downloaded NET-SNMP-TUTORIAL-MIB.

then I have done mib2c on node nstAgentSubagentObject and it has
generated nstAgentSubagentObject.c and nstAgentSubagentObject.h files.

Then I have created sub agent using net-snmp script as follows:

        * **% net-snmp-config --compile-subagent mysubagent
nstAgentSubagentObject.c*
It has generated mysubagent binary and GET, SET is working properly.

Now what should I do so that while I send GET request it should read some
file for value of variable and  for SET it write value of variable to that
file again.




On 28 November 2010 22:22, Benix Samuel Vincent Theogaraj <
[email protected]> wrote:

> I did n't understand your question precisely, but the following might be
> useful.
>
> When you register a oid, you will register a handler as well. so, it is the
> handler's responsibility to fetch the data when queried.
>
>
> Example:
>
> register_oid (oid, handler); where handler is a callback funciton. this
> function should be like as below
>
> handler ()
> {
> // GET request
> fetch the data
>
> //SET request
> overwrite the data
> }
>
> Does above make sense?
>
> For more info, provide more info like what mib you are refering?
>
> Benix.
>
>
> On Sun, Nov 28, 2010 at 11:44 AM, mass mass <[email protected]> wrote:
>
>> hey Benix thanks for reply . :)
>>
>> Actually I have gone through all examples at net-snmp.org, They are
>> working finely but I did not understand how to add my own code to it. How
>> they are reading information from system. If I create mib for integer
>> variable and convert it to c code using mib2c, but suppose that value should
>> be read from the specific file while GET and overwrite to the same while
>> SET, how should i do that I am not getting :( .
>> please help me.
>>
>>
>> On 28 November 2010 20:58, Benix Samuel Vincent Theogaraj <
>> [email protected]> wrote:
>>
>>> Good to start with the tutorial. Here is the link
>>>
>>> http://www.net-snmp.org/wiki/index.php/TUT:Simple_Application
>>>
>>> This is how I started.
>>>
>>> Benix
>>>
>>> On Sun, Nov 28, 2010 at 5:38 AM, mass mass <[email protected]> wrote:
>>>
>>>> Hello,
>>>>
>>>> I want to write SNMP application that reads integer from specific file
>>>> on GET request and write integer to file on SET request. How can I add
>>>> my own c code to do this in snmp subagent?
>>>>
>>>> How does snmp gets information from system?
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>>>> Tap into the largest installed PC base & get more eyes on your game by
>>>> optimizing for Intel(R) Graphics Technology. Get started today with the
>>>> Intel(R) Software Partner Program. Five $500 cash prizes are up for
>>>> grabs.
>>>> http://p.sf.net/sfu/intelisp-dev2dev
>>>> _______________________________________________
>>>> Net-snmp-users mailing list
>>>> [email protected]
>>>> Please see the following page to unsubscribe or change other options:
>>>> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Born to explore ; Coding to live : But not for a while !!
>>>
>>>
>>
>
>
> --
> Born to explore ; Coding to live : But not for a while !!
>
>

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.