软件安装

切换到系统管理员帐户

安装snmp
确认snmp代理已安装
rpm -q net-snmp
如果未安装,安装snmp
yum install net-snmp

设置开机自动运行snmp
/sbin/chkconfig snmpd on配置snmp

vi /etc/snmp/snmpd 
第一步,snmp团体名默认为public,可更改为其他,如下:
# First, map the community name "public" into a "security name"
# sec.name source community
com2sec notConfigUser default public

第二步,将如下位置的systemview改为all,如下:
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
#access notConfigGroup "" any noauth exact systemview none none
access notConfigGroup "" any noauth exact all none none

第三步,将如两行下行前面的注释去掉,如下:
## incl/excl subtree mask
view all included .1 80
## -or just the mib2 tree-
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

第四步,将下面这行前的注释去掉,如下:
#access notConfigGroup "" any noauth exact roview rwview none
access notConfigGroup "" any noauth exact mib2 none none

第五步,启动snmpd,并设置开机自动启:
service snmpd restart
chkconfig --level 345 snmpd on

修改配置文件

启动snmp

/etc/init.d/snmpd start
如果已启动则重启snmp服务
/etc/init.d/snmpd restart

测试snmp

查看端口是否打开
netstat -ln | grep 161

安装snmp测试工具
yum install net-snmp-utils

本机测试snmp数据(修改monit为配置的团体名)
snmpwalk -v 2c -c public localhost system

snmpwalk -v3 -u username -l auth -a MD5 -A password localhost

创建SNMP(v3)用户

net-snmp-config --create-snmpv3-user -ro -a MD5 lyceemsnmp lyceem.com

远程测试snmp数据(修改ip为服务器ip,snmpwalk命令需要安装net-snmp)
snmpwalk -v 2c -c public ip system

故常处理

错误排除如果本地测试snmp有数据,远程测试snmp无数据则由于服务器防火墙禁止了外部访问服务器udp 161端口,则:
修改 /etc/sysconfig/iptables (或者:/etc/sysconfig/iptables-config ) ,增加如下规则:
-A RH-Firewall-1-INPUT -p udp -m state Cstate NEW -m udp Cdport 161 -j ACCEPT
重启iptables
/etc/init.d/iptables restart

--
刘林强
 

Ubuntu11.04下的SNMP配置:

root@Ubuntu:~#sudo apt-get install snmp snmpd /*安装snmp服务*/

root@Ubuntu:~#vi /etc/snmp/snmpd.conf /*编辑snmp配置文件*/

在这里使用默认团体名public,实际环境中建议更改。

1.将原有“agentAddress udp:127.0.0.1:161”改为:

agentAddress 192.168.1.9 /*192.168.1.9为本机IP,即监控服务器要监控的主机IP*/

2.加入一行如下:

access MyROSystem "" any noauth exact all none none

3.将原有“rocommunity public default -V systemonly” 的"-V systemonly" 参数去掉,变成:

rocommunity public default

4.将“#trap2sink localhost public”和“#informsink localhost public”前面的“#”去掉,改为:

trap2sink localhost public

informsink localhost public

5.重启SNMP服务:

/etc/init.d/snmpd restart

6.检验snmp获取数据:

snmpwalk -v 2c -c public 192.168.1.9

****************************************************************************

CentOS6.3下的SNMP配置:

安装SNMP服务:

yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils php-snmp
编辑snmpd文件:

vi /etc/snmp/snmpd 
第一步,snmp团体名默认为public,可更改为其他,如下:
# First, map the community name "public" into a "security name"
# sec.name source community
com2sec notConfigUser default public

第二步,将如下位置的systemview改为all,如下:
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
#access notConfigGroup "" any noauth exact systemview none none
access notConfigGroup "" any noauth exact all none none

第三步,将如两行下行前面的注释去掉,如下:
## incl/excl subtree mask
view all included .1 80
## -or just the mib2 tree-
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

第四步,将下面这行前的注释去掉,如下:
#access notConfigGroup "" any noauth exact roview rwview none
access notConfigGroup "" any noauth exact mib2 none none

第五步,启动snmpd,并设置开机自动启:
service snmpd restart
chkconfig --level 345 snmpd on

