收到zabbix报警Lack of free swap space on zabbix_server
1.查看内存状态
[[email protected] ~]# free -m
total used free shared buffers cached
Mem: 488 450 37 6 6 46
-/+ buffers/cache: 397 91
Swap: 0 0 0
free的输出一共有四行,第四行为交换区的信息:交换的总量(total),使用量(used)和交换区(free)
2.查看磁盘分区状况
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 20G 3.8G 15G 21% /
devtmpfs 237M 0 237M 0% /dev
tmpfs 245M 0 245M 0% /dev/shm
tmpfs 245M 4.3M 241M 2% /run
tmpfs 245M 0 245M 0% /sys/fs/cgroup
3.创建swap文件
[[email protected] ~]# dd if=/dev/zero of=/home/swap bs=1024 count=512000
512000+0 records in
512000+0 records out
524288000 bytes (524 MB) copied, 10.8309 s, 48.4 MB/s
4.创建swap分区
[[email protected] ~]# mkswap /home/swap
Setting up swapspace version 1, size = 511996 KiB
no label, UUID=6ff030ce-898d-4245-b6d5-ee1580c26929
[[email protected] fonts]# /sbin/swapon /home/swap
swapon: /home/swap: insecure permissions 0644, 0600 suggested.
5.查看free
[[email protected] ~]# free -m
total used free shared buffers cached
Mem: 488 478 10 6 1 78
-/+ buffers/cache: 398 90
Swap: 499 0 499
6.挂载
[[email protected] ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Nov 21 18:16:53 2014
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=6634633e-001d-43ba-8fab-202f1df93339 / ext4 defaults,barrier=0 1 1
UUID=6ff030ce-898d-4245-b6d5-ee1580c26929 swap swap defaults 0 0
~
"/etc/fstab" 10L, 356C written