时间:2023-06-02 16:16:41 来源: 人气:
简单网络管理协议(SNMP),由一组网络管理的标准组成,包含一个应用层协议(application layer protocol)、数据库模型(database schema)和一组资源对象,下文一起来和111cn小编看看centos6系统snmp监控安装配置与使用。, 安装 Net-SNMP, CentOS及其它RedHat系列产品提供了net-snmp的二进制包。我们可以直接从源里安装。, Example, yum install net-snmp net-snmp-devel net-snmp-utils, 说明:net-snmp-devel是为了使用net-snmp-config, net-snmp-utils是为了使用snmpwalk。, 配置 Net-SNMP, Example, create-snmpv3-user -ro -A snmp@jiankongbao -a MD5 jiankongbao, 以上命令,创建一个snmpv3用户,只读,使用MD5,用户名为jiankongbao,密码为snmp@jiankongbao。, 注意:运行之前请先停用net-snmp服务。, Example, service snmpd stop, 运行 Net-SNMP, 运行 Net-SNMP 服务的方法比较简单,不过Net-SNMP服务的名字是snmpd。, Example, service snmpd start, 如果要加入开机自动运行服务列表:, Example, chkconfig snmpd on, 检测 Net-SNMP, 我们可以使用 snmpwalk 来检测snmp服务是否正常开启。, Example, snmpwalk -v 3 -u jiankongbao -a MD5 -A "snmp@jiankongbao" -l authNoPriv 127.0.0.1 sysDescr, 如果一切正常,就会返回正常结果, 有防火墙的情况下,得把udp 161 端口打开了, [root@zhudoubaby ~]# iptables -L, Chain INPUT (policy ACCEPT), target prot opt source destination, RH-Firewall-1-INPUT all -- anywhere anywhere, Chain FORWARD (policy ACCEPT), target prot opt source destination, RH-Firewall-1-INPUT all -- anywhere anywhere, Chain OUTPUT (policy ACCEPT), target prot opt source destination, Chain RH-Firewall-1-INPUT (2 references), target prot opt source destination, ACCEPT udp -- anywhere anywhere state NEW udp dpt:snmp (必须的), ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:smtp (不用), , 使用过程错误记录, 注意:有时输入service snmpd status 后出现, snmpd dead but pid file exists, 或者, snmpd dead but subsys locked, 原因是没有先输入snmpd,原理还不是很明白,但是先记着吧。,