snmp ubuntu/centos--的更多相关文章

  1. 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置

    简介 Shutter前身叫GScrot,它是一款相当棒的截图软件. 通过Shutter,你可以截取包括选定区域.全屏幕.窗口.窗口内的控件甚至网页的图像.通过内置的强大插件机制,你可以在截图后,对图像 ...

  2. SecureCRT连接Ubuntu,centos失败,长时间的重新连接,连接不了解决办法

    Ubuntu,centos默认未安装ssh远程加密连接服务.使用命令,安装即可. 0.sudo apt-get install openssh-server openssh-client 1.rpm ...

  3. SecureCRT连接Ubuntu,centos失败解决

    SecureCRT连接Ubuntu,centos失败,长时间的重新连接,连接不了. Ubuntu,centos默认未安装ssh远程加密连接服务.使用命令,安装即可. 1.sudo apt-get in ...

  4. linux 用户/用户组添加修改删除(ubuntu/centos)

    一.LINUX(UBUNTU/CENTOS)用户添加删除修改 1.建用户: adduser web                             //新建web用户 useradd web  ...

  5. Ubuntu/CentOS下编译Nginx最基本参数

    Ubuntu/CentOS下编译Nginx安装基本参数,做个记录: groupadd www useradd -g www www ./configure --user=www --group=www ...

  6. linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接

    原 linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接 2017年03月20日 16:55:57 风来了- 阅读数:2291 标签: centoslinux ...

  7. ssh远程连接docker中linux(ubuntu/centos)

    ssh远程连接docker中linux(ubuntu/centos) https://www.jianshu.com/p/9e4d50ddc57e centos docker pull centos: ...

  8. Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redhat 7)

    Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redhat 7) 您多久访问一次Linux桌面? 您使用什么工具来访问远程桌面? Xrdp是一个开源工具, ...

  9. Debian/Ubuntu/CentOS VPS安装Net-Speeder并优化

    安装过程: CentOS安装 wget --no-check-certificate https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/ ...

随机推荐

  1. ABAP 合并单元格自建函数

    FORM frm_merge_cells USING sor_cell tar_cell.   CALL METHOD OF excel 'Range' = range     EXPORTING   ...

  2. nfs部署和优化

    nfs--网络文件系统 1.说明:允许一个系统在网络上与他人共享目录和文件 2.好处:通过nfs服务,就可以让这个机器访问远程的文件,像访问自己的文件一样,属于cs通信   3.原理说明:假设有A,B ...

  3. .NET 清理非托管资源

    Dispose 类型的 Dispose 方法应释放它拥有的所有资源.它还应该通过调用其父类型的 Dispose 方法释放其基类型拥有的所有资源.该父类型的 Dispose 方法应该释放它拥有的所有资源 ...

  4. Git学习总结

    master主分支合并dev分支,代码 :git merge dev ,跳出如下界面.输入:wq,(:wq命令是LINUX命令,强制写入文件并结束),可以强制合并.但为什么会跳出该界面,我也没搞清楚. ...

  5. 全选、取消、2级 checkbox的选中切换

    需求:点击父级checkbox的时候,子级出现全选或全取消:点击子级时,如:子级都是在未选中时,点击某一个子级,则父级选中:如:子级中只有一个选中状态(其他子级都是未选中),点击该子级,则父级也改为未 ...

  6. OpenStack 云计算基础知识

    OpenStack Docs: Currenthttp://docs.openstack.org/ OpenStack云计算快速入门教程 - OpenStack及其构成简介_服务器应用_Linux公社 ...

  7. HDU3571 N-dimensional Sphere(高斯消元 同模方程)

    每个点到中心距离相等,以第0个点为参考,其他n个点到中心距等于点0到中心距,故可列n个方程 列出等式后二次未知数相消,得到线性方程组 将每个数加上1e17,求答案是再减去,求解时对一个2 * (1e1 ...

  8. [工作中的设计模式]迭代子模式Iterator

    一.模式解析 迭代子模式又叫游标(Cursor)模式,是对象的行为模式.迭代子模式可以顺序地访问一个聚集中的元素而不必暴露聚集的内部表象 1.迭代子模式一般用于对集合框架的访问,常用的集合框架为lis ...

  9. FZU月赛20160416 ABEF

    Problem A ABCDEFG Accept: 302    Submit: 442Time Limit: 1000 mSec    Memory Limit : 32768 KB  Proble ...

  10. compass tables 表格 表格常见样式[Sass和compass学习笔记]

    demo 源码 地址 https://github.com/qqqzhch/webfans compass  的表格提供了集中常见样式 表格边框 outer-table-borders($width, ...