Linux View and modify swap memory configuration (resolve zabbix-agent boot error)

Source: Internet
Author: User

Problem

Zabbix-agent to start an error on a single centos6.5:

Cannot allocate shared memory of size 949056: [+] No space left on Devicecannot allocate GKFX memory for collector
Check
# sysctl-A | grep shm    33554432    2097152    4096

Kernel.shmmax maximum size of a single shared memory segment, in units of byte
Kernel.shmall system allocates the maximum value of a shared memory segment, in the page
Kernel.shmmni maximum number of shared memory segments

You can also view it from another command:

# IPCS-l    ------Shared Memory Limits--------    4096    32768      8388608

Max number of segments corresponds to Kernel.shmmni
Max seg Size (Kbytes) corresponds to Kernel.shmmax (33554432/1024 = 32768)
Max Total Shared memory (Kbytes) corresponds to Kernel.shmall (you can calculate the size of the page: 8388608 * 1024/2097152 = 4096)

Solve

The following begins to analyze the problem, through the log can see the zabbix-agent need to swap memory size is 949056, far less than Kernel.shmmax (33554432), so this parameter is not a problem;

Use the following command to see how the swap memory is allocated (for ease of display here is a properly running zabbix-agent host):

# IPCS-m    ------Shared Memory segments--------    key        shmid      owner      perms      bytes      nattch     status          0          Zabbix              365056     6

On this basis, statistics on how much swap memory has been used (back to the problem host):

# Ipcs-m | grep ' ^0x ' ' {print$} ' ' {sum+=$1}end{print sum} '    1805120

1805120, far less than Kernel.shmall (2097152 * 4096), so this parameter is not a problem;

There is only one reason left, and the number is full:

' ^0x ' | WC-L                                               4096

At this time you can see through the ipcs-m which procedures to fill the number, if there is an exception can choose to use IPCRM release, are normal occupancy, choose to increase the maximum number (here to twice times):

# sysctl-w kernel.shmmni=8192

If you want to restart the system, it still works, write this parameter to the configuration file:

#/etc/sysctl.conf    kernel.shmmni=8192

(The other two parameters are modified in the same way)

Over

Linux View and modify swap memory configuration (resolve zabbix-agent boot error)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.