|
Install SNMP Agent on *NIX system |
|
|
|
This HowTo will explain how to install and configure the Net-SNMP agent. As the time of writing, the latest version available is 5.4.1 (published on 07/27/2007). Chapter I: Getting Net-SNMP binaries Depending on your operating system, you'll find packages or tarballs to install Net-SNMP : - Linux
Usually every Linux distribution comes with Net-SNMP packages : - RedHat / Fedora / CentOS : install the net-snmp, net-snmp-libs and net-snmp-utils packages
- Debian / Ubuntu: install the libsnmp-base, libsnmp5, snmp and snmpd packages
- SuSE : install the net-snmp package
- Gentoo : simply emerge the net-snmp ebuild.
To graph I/O usage, add this option to portage : | Code: | | # echo "net-analyzer/net-snmp diskio" >> /etc/portage/package.use | - Mandriva : install the libnet-snmp5, net-snmp and net-snmp-utils packages.
- AIX
Packages were available in the University of California repository, but it's no longer available. You can find Net-SNMP 5.0.3 for AIX 5.1 on the Bull AIX freeware site. - Solaris
Solaris 10 ships with Net-SNMP 5.0.9 For older Solaris releases, packages are available in the Sunfreeware repository : For these packages to work, OpenSSL and GCC libraries need to be installed also. Tarballs are also available from the Net-SNMP main site : These tarballs have to be extracted from / has they contain absolute paths. Files are copied to /usr/local/share/snmp, /usr/local/libs, /usr/local/include/net-snmp, /usr/local/man, /usr/local/bin and /usr/local/sbin - HP-UX
Tarballs are available from the Net-SNMP main site : These tarballs have to be extracted from / has they contain absolute paths. Beware that the binaries are not stripped in these tarballs, this waste a lot space. Files are copied to /usr/local/share/snmp, /usr/local/libs, /usr/local/include/net-snmp, /usr/local/man, /usr/local/bin and /usr/local/sbin - FreeBSD
Net-SNMP is available through the ports - Mac OS X
Packages are available : Chapter II: Building the Net-SNMP agent from sources If you can't find binaries for your architecture, you can build the Net-SNMP agent from sources. Latest sources are available here. Here's how to get the configure options of an already running Net-SNMP agent : | Code: | $ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.100.6.0 UCD-SNMP-MIB::versionConfigureOptions.0 = STRING: "'-disable-shared' '--with-mib-modules=host/hr_system'" | Some useful mib modules are : - mibII/mta_sendmail, to graph MTA (Sendmail, Postfix, etc.) statistics
- diskio, to enable to graph I/O statistics
- ucd-snmp/lmSensors, for hardware monitoring (Linux and Solaris only)
Mib modules can be added like this : | Code: | | $ ./configure --with-mib-modules="module1 module2" | To compile Net-SNMP and build a compressed archive, follow these steps : | Code: | $ ./configure --with-your-options $ make # mkdir /usr/local/dist # make install prefix=/usr/local/dist/usr/local exec_prefix=/usr/local/dist/usr/local # cd /usr/local/dist # tar cvf /tmp/net-snmp-5.3.1-dist.tar usr # gzip /tmp/net-snmp-5.3.1-dist.tar # rm -rf /usr/local/dist | You can then copy the /tmp/net-snmp-5.3.1-dist.tar.gz file to other servers, and uncompress it from the root directory (everything will get extracted to /usr/local). Chapter III: Configuring the Net-SNMP agent Depending on how you've installed Net-SNMP, the main configuration file (snmpd.conf) is located in /etc/snmp (installation from package) or /usr/local/share/snmp (installation from tarball). Please note that you need to restart (or send the HUP signal) the snmpd daemon whenever you modify snmpd.conf ! The minimum configuration is this one : This will enable SNMP version 1/2 read-only requests from any host, with the community name public. With this minimal configuration, you'll be able to graph CPU usage, load average, network interfaces, memory / swap usage, logged in users and number of processes. You can restrict from which hosts SNMP queries are allowed : | Code: | rocommunity public 127.0.0.1 rocommunity test 87.65.43.21 | By default Net-SNMP listens on UDP port 161 on all IPv4 interfaces.
|