centos里启用snmp的监控

来源:互联网 发布:网络投资靠谱吗 编辑:程序博客网 时间:2024/05/16 10:25
    yum install net-snmp net-snmp-devel -y

    /etc/init.d/snmpd stop

    net-snmp-config –create-snmpv3-user -ro -A 密码 -a MD5 用户名

    /etc/init.d/snmpd start

    密码要超过8位



[root@zhudoubaby ~]# net-snmp-config --create-snmpv3-user -ro
Enter a SNMPv3 user name to create:
test
Enter authentication pass-phrase:
net-snmp-config
Enter encryption pass-phrase:
  [press return to reuse the authentication pass-phrase]
net-snmp-config
adding the following line to /var/net-snmp/snmpd.conf:
   createUser zhudou MD5 "netsnmp$#config" DES netsnmp$#config
adding the following line to /etc/snmp/snmpd.conf:
   rouser test
[root@zhudoubaby ~]# service snmpd start




有防火墙的情况下,得把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  (不用)
 



/etc/sysconfig/iptables

原创粉丝点击