First, install the SNMP service 1, check whether the system has installed the SNMP RPM package
The following are the RPM packages required to install the SNMP service:
libsensors3-2.10.6-55.el5.i386.rpm
lm_sensors-2.10.6-55.el5.i386.rpm
net-snmp-libs-5.3.2.2-5.el5.i386.rpm
net-snmp-5.3.2.2-5.el5.i386.rpm
net-snmp-utils-5.3.2.2-5.el5.i386.rpm
It is recommended to download these RPM packages to http://rpm.pbone.net/, which is more comprehensive and contains various versions of the package.
Using the command: $ rpm-qa|grep SNMP
Check if Net-snmp-utils-5.3.2.2-5.el5,net-snmp-libs-5.3.2.2-5.el5,net-snmp-5.3.2.2-5.el5 three RPM packages are installed
Using the command: $ rpm-qa|grep Libsen
Check if LIBSENSORS3-2.10.6-55.EL5 is installed
Using the command: $ rpm-qa|grep lm
Check if LM_SENSORS-2.10.6-55.EL5 is installed
Description
(1) The installation of these packages has a certain order, in the installation, there will be a hint. such as installation
NET-SNMP-5.3.2.2-5.EL5.I386.RPM, you will be prompted to install net-snmp-libs-5.3.2.2-5.el5.i386.rpm first.
(2) net-snmp-utils-5.3.2.2-5.el5.i386.rpm is not a must-install package, but it can be helpful to install it, it provides a lot of tools, for example, you can use the Snmptranslate command to view the OID, you can use Snmpget, Snmpwalk commands and so on.
(3) net-snmp-libs-5.3.2.2-5.el5.i386.rpm, net-snmp-5.3.2.2-5.el5.i386.rpm,
net-snmp-utils-5.3.2.2-5.el5.i386.rpm These three packages have a certain version requirements, must be the same version, or the installation will not succeed. I use the 5.3.2.2-5.el5 version here, you can also download other versions of the RPM package, but note that the version to be consistent, at the time of installation will also prompt, which version of the package is necessary, you can download the required package according to the prompts.
2, install the above several RPM package
If the above package is not installed in the system, install it first.
Use command: RPM–IVH package name
After installation, use the command: $ rpm-qa|grep SNMP to check if the installation was successful.
YUM Installation
1 Yum install-y net-snmp net-snmp-utils
3. Start the SNMP service
If the installation is successful, you can use the command:
$ service SNMPD Start
Tip: Starting SNMPD: [OK], the SNMP service started successfully.
You can set the SNMP service to boot from boot, which eliminates the hassle of manual startup.
Use the command: $ chkconfig snmpd on to set the SNMPD service to boot from.
Then use the command: $ chkconfig--list | grep snmpd to see if it has been set successfully.
4. Verifying SNMP Service
(1) Use the Snmpwalk command to view the host name of native localhost:
As above, obtaining a native host named Oracle.domain.com indicates that the SNMP service is already working properly.
(2) Use the Snmptranslate command to check if the SNMP tool is available:
As above, a partial OID is detected, which means that the SNMP tool can be used normally.
(3) test whether the remote host can obtain data.
I landed on another Linux host, which also installs the SNMP service and SNMP tools as per the above steps. Through this host, to obtain the remote host data, you need to specify the remote host IP address:
As above, you can see that the host name obtained through the remote host is consistent with the hostname acquired in this computer.
Second, configure the SNMP service
When the above installation is complete, the default configuration of SNMP is used, and with these default configurations, we can only obtain some information about the host. But some other important information is not available. such as CPU usage of the host, memory usage, etc.
As above, the CPU idle rate cannot be obtained (note: 1.3.6.1.4.1.2021.11.11.0 is the OID of the host CPU idle rate).
At this point, to get some important information about the host, modify the default configuration of SNMP.
Configuration method: Modify the/etc/snmp/snmpd.conf file
1. Modify permissions to view device nodes
In the file, locate the following location:
View: Defines the information for which node devices can be viewed.
The SNMP default configuration can only view device information under the. 1.3.6.1.2.1.1 and. 1.3.6.1.2.1.25.1.1 nodes, and devices such as the host CPU and memory are not available under these nodes, so this data cannot be obtained.
Therefore, you can modify this configuration as follows:
A row is added here:
View SystemView included. 1
Indicates that you can view all device information under the. 1 node.
2, modify the configuration of process checks
Find the following location:
Will
# proc Mountd
# proc NTALKD 4
# proc SendMail 10 1
Three lines before the "#" number is removed, uncomment, the result is:
3. Modify Executables/scripts Configuration
Find the following location:
Will
#exec Echotest/bin/echo Hello World
The "#" number before the line is removed and the comment is canceled.
4. Modify Disk Checks Configuration
Find the following location:
Will
#disk/10000
The "#" number before the line is removed and the comment is canceled.
5. Modify the load average checks configuration
Find the following location:
Will #load 12 14 14
The "#" number before the line is removed and the comment is canceled.
6. Save changes, restart SNMP Service
7. Verifying the SNMP service after configuration modification
As above, the idle rate from native localhost to the CPU is 97%.
As above, the idle rate obtained by the remote host to the CPU is 93%.
Thanks for the original http://blog.csdn.net/jacky0922/article/details/6952152
Configuring SNMP services under Linux installation