zabbix报错之swap空间不足(创建、优化swap交换分区)
浏览量:1092
错误:It probably means that the systems requires more physical memory.

解决:
1.查看swap分区
[root@YoungCheung ~]# free -m total used free shared buff/cache available Mem: 1838 981 64 0 792 707 Swap: 0 0 0
发现swap分区可用为0
1.创建交换分区
[root@YoungCheung ~]# mkdir /swap [root@YoungCheung ~]# cd /swap/ [root@YoungCheung swap]# dd if=/dev/zero of=swapfile bs=1M count=4k 4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB) copied, 102.567 s, 41.9 MB/s [root@YoungCheung swap]# mkswap swapfile Setting up swapspace version 1, size = 4194300 KiB no label, UUID=2c91c727-31c3-423d-8436-ab9ba406de2f [root@YoungCheung swap]# swapon swapfile swapon: /swap/swapfile: insecure permissions 0644, 0600 suggested. [root@YoungCheung swap]# free -m total used free shared buff/cache available Mem: 1838 986 75 0 776 703 Swap: 4095 0 4095
2.优化swap
说明:
在centos里面,swappiness的值的大小对如何使用swap分区是有着很大的联系的。
swappiness=0的时候表示最大限度使用物理内存,然后才是 swap空间,
swappiness=100的时候表示积极的使用swap分区,并且把内存上的数据及时的搬运到swap空间里面。
两个极端,对于ubuntu的默认设置,这个值等于60,建议修改为10。具体这样做
优化:
[root@YoungCheung swap]# cat /proc/sys/vm/swappiness 0 [root@YoungCheung swap]# sysctl vm.swappiness=10 vm.swappiness = 10 [root@YoungCheung swap]# cat /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 [root@YoungCheung swap]# cat /proc/sys/vm/swappiness 10
问题解决,那么我们来查看zabbix监控状态


神回复
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。