Pages

Monday, April 5, 2010

HowTo: The Net-SNMP Package - 1

For a quick gyaan on Net-SNMP package please visit the following link.

http://www.net-snmp.org/

This will be a brief post on how to use Net-SNMP package.

I use a Fedora Core 12 Linux distribution.
so everything in the post will be for this OS (typically a Linux box)



lets look at the installation part.
hmmmm, very briefly.. :)

Alright, lets begin...
download the latest source package of Net-SNMP at http://net-snmp.sourceforge.net/download.html

Get the tar.gz as we be using the Linux distro.

now in the terminal browse to the folder where the downloaded tarball is present...
remember that you must have root access for the installation.

extract the file contents
tar -zxvf net-snmp-5.5.tar.gz

now navigate to the extracted folder... and you will see a bunch of files 
when you issue the ls command.

Remember: you must have root privileges  to install the package... :)

The steps you need to do now are
1) Run ./configure

2) make

3) make test (This usually tells you right away whether everything on
the system is good to go or not)

4) make install 

huffff... al these steps will take a lot of time to get the package installed..

netsnmp is installed and ready to use.

but how?
..not quite easy to say its all done.......theres still a lot of stuff that needs to
be done before we can say .....yup....thats working beautifully....... 

Now lets begin testing and configuring the installation...

first check if /usr/local/bin/ folder has a bunch of snmp stuff.....

then, See if the /usr/local/share/snmp/mibs folder has the MIB's...

Now its time to try some configurations checking

First, give

#net-snmp-config --default-mibdirs
and the response must be something like this
 
/root/.snmp/mibs:/usr/local/share/snmp/mibs

now run,
net-snmp-config --snmpconfpath
 
and so the response 
/usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/root/.snm
 
:) :) 
now,
ldd /usr/local/bin/snmptranslate 
 
and you must get the output like this
linux-gate.so.1 =>  (0x00d2a000)
 libnetsnmp.so.20 => /usr/local/lib/libnetsnmp.so.20 (0x004f0000)
 libcrypto.so.10 => /usr/lib/libcrypto.so.10 (0x06470000)
 libc.so.6 => /lib/libc.so.6 (0x00288000)
 libdl.so.2 => /lib/libdl.so.2 (0x003ff000)
 libz.so.1 => /lib/libz.so.1 (0x00459000)
 /lib/ld-linux.so.2 (0x00266000)
 
If no error comes , no need to do anything, but if error comes (like a not fount), then, you have to do the steps below
Edit ld.so.conf in /etc and add the details of the lib path of /usr/local/lib and then run ldconfig
 
#vi /etc/ld.so.conf

/usr/X11R6/lib/Xaw3d
/usr/X11R6/lib
/usr/lib/Xaw3d
/usr/i386-suse-linux/lib
/usr/local/lib
/opt/kde3/lib
include /etc/ld.so.conf.d/*.conf

#ldconfig
 
Now you have to tell netsnmp where to look for MIB files.  
You use the snmpconf command to do this. Issue this command at the prompt 
# snmpconf

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

  1:  snmpd.conf
  2:  snmptrapd.conf
  3:  snmp.conf

Other options: quit

Select File: 3

The configuration information which can be put into snmp.conf is divided
into sections.  Select a configuration section for snmp.conf
that you wish to create:

  1:  Debugging output options
  2:  Textual mib parsing
  3:  Output style options
  4:  Default Authentication Options

Other options: finished

Select section: finished

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

  1:  snmpd.conf
  2:  snmptrapd.conf
  3:  snmp.conf

Other options: quit

Select File: quit


The following files were created:

 snmp.conf

These files should be moved to /usr/local/share/snmp if you
want them used by everyone on the system.  In the future, if you add
the -i option to the command line I'll copy them there automatically for you.

Or, if you want them for your personal use only, copy them to
/root/.snmp .  In the future, if you add the -p option to the
command line I'll copy them there automatically for you.

#cp snmp.conf /usr/local/share/snmp/ 

Great.... 
Now the final step to check for a successful installation...

# snmptranslate -Tp -IR ipMIB
+--ipMIB(48)
  |
  +--ipMIBConformance(2)
     |
     +--ipMIBCompliances(1)
     |  |
     |  +--ipMIBCompliance(1)
     |  +--ipMIBCompliance2(2)
     |
     +--ipMIBGroups(2)
        |
        +--ipGroup(1)
        +--icmpGroup(2)
        +--ipv4GeneralGroup(3)
        +--ipv4IfGroup(4)
        +--ipv6GeneralGroup2(5)
        +--ipv6IfGroup(6)
        +--ipLastChangeGroup(7)
        +--ipSystemStatsGroup(8)
        +--ipv4SystemStatsGroup(9)
        +--ipSystemStatsHCOctetGroup(10)
        +--ipSystemStatsHCPacketGroup(11)
        +--ipv4SystemStatsHCPacketGroup(12)
        +--ipIfStatsGroup(13)
        +--ipv4IfStatsGroup(14)
        +--ipIfStatsHCOctetGroup(15)
        +--ipIfStatsHCPacketGroup(16)
        +--ipv4IfStatsHCPacketGroup(17)
        +--ipAddressPrefixGroup(18)
        +--ipAddressGroup(19)
        +--ipNetToPhysicalGroup(20)
        +--ipv6ScopeGroup(21)
        +--ipDefaultRouterGroup(22)
        +--ipv6RouterAdvertGroup(23)
        +--icmpStatsGroup(24) 
 
 
Once  you get this tree you can be sure that the Installation is perfect...
 
more in my next post. :) 

No comments:

Post a Comment