snmp ubuntu/centos--
软件安装
切换到系统管理员帐户
安装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--的更多相关文章
- 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置
简介 Shutter前身叫GScrot,它是一款相当棒的截图软件. 通过Shutter,你可以截取包括选定区域.全屏幕.窗口.窗口内的控件甚至网页的图像.通过内置的强大插件机制,你可以在截图后,对图像 ...
- SecureCRT连接Ubuntu,centos失败,长时间的重新连接,连接不了解决办法
Ubuntu,centos默认未安装ssh远程加密连接服务.使用命令,安装即可. 0.sudo apt-get install openssh-server openssh-client 1.rpm ...
- SecureCRT连接Ubuntu,centos失败解决
SecureCRT连接Ubuntu,centos失败,长时间的重新连接,连接不了. Ubuntu,centos默认未安装ssh远程加密连接服务.使用命令,安装即可. 1.sudo apt-get in ...
- linux 用户/用户组添加修改删除(ubuntu/centos)
一.LINUX(UBUNTU/CENTOS)用户添加删除修改 1.建用户: adduser web //新建web用户 useradd web ...
- Ubuntu/CentOS下编译Nginx最基本参数
Ubuntu/CentOS下编译Nginx安装基本参数,做个记录: groupadd www useradd -g www www ./configure --user=www --group=www ...
- linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接
原 linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接 2017年03月20日 16:55:57 风来了- 阅读数:2291 标签: centoslinux ...
- ssh远程连接docker中linux(ubuntu/centos)
ssh远程连接docker中linux(ubuntu/centos) https://www.jianshu.com/p/9e4d50ddc57e centos docker pull centos: ...
- Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redhat 7)
Xrdp - 通过Windows的RDP连接Linux远程桌面(Ubuntu/CentOS/Redhat 7) 您多久访问一次Linux桌面? 您使用什么工具来访问远程桌面? Xrdp是一个开源工具, ...
- Debian/Ubuntu/CentOS VPS安装Net-Speeder并优化
安装过程: CentOS安装 wget --no-check-certificate https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/ ...
随机推荐
- Angular2 模板语法
1. 说明 Angular2的模板用来显示组件外观,作为视图所用,用法和html语法基本一致,最简单的Angular2的模板就是一段html代码.Angular模板语法主要包括以下几个部分: l 直接 ...
- Quartz资源收藏
项目中使用Quartz集群分享 : http://hot66hot.iteye.com/blog/1726143 发布 Quartz Job Scheduling Framework 中文 PDF 版 ...
- OpenCv全景图像拼接
http://my.oschina.net/xiaot99/blog/226589 http://blog.csdn.net/chenjiazhou12/article/details/2282548 ...
- OneThink开发框架
OneThink是一个开源的内容管理框架,基于最新的ThinkPHP3.2版本开发,提供更方便.更安全的WEB应用开发体验,采用了全新的架构设计和命名空间机制,融合了模块化.驱动化和插件化的设计理念于 ...
- CustomEvent自定义事件
javascript与HTML之间的交互是通过事件来实现的.事件,就是文档或浏览器窗口发生的一些特定的交互瞬间.通常大家都会认为事件是在用户与浏览器进行交互的时候触发的,其实通过javascript我 ...
- 2015ACM/ICPC亚洲区上海站
5573 Binary Tree(构造) 题意:给你一个二叉树,根节点为1,子节点为父节点的2倍和2倍+1,从根节点开始依次向下走k层,问如何走使得将路径上的数进行加减最终结果得到n. 联想到二进制. ...
- Android 应用测试总结
前提所有的功能分支已完成 启动:1. 启动入口:桌面正常启动,最近运行启动,所有程序列表中启动,锁屏快捷启动2. 其他入口:从其他程序开启应用,从外部以文件形式打开应用(如果有)3. 退回:从其他程序 ...
- python操作日期和时间的方法
不管何时何地,只要我们编程时遇到了跟时间有关的问题,都要想到 datetime 和 time 标准库模块,今天我们就用它内部的方法,详解python操作日期和时间的方法.1.将字符串的时间转换为时间戳 ...
- 【软件推荐】 Moom-窗口布局软件(V.3.2.2)【破解+汉化】
本文并非最终版本,如有更新或更正会第一时间置顶,联系方式详见文末 如果觉得本文内容过长,请前往本人 “简书” 下载地址: 软件:https://yunpan.cn/cuTg8rCMTsLT6 ...
- OOP: One pont of view of OOP与基于算法设计的区别
..摘自<C++网络编程 卷1:运用ACE和模式消除复杂性> <C++ Network Programming Volume 1 Mastering Complexity with ...