centos上安装net-snmpnet-snmp 的安装和配置
从以下地址可以下载到最新的软件安装包:
http://nchc.dl.sourceforge.net/sourceforge/net-snmp/net-snmp-5.4.2.1.tar.gz
下载

1
、解压源码包:
tar –zxvf net-snmp-5.4.2.1.tar.gz

2、进入解压后的文件目录:
cd net-snmp-5.4.2.1
 
3、执行./configure
default version of-snmp-version(3): 3(在这里版本通常有三种形式:1,2c,3
Systemcontact information
(配置该设备的联系信息): heaven(也可以是邮箱地址)
System location (
该系统设备的地理位置):BEIJING P.R China
Location to write logfile (
日志文件位置): /var/log/snmpd.log
Location to Write persistent(
数据存储目录): /var/net-snmp
在make的时候
如果遇到报错
./configure 后显示
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure.sh:error:no acceptable C compiler found in $PATH
See 'config.log' for more details.
是没有安装gcc
这样一下就可以了
yum -y install gcc
安装gcc
 
4#make
编 译源码包文件,通常只需要执行make命令
#make install

5、
cp EXAMPLE.conf /etc/snmp/snmpd.conf //cp样例配置到安装目录下
 
6vi /etc/snmp/snmpd.conf //编辑配置文件
把里面的mynetwork改成需要查看snmp信息的主机ip 地址
COMMUNITY改成你设定的值(自己起个字符串形式的名字)。
然后保存退出


7/usr/local/sbin/snmpd –c /etc/snmp/snmpd.conf & //启动snmp

8
netstat -an  //查看snmp是否启动


在正确配置以后如果发现ping通,但是snmp监控的设备报错的话
看下你的iptables的问题。
把iptable里面的端口打开
默认的snmp打开的是udp 161的端口
编辑iptables
vi /etc/sysconfig/iptables
加一个(如果你上面有关于UDP的允许请复制粘贴)然后修改端口号
-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 161 -j ACCEPT
保存
重启服务
service iptables restart
这个就是我做的时候遇到的问题和解决的方法