zabbix登陆问题:cannot allocate shared memory for collector

问题说明:
在一台zabbix被监控服务器上(64位centos6.8系统,64G内容)启动zabbix_agent,发现进程无法启动,10050端口没有起来!

启动zabbix_agent进程没有报错,但10050端口没有正常启动起来。
[[email protected] ~]# /usr/local/zabbix/sbin/zabbix_agentd
[[email protected] ~]# ps -ef|grep zabbix_agent
root 27506 27360 0 11:07 pts/5 00:00:00 grep --color zabbix
[[email protected] etc]# lsof -i:10050

查看/usr/local/zabbix/logs/zabbix_agentd.log日志,发现报错如下:
................
27667:20161027:111554.851 cannot allocate shared memory of size 657056: [28] No space left on device
27667:20161027:111554.851 cannot allocate shared memory for collector
..............

原因分析:
这是因为内核对share memory的限制造成的。

处理过程记录:
[[email protected] logs]# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 1940588
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 32768
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

从上面命令结果可以看到:
max total shared memory设置的是2M,max seg size设置的是8M,这显然不够allocate(分配)zabbix_agent启动所使用的内存。

查看目前的共享内存设置,
[[email protected] logs]# sysctl -a|grep shm
kernel.shmmax = 1987162112
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.shm_rmid_forced = 0
vm.hugetlb_shm_group = 0

其中kernel.shmall代表总共能分配的共享内存,这里是2G,kernel.shmax代表单个段能allocate的内存(以字节为单位),这里是2M,所以肯定有问题!

然后查看/etc/sysctl.conf
[[email protected] logs]# cat /etc/sysctl.conf
........
kernel.shmall = 2097152
kernel.shmmax = 1987162112

显然在sysctl.conf文件里设置的kernel.shamll和kernel.shmmax参数的值小了。

--------------------------------------------------------------
本机是64位的centos 6.8系统,64G内存,查看其它同系统的被监控服务器发现:
[[email protected] ~]# cat /etc/sysctl.conf
........
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

[[email protected] logs]# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 32768
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

即64位的centos6系统(64G)的上面两个参数的默认值是64G和4G,设置的都是系统能识别的最大内存。
---------------------------------------------------------------

现在只需要在本机调大这两个参数值即可解决问题!
[[email protected] logs]# cat /etc/sysctl.conf
........
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.msgmnb = 65536
kernel.msgmax = 65536

执行sysctl -p生效
[[email protected] logs]# sysctl -p

再次查看发现已经修改成功了!
[[email protected] logs]# sysctl -a|grep shm
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.shm_rmid_forced = 0
vm.hugetlb_shm_group = 0
[[email protected] logs]# ipcs -l

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 32768
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

最后重新启动zabbix,发现10050端口顺利启动了:
[[email protected] ~]# /usr/local/zabbix/sbin/zabbix_agentd
[[email protected] logs]# ps -ef|grep zabbix
zabbix 27776 1 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd
zabbix 27777 27776 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 27778 27776 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 27779 27776 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 27780 27776 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 27781 27776 0 11:22 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 28188 27360 0 11:48 pts/5 00:00:00 grep --color zabbix
[[email protected] logs]# lsof -i:10050
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
zabbix_ag 27776 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 27777 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 27778 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 27779 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 27780 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 27781 zabbix 4u IPv4 112357384 0t0 TCP *:zabbix-agent (LISTEN)
[[email protected] logs]#

总结:
其实不止是zabbix程序启动会碰到这个问题,很多程序出现此错误也能使用该方法解决,就是因为内核对资源的限制问题。

时间: 2024-10-08 18:07:20

zabbix登陆问题:cannot allocate shared memory for collector的相关文章

zabbix问题:cannot allocate shared memory of size

问题状态: zabbix_agentd不能启动,系统CentOS 5.8 i386 原因分析: 这是因为内核对share memory的限制造成的. 用到如下命令ipcs [-m|l|a],sysctl [-a|p] 1 [root@server01 ~]# ipcs -l <br /><br /><p></p><p>------ Shared Memory Limits --------<br />max number of seg

ORA-04031:unable to allocate 4120 bytes of shared memory ‘obj stat mem’故障解决

客户报表库,HP-ux B11.31 IA64 FOR Oracle 10.2.0.5.0 RAC系统短信过滤alert日志告警 ORA-00604: error occurred at recursive SQL level 1 ORA-04031:unable to allocate 4120 bytes of shared memory ("shared pool","select f.file#, f.block#, f....","Typeche

ORA-04031: Unable To Allocate 32 Bytes Of Shared Memory

记录一次生产库遇到的4031错误,后来通过调整sga大小将问题解决了 报错信息: ORA-04031: 无法分配 32 字节的共享内存 ("shared pool","select user#,password,datats...","SQLA","tmp")Incident details in: /u01/app/oracle/diag/rdbms/twprod/xxxxx/incident/incdir_237848/x

Insufficient space for shared memory file

linux下应用无故反应异常,登陆服务器查看发现: -bash-4.1$ jps Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file:    /tmp/hsperfdata_kf01/4830 Try using the -Djava.io.tmpdir= option to select an alternate temp location. 4830 Jps -bash-4.

shared memory realm does not exist

1. 先描述一个连接Oracle 10g的错误:“shared memory realm does not exist” 如图所示Sqlplus连接时出现这个错误: 2. Oracle 服务器主要组件分析 下图所示为Oracle服务器主要组件:       如上图所示:Oracle服务器的组件结构,Oracle服务器可以看做由两部分组成:Oracle实例和Oracle数据库,上图被加粗直线分为两个部分,直线上半部分表示Oracle实例,而直线之下表示Oracle数据库.如Oracle Start

GPU编程--Shared Memory(4)

GPU的内存按照所属对象大致分为三类:线程独有的.block共享的.全局共享的.细分的话,包含global, local, shared, constant, and texture memoey, 我们重点关注以下两类内存 Global memory Global memory resides in device memory and device memory is accessed via 32-, 64-, or 128-bytes memory transactions Shared

Android系统匿名共享内存Ashmem(Anonymous Shared Memory)驱动程序源代码分析

文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6664554 在上一文章Android系统匿名共享内存Ashmem(Anonymous Shared Memory)简要介绍和学习计划中, 我们简要介绍了Android系统的匿名共享内存机制,其中,简要提到了它具有辅助内存管理系统来有效地管理内存的特点,但是没有进一步去了解它是如何实 现的.在本文中,我们将通过分析Android系统的匿名共享内存

nginx: [emerg] the size 10485760 of shared memory zone "cache_one" conflicts with already declared size 0

注意配置段中的区域包含关系.proxycachepatch 要在proxy_cache前已经定义. what seems to be the problem? [emerg]: the size 52428800 of shared memory zone "media" conflicts with already declared size 0 in /etc/nginx/conf.d/cache.conf:5 configuration file /etc/nginx/nginx

C++: Virtual Table and Shared Memory

See at:补充栏3: C++对象和共享内存 (叙述内容和Link1的内容基本一致) <C++网络编程 卷1:运用ACE和模式消除复杂性> <C++ Network Programming Volume 1 Mastering Complexity with ACE and Patterns> -Douglas C.Schmidt, Stephen D. Huston -叶斌译 Link1: Is it possible to store polymorphic class in