标签:swap空间不足 linux添加swap zabbix swap报警
收到zabbix报警Lack of free swap space on zabbix_server
1.查看内存状态
[root@chlook ~]# 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.查看磁盘分区状况
[root@chlook ~]# 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文件
[root@chlook ~]# 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分区
[root@chlook ~]# mkswap /home/swap
Setting up swapspace version 1, size = 511996 KiB
no label, UUID=6ff030ce-898d-4245-b6d5-ee1580c26929
[root@chlook fonts]# /sbin/swapon /home/swap
swapon: /home/swap: insecure permissions 0644, 0600 suggested.
5.查看free
[root@chlook ~]# free -m
total used free shared buffers cached
Mem: 488 478 10 6 1 78
-/+ buffers/cache: 398 90
Swap: 499 0 499
6.挂载
[root@chlook ~]# 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
本文出自 “工作经验” 博客,请务必保留此出处http://chlipeng.blog.51cto.com/8928892/1696173
zabbix Lack of free swap 报警 LINUX在线添加swap分区
标签:swap空间不足 linux添加swap zabbix swap报警
原文地址:http://chlipeng.blog.51cto.com/8928892/1696173