satu

Gajah mati meninggalkan tulang
harimau mati meninggalkan belang
manusia mati meninggalkan nama

persiapkan klu kalian mati ingin meninggalkan apa ?

Friday 15 January 2016

zabbix shared memory cannot allocate

http://www.zabbix.org/wiki/How_to/configure_shared_memory

How to/configure shared memory

Configuration of shared memory for zabbix_server daemon

General information

If you need to use significantly increased values of caches (CacheSize, HistoryCacheSize, HistoryTextCacheSize, TrendCacheSize) for zabbix_server daemon then you have to configure (increase) kernel parameters.
Some operating systems, like FreeBSD, require increased kernel parameters to start zabbix_server daemon even with the default configuration file. For example: zabbix_server requires 36 Mbytes total (defaulf Zabbix caches), but FreeBSD by default allows to allocate only 8192*4096 = 32 Mbytes
Note that if other programs are using shared memory as well (PostgreSQL for example), you will have to coordinate the size settings between them. Note that the amount of total size of shared memory (shmall) is measured in Pages and one page size is the value of PAGE_SIZE (normally 4096 bytes).
If zabbix_server will not be able to allocate configured memory, it will not start and will write to the zabbix_server.log these lines:
 cannot allocate shared memory of size 114085069: [22] Invalid argument
 cannot allocate shared memory for <type of cache>

Linux

Check what is the Page size:
 # getconf PAGE_SIZE
 4096

Default values for Linux depend on the distribution used. For example, recent versions of Debian, CentOS, OpenSUSE and Slackware:
 kernel.shmall = 2097152
 kernel.shmmax = 33554432
OpenSUSE 11.x i386:
 kernel.shmall = 268435200
 kernel.shmmax = 4294967295
OpenSUSE 11.x x86_64:
 kernel.shmall = 1152921504606846720
 kernel.shmmax = 18446744073709551615
Description of parameters:
 kernel.shmall: Maximum total size of shared memory in pages (normally 4096 bytes)
 kernel.shmmax: Maximum size of shared memory segment in bytes

Check current values of parameters:
 # sysctl -a | grep -E "shmall|shmmax"
 kernel.shmmax = 33554432
 kernel.shmall = 2097152
or alternative way:
# ipcs -lm
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 131072
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1
Need to increase kernel.shmmax=134217728 which allows to use 128M for any cache related parameter in the zabbix server configuration.
To make the configuration persistent, need to add this line to the /etc/sysctl.conf:
 kernel.shmmax=134217728
which means 128 Mbytes
To apply changes in the /etc/sysctl.conf immediately, execute:
 # sysctl -p
 kernel.shmmax = 134217728

FreeBSD

Check what is the Page size:
 # getconf PAGE_SIZE
 4096

Default values for FreeBSD:
 kern.ipc.shmall: 8192
 kern.ipc.shmmax: 33554432

Description of parameters:
 kern.ipc.shmall: Maximum number of pages (normally 4096 bytes) available for shared memory 
 kern.ipc.shmmax: Maximum shared memory segment size in bytes

Check current values of parameters:
# sysctl -a | grep -E "shmall|shmmax"
kern.ipc.shmall: 8192
kern.ipc.shmmax: 33554432
or alternative way:
# ipcs -M
shminfo:
 shmmax:     33554432 (max shared memory segment size)
 shmmin:            1 (min shared memory segment size)
 shmmni:          192 (max number of shared memory identifiers)
 shmseg:          128 (max shared memory segments per process)
 shmall:         8192 (max amount of shared memory in pages)

Need to increase kern.ipc.shmall=2097152 which allows to allocate 8 Gbytes of shared memory for OS.
And increase kern.ipc.shmmax=134217728 which allows to use 128M for any cache related parameter in the Zabbix server configuration.
To make the configuration persistent, need to add these lines to the /etc/sysctl.conf:
 kern.ipc.shmall=2097152
 kern.ipc.shmmax=134217728
which means 2097152*4096=8 Gbytes and 128 Mbytes respectively
To apply changes in the /etc/sysctl.conf immediately, execute:
 # service sysctl restart

No comments:

Post a Comment