今对ubuntu的系统进行snmpd配置,完成后无法启动,经查看syslog日志,有如下报错:
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: error on subcontainer 'ia_addr' insert (-1)
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: /etc/snmp/snmpd.conf: line 146: Warning: Unknown token: defaultMonitors.
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: /etc/snmp/snmpd.conf: line 148: Warning: Unknown token: linkUpDownNotifications.
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: Turning on AgentX master support.
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: Error opening specified endpoint "udp6:[::1]:161"
Mar 3 15:11:45 HK-EN-Prod-Web02 snmpd[10060]: Server Exiting with code 1
今查看发现ipv6未启动,信息如下:
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:a7:5c:96 brd ff:ff:ff:ff:ff:ff
inet 172.16.1.25/24 brd 172.16.1.255 scope global eth0
valid_lft forever preferred_lft forever
解决方法:
1、设置不监控在ipv6上:
#agentAddress udp:161,udp6:[::1]:161
agentAddress udp:161
2、启动ipv6:
net.ipv6.conf.all.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 net.ipv6.conf.lo.disable_ipv6=0