无法正确启动 snmpd

无法正确启动 snmpd

我尝试在 ubuntu-server 15.10 中设置 snmp 来执行一些测试。我已将 snmp 安装为:

sudo apt-get install snmp snmpd snmp-mibs-downloader

安装后我评论了以下行/etc/snmp/snmp.conf

#mibs :

我正在尝试在 ubuntu-server 15.10 中启动进程 snmpd 但如果我这样做就会失败:

sudo service snmpd start

我遇到以下错误:

Job for snmpd.service failed because the control process exited with error code. See "systemctl status snmpd.service" and "journalctl -xe" for details.

但是,如果我这样做,$ sudo /usr/sbin/snmpd -f我可以启动该服务,因为我检查它是否可以与该命令一起使用snmpwalk。然而,它也会产生一些错误:

$ sudo /usr/sbin/snmpd -f
Cannot statfs /sys/fs/cgroup/systemd: No such file or directory
Cannot statfs /sys/fs/cgroup/cpu,cpuacct: No such file or directory
Cannot statfs /sys/fs/cgroup/freezer: No such file or directory
Cannot statfs /sys/fs/cgroup/net_cls,net_prio: No such file or directory
Cannot statfs /sys/fs/cgroup/cpuset: No such file or directory
Cannot statfs /sys/fs/cgroup/blkio: No such file or directory
Cannot statfs /sys/fs/cgroup/perf_event: No such file or directory
Cannot statfs /sys/fs/cgroup/hugetlb: No such file or directory
Cannot statfs /sys/fs/cgroup/memory: No such file or directory
Cannot statfs /sys/fs/cgroup/devices: No such file or directory
Turning on AgentX master support.
NET-SNMP version 5.7.3

我试图寻找解决方案,但我一无所获。有人可以帮忙吗?

我还复制粘贴前两个命令的输出:

$ systemctl status snmpd.service
● snmpd.service - LSB: SNMP agents
   Loaded: loaded (/etc/init.d/snmpd)
   Active: failed (Result: exit-code) since Tue 2016-03-15 15:32:18 CET; 9min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 15559 ExecStart=/etc/init.d/snmpd start (code=exited, status=219/CGROUP)

Mar 15 15:32:18 ubuntu-server systemd[1]: Starting LSB: SNMP agents...
Mar 15 15:32:18 ubuntu-server systemd[1]: snmpd.service: Control process exited, code=exited status=219
Mar 15 15:32:18 ubuntu-server systemd[1]: Failed to start LSB: SNMP agents.
Mar 15 15:32:18 ubuntu-server systemd[1]: snmpd.service: Unit entered failed state.
Mar 15 15:32:18 ubuntu-server systemd[1]: snmpd.service: Failed with result 'exit-code'.

$journalctl -xe
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit system-getty.slice: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-modules-load.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-vconsole-setup.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit apport.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit samba-ad-dc.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dbus.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-journald.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-mqueue.mount: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit sys-fs-fuse-connections.mount: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit ifup-wait-all-auto.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-sda5.swap: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-user-sessions.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit resolvconf.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit nmbd.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-timesyncd.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-hugepages.mount: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit tomcat7.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-disk-by\x2duuid-e0924ced\x2deab6\x2d4590\x2d96e7\x2ddba3bba25688.swap: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit rsyslog.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-tmpfiles-setup.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-disk-by\x2did-ata\x2dWDC_WD10EZEX\x2d08M2NA0_WD\x2dWCC3F3528610\x2dpart5.swap: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit cron.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit winbind.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-update-utmp.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit apache2.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit networking.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit dev-disk-by\x2did-wwn\x2d0x50014ee25f55a721\x2dpart5.swap: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit system-postgresql.slice: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to create cgroup : No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: Failed to realize cgroups for queued unit systemd-udev-trigger.service: No such file or directory
Mar 15 15:43:57 ubuntu-server systemd[1]: smbd.service: Control process exited, code=exited status=219
Mar 15 15:43:57 ubuntu-server systemd[1]: Reload failed for LSB: start Samba SMB/CIFS daemon (smbd).
-- Subject: Unit smbd.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit smbd.service has finished reloading its configuration
--
-- The result is failed.
Mar 15 15:43:57 ubuntu-server dhclient[712]: bound to 192.168.137.153 -- renewal in 291 seconds.

谢谢!

答案1

我使用修复了同样的问题本教程

您需要编辑该文件/etc/snmp/snmpd.conf改变代理地址相应的指令。然后使用创建用户RW用户,创建一个用户并分别为其授予足够的访问级别。

应该看起来像这样。

#  Listen for connections from the local system only
#agentAddress  udp:127.0.0.1:161 # <= comment this line
#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161

createUser bootstrap MD5 temp_password DES

rwuser bootstrap priv
rwuser demo priv

问候,简历

相关内容