一、在被监控机器中确认snmp是否启动

 
  
  1. # service snmpd status 

二、如果没有启动的,执行下列命令启动

 
  
  1. # service snmpd start 

三、启动成功后,在监控机器上执行下面命令确认被监控机器的snmp能否返回数据

 
  
  1. # snmpwalk -v 2c -c public 192.168.1.131 if  

四、如果出现下面字样则表示被监控机器的snmp服务没有给监控机器授权

 
  
  1. Timeout: No Response from 192.168.1.131 

五、打开被监控机器的/etc/snmp/snmp.conf文件,更改如下配置:

1. 查找以下字段

 
  
  1. #       sec.name  source          community 
  2. com2sec notConfigUser default      public 

 

将"comunity"字段改为你要设置的密码.比如"public".

将“default”改为你想哪台机器可以看到你的snmp信息,如192.168.2.105

2. 查找以下字段:

 
  
  1. #### 
  2. # Finally, grant the group read-only access to the systemview view
  3. #       group          context sec.model sec.level prefix read   write  notif 
  4. access  notConfigGroup ""      any       noauth    exact  systemview none none 

 

将"read"字段值改为all.

 
  
  1. access  notConfigGroup ""      any       noauth    exact  all none none 

3. 查找以下字段:

 
  
  1. ## incl/excl subtree mask 
  2. #view all included .1 80 

 

将该行前面的"#"去掉.

保存关闭.

4. 运行/etc/init.d/snmpd start命令运行snmpd.或 service snmpd start 

六、使用ntsysv,让snmp服务,每次开机自动运行

七、再用snmpwalk执行

 
  
  1. IF-MIB::ifIndex.1 = INTEGER: 1 
  2. IF-MIB::ifIndex.2 = INTEGER: 2 
  3. IF-MIB::ifIndex.3 = INTEGER: 3 
  4. IF-MIB::ifIndex.4 = INTEGER: 4 
  5. IF-MIB::ifIndex.5 = INTEGER: 5 
  6. IF-MIB::ifIndex.6 = INTEGER: 6 
  7. IF-MIB::ifDescr.1 = STRING: lo 
  8. IF-MIB::ifDescr.2 = STRING: eth0 
  9. IF-MIB::ifDescr.3 = STRING: eth1 
  10. .... 

收到返回数据则表明snmp已经ok了