Hello,

I have a first question about snmpd.conf  .   The file which seems to 
be used is the one in /etc/snmp.  But every where in the documentation 
it is indicated that it should be the one in /usr/local/share/snmp/  , 
is it normal?


I've got also a problem with adding a new MIB module to the agent.

I tryed to do the example given in the section : "Compiling in your new 
MIB module".

######################################################################################################################################################################################################################################
Compiling in your new MIB module

Note: you will need to have previously installed the Net-SNMP Source 
Package on your system before proceeding.

There are a few ways to get your new MIB module loaded and accessible 
via SNMP requests. We'll discuss all three ways separately. To make this 
easy to test the procedures outlined below, we've provided three simple 
mib modules which implement the three simple scalars in the 
NET-SNMP-TUTORIAL-MIB MIB. To see how MIBs can be properly used by the 
tools, please see the mib-options tutorial.

     Compile it into the master agent.

Lets assume you're going to compile in a new mib module. For our 
example, lets use the example mib module and it's header file. To do 
this, you would put the nstAgentModuleObject.h and 
nstAgentModuleObject.c files into the net-snmp source code directory. 
You do this by copying them into a agent/mibgroup/nstAgentModuleObject.h 
and agent/mibgroup/nstAgentModuleObject.c file.

Next, you have to configure the package to find them and compile them 
into the agent. To do this, you run the configure script giving it the 
extra module names you want it to load:

  % ./configure --with-mib-modules="nstAgentModuleObject"


If you had multiple modules to include (like a second "XXX" module, for 
example), you can separate them with spaces inside the quotes (e.g., 
--with-mib-modules="nstAgentModuleObject XXX").

Note that nstAgentModuleObject is the prefix and the configure script 
will actually look for a nstAgentModuleObject.h and a 
nstAgentModuleObject.c file. You must have a .h file and you can not get 
it to work with just a .c file.

Build your new agent with your new code in it by running make:

  % make


Finally, install the whole lot by running make install:

  % make install


Now that the agent is installed, you need to add some basic 
configuration (see other tutorials for more configuration options). Here 
we just add a simple read-only and read-write community strings (tutget 
and tutset, respectively) for the tutorial MIB branch:

  % echo "rocommunity tutget .1.3.6.1.4.1.8072.2.4" > 
/usr/local/etc/snmpd.conf
  % echo "rwcommunity tutset .1.3.6.1.4.1.8072.2.4" > 
/usr/local/etc/snmpd.conf

You can test out the functionality by starting the snmpd agent:

  % /usr/local/sbin/snmpd -f -L -d -p 9999

This runs the agent on a temporary port ( -p 9999) so that it doesn't 
need special priviledges, or interfere with your 'normal' agent. 
Incoming and outgoing packets are printed (-d), to show what's 
happening, and the agent is run as a 'non-daemon' command (-f -L) so 
that you can see these messages. Note that this ties up the current 
shell, so you'll need to run the following checks in a different 
terminal window.

And then running snmpget and snmpset on the scalar object:

  % snmpget -v2c -c tutget localhost:9999 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
  NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 1

  % snmpset -v2c -c tutset localhost:9999 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5
  NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 5

  % snmpget -v2c -c tutget localhost:9999 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
  NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 5


You can also compile your code into a "subagent" which then attaches 
itself to the master agent using the AgentX subagent protocol. Our 
libraries provide support to make this easy to do and this is discussed 
in greater detail in a later section.

Finally, you can also compile your code into pluggable shared object 
and tell the snmpd agent to load it. This is also discussed in greater 
detail in a later section .
######################################################################################################################################################################################################################################





I did exactly what is writen above but it doesn't work.
I'm sure that the agent is running because object of other module are 
availables.. For example:

snmpget -v2c -c public localhost NET-SNMP-AGENT-MIB::nsCacheEnabled.0
NET-SNMP-AGENT-MIB::nsCacheEnabled.0 = INTEGER: false(2)

snmpget -v2c -c public localhost 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = No Such Object 
available on this agent at this OID
######################################################################################################################################################################################################################################


Here is my snmpd.conf:

export MIBDIRS=/usr/share/snmp/mibs
mibs ALL
#############################################################################################################################

For information:
cd /usr/share/snmp/mibs
/usr/share/snmp/mibs$ ls | grep TUTORIAL
NET-SNMP-TUTORIAL-MIB.txt

#############################################################################################################################

And here it is a summary after a  ./configure 
--with-mib-modules="nstAgentModuleObject"

---------------------------------------------------------
             Net-SNMP configuration summary:
---------------------------------------------------------

   SNMP Versions Supported:    1 2c 3
   Building for:               linux
   Net-SNMP Version:           5.7.2
   Network transport support:  Callback Unix Alias TCP UDP IPv4Base 
SocketBase TCPBase UDPIPv4Base UDPBase
   SNMPv3 Security Modules:     usm
   Agent MIB code:             nstAgentModuleObject default_modules =>  
snmpv3mibs mibII ucd_snmp notification notification-log-mib target 
agent_mibs agentx disman/event disman/schedule utilities host
   MYSQL Trap Logging:         unavailable
   Embedded Perl support:      enabled
   SNMP Perl modules:          building -- embeddable
   SNMP Python modules:        disabled
   Crypto support from:        crypto
   Authentication support:     MD5 SHA1
   Encryption support:         DES AES
   Local DNSSEC validation:    disabled

---------------------------------------------------------


######################################################################

And here is a walk on the agent with a grep on one object available and 
on the one which is not:

NET-SNMP-TUTORIAL-MIB is not found:
snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072 | grep 
NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject
$ snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072 | grep 
NET-SNMP-TUTORIAL-MIB
$

NET-SNMP-AGENT-MIB is well found:
$ snmpwalk -v2c -c public localhost .1.3.6.1.4.1.8072 | grep 
NET-SNMP-AGENT-MIB::nsCacheEnabled
NET-SNMP-AGENT-MIB::nsCacheEnabled.0 = INTEGER: false(2)

######################################################################


Maybe I missed something on how adding a MIB Module on the agent.. if 
someone has a clue?

Kind regards,
Franck



------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to