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/ ...
随机推荐
- springMVC学习之url重写:urlrewrite with tuckey UrlRewriteFilter
在开发网站时地址栏的一些信息是我们不希望让客户看到,所以在开发时候就会涉及到url重写的问题. 下面介绍一种常用的url地址重写的方法. 1.利用maven下载相关jar文件,pom文件配置如下: & ...
- js 获取元素宽高
可以用源生js的.offsetHeight .offsetWidth属性 document.getElementById("temp_form").offsetHeight // ...
- JScrollBar
接到了GUI相关的task,从来没看Java的我只好各种百度加看书了.这里介绍了 JScrollBar 的简单应用. 话不多说,直接上代码和效果图. import java.awt.*; imp ...
- xcode 消除警告
项目中引用大量的第三方代码时,这些代码很复杂,不要轻易去改动它,如果编译产生很多警告,该如何消除呢? 1. 最直接.最一劳永逸.最安全的方式,直接找到警告的那段代码,改为不警告.这个方式最安全. 可是 ...
- sqlserver索引小结
1.1 什么是索引? SQL索引有两种,聚集索引和非聚集索引,索引主要目的是提高了SQL Server系统的性能,加快数据的查询速度与减少系统的响应时间 下面举两个简单的例子: 图书馆的例子:一个图书 ...
- win7安装Linux
1. 新建分区必须为FAT32 (不是绿色的可用分区,只要linux安装时可以识别) 大小大于8G 2.打开ISO, 把casper文件夹下的initrd.lz vmlinuz 两个文件提取到C盘下 ...
- Oracle 11g RAC 卸载CRS步骤
Oracle 11g之后提供了卸载grid和database的脚本,可以卸载的比较干净,不需要手动删除crs ##########如果要卸载RAC,需要先使用dbca删除数据库,在执行下面的操作### ...
- Git版本控制管理学习笔记1-介绍
几乎所有的版本控制工具都是出于同样的目的:开发以及维护开发出来的代码,方便读取代码的历史,记录所有的修改.这里,介绍的是当前在开源社区内非常流行的版本控制工具Git.它是由Linus Torvalds ...
- 转载--PayPal高级工程总监:读完这100篇论文 就能成大数据高手
http://www.csdn.net/article/2015-07-07/2825148
- 【转】oracle 中随机取一条记录的两种方法
oracle 中随机取一条记录的两种方法 V_COUNT INT:=0; V_NUM INT :=0; 1:TBL_MYTABLE 表中要有一个值连续且唯一的列FID BEGIN SELECT COU ...