Re: Agent development - SNMP

This is a discussion on Re: Agent development - SNMP ; 2008/6/30 deka aditia : > currently i'm developing an application that will listen to SNMP Port, > when there is snmp packet incoming then my application will translate > the request and send it back to user . That sounds ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Re: Agent development

  1. Re: Agent development

    2008/6/30 deka aditia :
    > currently i'm developing an application that will listen to SNMP Port,
    > when there is snmp packet incoming then my application will translate
    > the request and send it back to user .


    That sounds suspiciously like an "SNMP agent".
    We provide exactly such a beast - why not use that,
    rather than re-inventing the wheel.


    > Before i will start deveIoping this application, i have a basic questions :
    > How we i detect a new incoming SNMP packet using net-snmp ?


    If you are determined to implement an agent for yourself,
    please see the routine "receive()" in the file 'agent/snmpd.c'

    This contains the main event loop, for detecting incoming requests
    and processing them. The vital elements of this are:

    snmp_select_info()
    select()
    snmp_read()

    But I'd strongly advise against trying to write your own agent.
    There's best part of twenty years work gone into the Net-SNMP
    agent - it's going to take you a while to reproduce that!

    Dave

    -------------------------------------------------------------------------
    Check out the new SourceForge.net Marketplace.
    It's the best place to buy or sell services for
    just about anything Open Source.
    http://sourceforge.net/services/buy/index.php
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  2. Re: Agent development

    [ First - *please* don't mail me privately, without copying
    any responses to the mailing list. I don't have the time
    or inclination to offer private, unpaid, SNMP consultancy.
    Keep discussions to the list, where others can both learn
    and offer advice. Thanks. ]



    2008/6/30 deka aditia :
    > On 6/30/08, Dave Shield wrote:
    >> 2008/6/30 deka aditia :
    >>> currently i'm developing an application that will listen to SNMP Port,
    >>> when there is snmp packet incoming then my application will translate
    >>> the request and send it back to user .

    >>
    >> That sounds suspiciously like an "SNMP agent".
    >> We provide exactly such a beast - why not use that,
    >> rather than re-inventing the wheel.
    >>

    >
    > OK Mr. Dave i prefer to choose "SNMP listener" rather than "SNMP agent"
    > i'm just confuse with what i should asking



    The standard terminology within the SNMP community is
    either "command responder" or "agent".
    The term "SNMP listener" is ambiguous, as it would
    cover several different types of application.


    I suggest you follow established practise, rather than
    inventing your own terminology.




    >>> Before i will start deveIoping this application, i have a basic questions
    >>> :
    >>> How we i detect a new incoming SNMP packet using net-snmp ?

    >>
    >> If you are determined to implement an agent for yourself,
    >> please see the routine "receive()" in the file 'agent/snmpd.c'
    >>

    >
    > it's just a program that listen to some SNMP request which OID is'nt
    > come to standard MIB, moreover it will access some hardware
    > information and send the response ...


    Yes - that is exactly the behaviour of an agent.

    I would suggest that you concentrate on developing a MIB
    module for your particular needs, and use this within the
    existing Net-SNMP agent framework.
    Trying to code the whole thing from scratch will involve a
    lot of unnecessary duplication.



    >> This contains the main event loop, for detecting incoming requests
    >> and processing them. The vital elements of this are:
    >>
    >> snmp_select_info()
    >> select()
    >> snmp_read()
    >>
    >> But I'd strongly advise against trying to write your own agent.
    >> There's best part of twenty years work gone into the Net-SNMP
    >> agent - it's going to take you a while to reproduce that!
    >>
    >> Dave
    >>

    >
    > could you explain more about 3 procedure above .....



    I repeat - I would *STRONGLY* suggest that you do not
    try to implement an agent from scratch. The existing
    agent will handle accepting incoming requests, decoding
    them into a useable data structure, and passing the
    request off to the appropriate MIB module handlers.
    There is a lot of fiddly detail here, which would take
    you a long time to reproduce for yourself.

    If you use the Net-SNMP agent, then you don't need to
    worry about any of this - it's all handled for you. You can
    concentrate on the important task, of handling your
    hardware and implementing the corresponding MIB.

    Dave

    -------------------------------------------------------------------------
    Check out the new SourceForge.net Marketplace.
    It's the best place to buy or sell services for
    just about anything Open Source.
    http://sourceforge.net/services/buy/index.php
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  3. Re: Agent development

    2008/7/2 deka aditia :
    >> I would suggest that you concentrate on developing a MIB
    >> module for your particular needs, and use this within the
    >> existing Net-SNMP agent framework.


    > Now i got what you want,
    > you suggest me to develop a sub agent in existing agent, right ?


    That's one approach, certainly.
    But what I would actually suggest is that you start by implementing
    the code for a MIB module, and compile this directly within the
    SNMP agent itself. I.e.

    configure --with-mib-modules=yourModule
    make
    make install



    > 1.) I just try to run this program on my PC (i'm using opensuse 11.0)
    > but it got a message that the program can't communicate with the main agent


    And that's why I suggest you start with a static agent.
    It avoids all the hassle of communications between the master
    agent and your subagent.

    The code you develop can be re-compiled into a subagent (or a
    dynamically loadable module) later, without needing to change a
    thing. But if you start by compiling it within the main agent,
    that's by far the simplest approach.


    Dave

    -------------------------------------------------------------------------
    Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
    Studies have shown that voting for your favorite open source project,
    along with a healthy diet, reduces your potential for chronic lameness
    and boredom. Vote Now at http://www.sourceforge.net/community/cca08
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  4. Re: Agent development

    On Tue, Jul 08, 2008 at 11:47:09AM +0700, deka aditia wrote:
    > On 7/7/08, Dave Shield wrote:
    > >
    > > 2008/7/7 deka aditia :
    > >
    > > > if it is, then what should i do when i have some scallar object (up to 1)
    > > >
    > > > should i make an exutable for each of them and link to main agent ??

    > >
    > >
    > > See http://www.net-snmp.org/wiki/index.php/FAQ:Coding_11
    > >
    > >
    > >
    > > > is there any way that more comfortable which i could bind all of them as

    > > one
    > > > rather than make some pieces ?

    > >
    > >
    > > Have a look at mib2c.scalar_group.conf
    > >
    > >
    > > Dave

    >
    >
    >
    > Anyone knows how to compiling module without ./configure
    > --with-module=mymodule ?
    > because currently i'm using net-snmp package which i got from default system
    > .....
    > If i'm try to install from the tarball, i always failed to producing
    > snmpd .... but not with the other things ...
    > (snmpdf, snmpget, snmpwalk etc ...)
    > i've ensure every requirement that listed in FAQ section ....
    > but i can get snmpd after installation ....
    > what


    You could try to create a subagent.

    net-snmp-config --compile object object.c

    but I would only suggest this if you are using an 5.4+-based agent.

    Note that object.c is the same object.c that you used for the compiled-in
    module.

    You could also ignore me since I will be somewhat unavailable to answer
    questions.

    /MF

    -------------------------------------------------------------------------
    Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
    Studies have shown that voting for your favorite open source project,
    along with a healthy diet, reduces your potential for chronic lameness
    and boredom. Vote Now at http://www.sourceforge.net/community/cca08
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


  5. Re: Agent development

    2008/7/22 deka aditia :
    > ... I didn't find any configuration file named mib2c.scalar_group.conf
    > where should i find this ??


    My apologies - it seems that there isn't a mib2c template for this.

    You're probably best off using mib2c.scalar.conf to generate the
    initial code file, and then tweak it to use 'netsnmp_register_scalar_group()'
    rather than 'netsnmp_register_scalar()'.

    Note that you'll also have to adjust the OID that it registers with,
    as well as the main handler routine.

    Have a look at the code for 'ucd-snmp/memory' or 'ucd-snmp/vmstat',
    or various group under 'mibII' for examples of this helper in action.

    Dave

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.p...r_id=100&url=/
    _______________________________________________
    Net-snmp-coders mailing list
    Net-snmp-coders@lists.sourceforge.net
    https://lists.sourceforge.net/lists/...et-snmp-coders


+ Reply to Thread