Download the centossnmp service first
yum install -y net-snmp net-snmp-devel net-snmp-utils
2. Configure the SNMP service after installation.
[[Email protected] ~] # Cat/etc/snmp/snmpd. conf | grep-ve "^ # | ^ $" com2sec notconfiguser default publicgroup notconfiggroup V1 notconfigusergroup notconfiggroup v2c notconfiguserview systemview pinned ded. 1.3.6.1.2.1.1view systemview added. 1.3.6.1.2.1.25.1.1access notconfiggroup "" any noauth exact systemview none nonesyslocation unknown (edit/etc/snmp/snmpd. conf) syscontact root <[email protected]> (Configure/etc/Sn MP/snmp. local. conf) dontlogtcpwrappersconnects Yes parameter description: # format: com2sec [-CN context] Sec. name Source Community # com2sec: Fixed command # [-CN context]: optional, used in V3 # sec. name: Internal ing name, String, used when creating a group # Source: accessible IP address range, default value "default", that is, any IP address can be accessed. you can also use a limit of 192.168.1.0/24, or 192.168.1.0/255.255.255.0 # community: entity string. The external name com2sec notconfiguser default public # format: group groupname securitymodel sec. name # group: Fixed command # grou Pname: group name # securitymode1: V1, v2c, USM, TSM, KSM # sec. Name: maps sec. name to a group with the same access permissions. Group notconfiggroup v2c notconfiguser # format: View viewname type OID [mask] # view: defines a view, which indicates the subtree in the entire OID tree. The same subtree can define multiple views # viewname: view name # type: included and exclude (including and excluded) # OID: accessible OID # [mask]: For oid mask example: view all include 1.3.6.1.2.1.4 0xf0 #0xf0: 1111 0000, that is, the first four digits of the accessed OID must be 1.3.6.1. Otherwise, they cannot be accessed. That is, they can access all the sub-oidview systemview encoded in 1.3.6.1. 1.3.6.1.2.1.25.1.1 # format: Access groupname Context Model Level prefx view rea D write # access: Set the access permission to a view # groupname: name of the group that controls the access permission # context: V1 and v2c versions, the context must be set to "" # mode1: v1, v2c, USM, TSM, and KSM. The last three authorization modes are V3. USM (user-based authentication), TSM (SSH or dtls), and KSM (used to support Kerberos) # level: noauth, auth, and priv. Noauth (no access permission is allowed, V1, v2c is available), auth (access is allowed only when permission is required), pric (forced encrypted access) # prefx: exact or prefix (exact or prefix) # view read and write: Specifies whether the permission of a view can be get *, Set *. If the view cannot be read or write, set noneaccess notconfiggroup "" any noauth exact systemview none # if it is not commented out, logs will be generated to the log, only disable dontlogtcpwrappersconnects yessyslocation unknown (edit/etc/snmp/snmpd during debugging. conf) syscontact root <[email protected]> (Configure/etc/snmp. local. conf) Other specific parameters, please refer to the official instructions http://www.NET-snmp.org/docs/man/snmpd.conf.html
3. Start the SNMP service.
service snmpd startchkconfig --add snmpd 3,5 on
4. Verify that the service is successfully started.
[[Email protected] ~] # Snmpwalk-V 2C-C public localhost sysNameSNMPv2-MIB: sysname.0 = string: vpv-zhu.abc.com # As above, you can get the host name, indicating that the SNMP service can be used normally [[email protected] ~] # Snmptranslate-to | head-n3.1.3.6.1.3.6.1 # The above indicates that the SNMP tool can use [email protected] ~] # Snmpwalk-V 2C-C public 10.60.12.64 sysname # test whether the remote Linux service is normal. If the remote host name is not available, check the remote Linux Firewall [[email protected] ~]. # Snmpwalk-V 2C-C public localhost 1.3.6.1.4.1.2021.11.11.0ucd-SNMP-MIB: sscpuidle.0 = no more variables left in this MIB view (it is past the end of the MIB Tree) # The above indicates that the CPU idle status cannot be obtained (Note: 1.3.6.1.4.1.2021.11.11.0 is the oId of the CPU idle rate of the host)
5. To obtain important host information, modify the default configuration of SNMP.
View systemview permission ded. 1.3.6.1.2.1.25.1.1 # view defines which node devices can be accessed view systemview permission ded./# make access to all information (more dangerous)
Note: The firewall must enable UDP port 161.
SNMP simple OID list: http://www.ttlsa.com/monitor/snmp-oid/
This article from the "Stranded" blog, please be sure to keep this source http://yasar.blog.51cto.com/9120455/1876306
Enable SNMP for centos