zabbix访问失败排查(磁盘空间不足防火墙有问题)

//发现磁盘空间不足
[root@zabbix ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   40G   40G   44K 100% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  9.8M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                397M  157M  240M  40% /boot
/dev/mapper/centos-home  152G   39M  152G   1% /home
tmpfs                    783M  4.0K  783M   1% /run/user/42
tmpfs                    783M  4.0K  783M   1% /run/user/0
//删除部分文件
[root@localhost ~]# scp  -r  /log/JXL9-307_2019_01_23*  www.wangdo.top:/root/jxl/
[root@localhost ~]# rm -rf   /log/JXL9-307_2019_01_23* 
[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   40G   40G   12M 100% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G  8.0K  3.9G   1% /dev/shm
tmpfs                    3.9G  9.4M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                397M  157M  240M  40% /boot
/dev/mapper/centos-home  152G   39M  152G   1% /home
tmpfs                    783M     0  783M   0% /run/user/990
tmpfs                    783M     0  783M   0% /run/user/0


//扩容根分区
[root@zabbix ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)


Command(m for help):  t
Pattition number (1-4):  3
Hex  code (type L to list  codes):   8e

Changed system tpye of  partition  3  to  83 (Linux  LVM)

Command  (m for  help):  w

[root@localhost ~]#  partprobe  
[root@localhost ~]#  reboot

//pvcreate  vgextend
[root@localhost ~]# pvcreate  /dev/sda3
[root@localhost ~]# vgextend centos /dev/sda3
  Volume group "centos" successfully extended

[root@localhost ~]# vgdisplay 
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               399.60 GiB
  PE Size               4.00 MiB
  Total PE              102298
  Alloc PE / Size       51099 / <199.61 GiB
  Free  PE / Size       51199 / <200.00 GiB    //剩余空间
  VG UUID               X03R2H-glbG-Ye47-6dKV-rIPz-fbYj-ybWIjl


[root@localhost ~]# ls /dev/mapper/
centos-home  centos-root  centos-swap  control
[root@localhost ~]# lvs
  LV   VG     Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home centos -wi-ao---- <151.61g                                                    
  root centos -wi-ao----   40.00g                                                    
  swap centos -wi-ao----    8.00g

//lvextend                                                    
[root@localhost ~]# lvextend -L +190G /dev/mapper/centos-root
  Size of logical volume centos/root changed from 40.00 GiB (10240 extents) to 230.00 GiB (58880 extents).
  Logical volume centos/root successfully resized.
[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   40G   40G   12M 100% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G  8.0K  3.9G   1% /dev/shm
tmpfs                    3.9G  9.3M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                397M  157M  240M  40% /boot
/dev/mapper/centos-home  152G   39M  152G   1% /home
tmpfs                    783M     0  783M   0% /run/user/0
[root@localhost ~]# blkid
/dev/sda1: UUID="d70b8c7e-2e0c-450a-8a3a-5e37d1db0d36" TYPE="xfs" 
/dev/sda2: UUID="bfkdUe-XIUn-XrVk-7t4h-XSB6-fzmt-HDE8en" TYPE="LVM2_member" 
/dev/sda3: UUID="yYZOv7-AsdU-Ycvx-fSyW-rJ4k-EmOC-zqze5N" TYPE="LVM2_member" 
/dev/sr0: UUID="2018-05-03-20-55-23-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" 
/dev/mapper/centos-root: UUID="f779ac0a-f3a9-494b-bc7b-1d90b5afc313" TYPE="xfs" 
/dev/mapper/centos-swap: UUID="95738d81-e5b8-4bd2-8795-4e401dbab70c" TYPE="swap" 
/dev/mapper/centos-home: UUID="2fb37ccb-5a9c-4b64-ae37-f372528ab613" TYPE="xfs" 

//格式化文件系统 
[root@localhost ~]# xfs_growfs /dev/mapper/centos-root 
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=2621440 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=10485760, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=5120, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 10485760 to 60293120

//完成根分区扩容 
[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  230G   40G  191G  18% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G  8.0K  3.9G   1% /dev/shm
tmpfs                    3.9G  9.3M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                397M  157M  240M  40% /boot
/dev/mapper/centos-home  152G   39M  152G   1% /home
tmpfs                    783M     0  783M   0% /run/user/0

//还原删除的文件
[root@localhost ~]# scp -r www.wangdo.top:/root/jxl/*   /log/

[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl start httpd


[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
INPUT_direct  all  --  anywhere             anywhere            
INPUT_ZONES_SOURCE  all  --  anywhere             anywhere            
INPUT_ZONES  all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere             ctstate INVALID
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             bogon/24             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  bogon/24             anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
FORWARD_direct  all  --  anywhere             anywhere            
FORWARD_IN_ZONES_SOURCE  all  --  anywhere             anywhere            
FORWARD_IN_ZONES  all  --  anywhere             anywhere            
FORWARD_OUT_ZONES_SOURCE  all  --  anywhere             anywhere            
FORWARD_OUT_ZONES  all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere             ctstate INVALID
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
OUTPUT_direct  all  --  anywhere             anywhere            

Chain FORWARD_IN_ZONES (1 references)
target     prot opt source               destination         
FWDI_public  all  --  anywhere             anywhere            [goto] 
FWDI_public  all  --  anywhere             anywhere            [goto] 

Chain FORWARD_IN_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain FORWARD_OUT_ZONES (1 references)
target     prot opt source               destination         
FWDO_public  all  --  anywhere             anywhere            [goto] 
FWDO_public  all  --  anywhere             anywhere            [goto] 

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain FORWARD_direct (1 references)
target     prot opt source               destination         

Chain FWDI_public (2 references)
target     prot opt source               destination         
FWDI_public_log  all  --  anywhere             anywhere            
FWDI_public_deny  all  --  anywhere             anywhere            
FWDI_public_allow  all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            

Chain FWDI_public_allow (1 references)
target     prot opt source               destination         

Chain FWDI_public_deny (1 references)
target     prot opt source               destination         

Chain FWDI_public_log (1 references)
target     prot opt source               destination         

Chain FWDO_public (2 references)
target     prot opt source               destination         
FWDO_public_log  all  --  anywhere             anywhere            
FWDO_public_deny  all  --  anywhere             anywhere            
FWDO_public_allow  all  --  anywhere             anywhere            

Chain FWDO_public_allow (1 references)
target     prot opt source               destination         

Chain FWDO_public_deny (1 references)
target     prot opt source               destination         

Chain FWDO_public_log (1 references)
target     prot opt source               destination         

Chain INPUT_ZONES (1 references)
target     prot opt source               destination         
IN_public  all  --  anywhere             anywhere            [goto] 
IN_public  all  --  anywhere             anywhere            [goto] 

Chain INPUT_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain INPUT_direct (1 references)
target     prot opt source               destination         

Chain IN_public (2 references)
target     prot opt source               destination         
IN_public_log  all  --  anywhere             anywhere            
IN_public_deny  all  --  anywhere             anywhere            
IN_public_allow  all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            

Chain IN_public_allow (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh ctstate NEW

Chain IN_public_deny (1 references)
target     prot opt source               destination         

Chain IN_public_log (1 references)
target     prot opt source               destination         

Chain OUTPUT_direct (1 references)
target     prot opt source               destination

//设置mariadb httpd 开机自启
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
//临时关闭iptables
[root@zabbix ~]# iptables -L -n --line-number
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
3    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:67
5    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
6    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
7    INPUT_direct  all  --  0.0.0.0/0            0.0.0.0/0           
8    INPUT_ZONES_SOURCE  all  --  0.0.0.0/0            0.0.0.0/0           
9    INPUT_ZONES  all  --  0.0.0.0/0            0.0.0.0/0           
10   DROP       all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID
11   REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

//delete   INPUT  REJECT
[root@localhost ~]# iptables -D INPUT   11

 1002  systemctl unmask firewalld
 1003  systemctl start firewalld.service

[root@zabbix ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent 
success


//查询相关服务
[root@localhost ~]# ss -tunlp | grep mysqld
tcp    LISTEN     0      50        *:3306                  *:*                   users:(("mysqld",pid=2722,fd=13))
 

猜你喜欢

转载自blog.csdn.net/weixin_40018205/article/details/87717628