无法启动zabbix_agentd
tail -f /tmp/zabbix_agentd.log
2046:20120625:095633.050 Can't allocate shared memory for collector. [No space left on device]
2056:20120625:095814.340 Zabbix Agent started. Zabbix 1.8.2 (revision 11211).
2056:20120625:095814.340 Can't allocate shared memory for collector. [No space left on device]
2069:20120625:095945.056 Zabbix Agent started. Zabbix 1.8.2 (revision 11211).
2070:20120625:095945.056 zabbix_agentd collector started
2071:20120625:095945.057 zabbix_agentd listener started
2072:20120625:095945.057 zabbix_agentd listener started
2073:20120625:095945.058 zabbix_agentd listener started
2074:20120625:095945.058 zabbix_agentd active check started [192.168.0.163:10051]
查看sysctl发现
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
之前优化的数值过大
修改为
kernel.shmmax = 4294967294
kernel.shmall = 268435456
注释:
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295
(kernel.shmmax最大共享内存段大小,取物理内存一半即可)
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456
(kernel.shmall的单位是页面数,当前的x86体系上 一页=4k(4096字节。),也就是说此共享内存的总量为268435456*4/1024/1024/1024=1G,可根据实际需要设置,肯定小于最大内存段)
可以使用echo、cat、sysctl -w、编辑/etc/sysctl.conf 的方式来改变内存共享参数。写进
/etc/sysctl.conf 的内核参数应该执行sysctl -p 把刚才的修改实例化为当前的内核参数。
写进/etc/sysctl.conf 的内核参数下次重启以后依然有效。
另外在修改shmmax 参数前,请先确定系统的物理内存大小。
kernel.shmall = 2097152 # 可以使用的共享内存的总量。
kernel.shmmax = 2147483648 # 最大共享内存段大小。取物理内存大小的一半,单位为字节
kernel.shmmni = 4096 # 整个系统共享内存段的最大数目。
kernel.sem = 250 32000 100 128 # 每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max = 65536 # 系统中所允许的文件句柄最大数目。
net.ipv4.ip_local_port_range = 1024 65000 # 应用程序可使用的IPv4端口范围。
net.core.rmem_default = 1048576 # 套接字接收缓冲区大小的缺省值
net.core.rmem_max = 1048576 # 套接字接收缓冲区大小的最大值
net.core.wmem_default = 262144 # 套接字发送缓冲区大小的缺省值
net.core.wmem_max = 262144 # 套接字发送缓冲区大小的最大值