Re: Own module does not get initialized

Nisha P K <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 7/27/2011 6:26 PM, Juri Glaß wrote:
> Hi
>
>> To make sure that your module has been compiled use the following command
>> net-snmp-config --snmpd-module-list
> My module is in the list returned by this command.
>
>> Normally the source compiled snmpd would be available at
>> /usr/local/snmpd if you have not provided the prefix directory. Please
>> check whether you are running the default snmpd instead of the newly
>> compiled one.
> I definitely use the compiled version.
>
> My compiled version is in /usr/local/sbin and "which snmpd" points to this location.
> To be absolutely sure I moved my default snmpd (which was in /usr/sbin).
>
> Are there any configuration options available to explicitly load a module?
> So that I have some errors if this fails.

You can compile your mib implementation as a subagent and run it as a 
separate process. Check whether that works.

To compile as subagent:

*/net-snmp-config  --compile-subagent <filename.c> /*

Add an entry in your snmpd.conf

*/master agentx/*

Now start the snmpd as well as the subagent and then try to query the OID.

You can also compile your module as a dynamically loadable module and 
get this functionality working.

http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Dynamically_Loadable_Object

- nisha
>
> Juri
>
>
>
> Am 27.07.2011 um 13:51 schrieb Nisha P K:
>
>> On 7/27/2011 3:35 PM, Juri Glaß wrote:
>>> Hi
>>>
>>> I want to write a SNMP module, but I somehow can't get it initialized and snmpwalk/snmpget returns "No Such Object available on this agent at this OID" respectively.
>>>
>>> The steps that I've done till now:
>>>
>>> * I wrote my own MIB file (some scalars, below enterprises and our enterprise id)
>>> * I checked if this MIB file is correct using snmptranslate
>>> * I generated c skeleton code with mib2c and implemented it
>>> * I got the net-snmp sources, configured them with my MIB file, make, make install
>>> * It gets compiled and installed
>>> * I added my MIB file to /usr/share/snmp/mibs
>>> * I added a "mibs + :<mymib>" statement to snmp.conf (apparently in snmpd.conf the mibs statement is not recognized)
>> ./configure --with-mib-modules=<module-name>
>> make
>> make install
>>
>> <module-name>  is the name of the file generated using mib2c excluding
>> the .c extension.
>>
>> To make sure that your module has been compiled use the following command
>> net-snmp-config --snmpd-module-list
>>
>> This should provide the list of all modules that has been compiled along
>> with this snmpd.
>>> Then I start my compiled snmpd with "snmpd -f -Lo -D" and I can see that my MIB file is loaded.
>>>
>>> But if I register the debug token (snmpd -f -Lo -D<mymodule>), that was generated by mib2c, there is no ouput that my module gets initialized.
>> Normally the source compiled snmpd would be available at
>> /usr/local/snmpd if you have not provided the prefix directory. Please
>> check whether you are running the default snmpd instead of the newly
>> compiled one.
>>
>>> I even removed the if statement before the call to init_<mymodule>   in agent/mibgroup/mib_module_inits.h but this didn't work either.
>>>
>>> How can I get my module initialized?
>>>
>>> Any help would be appreciated!
>>>
>>> Juri
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Got Input?   Slashdot Needs You.
>>> Take our quick survey online.  Come on, we don't ask for help often.
>>> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
>>> http://p.sf.net/sfu/slashdot-survey
>>> _______________________________________________
>>> 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
>>>
>>
>>
>
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> 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
>

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey

_______________________________________________
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.