监控linux系统状态

  1. 监控linux系统状态
  2. 监控介绍
  3. 安装zabbix4.0
  4. 监控客户机
  5. 解决中文名称不能写数据库的问题
  6. 解决图形中乱码
  7. zabbix邮件告警
  8. zabbix监控Nginx
  9. zabbix监控Tomcat
  10. zabbix监控MySQL

1. 监控Linux系统状态

1. w

[root@wzy1 ~]# w
 08:14:42 up  2:30,  1 user,  load average: 0.00, 0.01, 0.04
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root         pts/0    192.168.31.1     05:46        2.00s  0.00s   0.00s     w

uptime: 与w命令类似,average后面的3个数值代表1分钟,5分钟15分钟CPU的负载值

[root@wzy1 /]# uptime
 08:23:02 up  2:38,  1 user,  load average: 0.00, 0.01, 0.04

2. top

1. 动态查看系统状态工具,默认每3秒刷新一次。可以按照列排序,同时也可以显示系统负载。按 ' q ' 退出

[root@wzy1 /]# top
top - 08:32:22 up  2:47,  1 user,  load average: 0.00, 0.01, 0.04
Tasks: 123 total,   1 running, 122 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1875744 total,  1389576 free,   247176 used,   238992 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.  1444868 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                     
    1 root      20   0  125132   3628   2388 S   0.0  0.2   0:01.72 systemd                                                     
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kthreadd    

top各项解释

  1. load average :
    a:当前时间;
    b:系统运行时间;
    c:当前登录用户数量;
    d:显示系统5,10,15分钟内平均负载。使用 ' l ' 命令切换隐藏
  2. Tasks :任务数,当前有1个运行进程,122进程在休眠,被终止的进程数为0,僵尸状态的进程数为0。
  3. %Cpu:cpu使用率。使用 ' t ' 显示和隐藏
    us(user用户级别的进程),
    sy(system系统级别的进程),
    ni(niced运行已调整优先级的用户进程的CPU时间)
    id(空闲CPU百分比)
  4. Mem:内存
  5. Swap:交换分区,avail前的数值代表实际可使用的物理内存,单位为kb,此处可用内存为1.4G
  • 排序参数: M 按照内存使用大小排序,默认按照%cpu(CPU使用率)
  • 显示CPU全部核数状态:数字1

2. 参数:-bn1,静态显示top结果,常用于shell脚本中引用数据

[root@wzy1 /]# top -bn1
top - 14:20:36 up  8:36,  1 user,  load average: 0.00, 0.01, 0.05
Tasks: 122 total,   1 running, 121 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1875744 total,  1389864 free,   246568 used,   239312 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.  1445388 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0  125132   3628   2388 S   0.0  0.2   0:02.06 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.04 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.03 ksoftirqd/0
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    7 root      rt   0       0      0      0 S   0.0  0.0   0:00.00 migration/0
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
    9 root      20   0       0      0      0 S   0.0  0.0   0:07.53 rcu_sched

查看cpu信息
cat /proc/cpuinfo
lscpu

[root@wzy1 /]# cat /proc/cpuinfo             # 含有几核cpu就会显示几段信息
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 142
model name  : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
stepping    : 10
microcode   : 0x96
cpu MHz     : 1799.291
cache size  : 6144 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm 3dnowprefetch arat fsgsbase smep
bogomips    : 3600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

[root@wzy1 /]# lscpu              # 信息量没有cpuinfo详细
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4                      # 4核
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    2
座:                 2
NUMA 节点:         1
厂商 ID:           GenuineIntel
CPU 系列:          6
型号:              142
型号名称:        Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
步进:              10
CPU MHz:             1799.291
BogoMIPS:            3600.00
超管理器厂商:  VMware
虚拟化类型:     完全
L1d 缓存:          32K
L1i 缓存:          32K
L2 缓存:           256K
L3 缓存:           6144K
NUMA 节点0 CPU:    0-3 

3. free内存使用情况

[root@wzy1 ~]# free
                    total            used           free           shared   buff/cache   available
Mem:        1875744      245768     1390180        8828      239796     1446160
Swap:       2097148           0          2097148

关注的项

  1. Mem:available 对应的值,反映的是实际的可使用的物理内存
  2. Swap: used对应值,如果不为0,可以断定物理内存不够用了。

1. 参数

[root@wzy1 ~]# free -h         # 带单位表示     
              total        used        free      shared  buff/cache   available
Mem:           1.8G        213M        1.4G        8.6M        201M        1.4G
Swap:          2.0G          0B        2.0G

[root@wzy1 ~]# free -m        # 不带单位显示,最小单位M
              total        used        free      shared  buff/cache   available
Mem:           1831         215        1414           8         201        1447
Swap:          2047           0        2047

available = free + buff/cache

  1. buffer :从CPU产生进入内存,然后写入磁盘去的数据
  2. cached:从磁盘读出来,临时存到内存供CPU读取的数据。

2. swap扩容

[root@wzy1 ~]# dd if=/dev/zero of=/bigfile bs=1M count=1000       # 使用/dev/zero(造零器)创建一个每块为1M(bs=1M)空间
记录了1000+0 的读入
记录了1000+0 的写出
1048576000字节(1.0 GB)已复制,7.63329 秒,137 MB/秒

[root@wzy1 ~]# du -sh /bigfile                                # 查看空间大小
1000M   /bigfile
[root@wzy1 ~]# mkswap /bigfile                             # 格式化为swap格式
正在设置交换空间版本 1,大小 = 1023996 KiB
无标签,UUID=57e0d973-8c26-454a-9809-9443fb3dc626

[root@wzy1 ~]# chmod 600 /bigfile                         # 授予600权限

[root@wzy1 ~]# swapon /bigfile                               # 扩充到swap中去

[root@wzy1 ~]# free                                                # 再次查看时,swap已经多了1G空间
              total        used        free      shared  buff/cache   available
Mem:        1875744      256664      333068        8828     1286012     1420948
Swap:       3121144           0     3121144

4. 磁盘查看命令

1. iostat

需要安装sysstat包

[root@wzy1 ~]# yum install -y sysstat

[root@wzy1 ~]# iostat
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年06月05日     _x86_64_    (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.04    0.00    0.00   99.96

Device:       tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               0.59         8.67        46.34     196359    1049586
sdc               0.02         0.14         0.00       3122          0
sdb               0.02         0.15         0.00       3404          1
dm-0              0.00         0.02         0.00        462          1

[root@wzy1 ~]# iostat -dx 1                # 每一秒显示一次磁盘使用情况
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年06月05日     _x86_64_    (4 CPU)

Device:         rrqm/s  wrqm/s   r/s       w/s       rkB/s  wkB/s  avgrq-sz  avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.02        0.33    0.24     8.33    44.53   185.48       0.00         4.13    0.49    9.07        0.35   0.02
sdc               0.00     0.00        0.02    0.00     0.13     0.00    13.63         0.00         0.11    0.11    0.00        0.09   0.00
sdb               0.00     0.00        0.02    0.00     0.14     0.00    14.19         0.00         0.16    0.16    1.00        0.12   0.00
dm-0            0.00     0.00        0.00    0.00     0.02     0.00    13.82         0.00         0.12    0.11    1.00        0.12   0.00

命令参数
-dx :显示磁盘使用情况,后面加数字,如果为1则每一秒显示一次,不停止。大于1秒则会自动停止
重点关注的时%util 值,表示磁盘使用率

2. iotop

动态显示磁盘读写状况,按q退出
默认按io使用率大小排序

[root@wzy1 ~]# yum install -y iotop              # 需要安装iotop包

[root@wzy1 ~]# iotop

Total DISK READ :   0.00 B/s | Total DISK WRITE :       0.00 B/s
Actual DISK READ:   0.00 B/s | Actual DISK WRITE:       0.00 B/s
  TID  PRIO  USER   DISK READ    DISK WRITE  SWAPIN     IO>        COMMAND                                                                       
  512   be/0     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [hci0]
    1     be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     systemd --switched-root --system --deserialize 21
    2     be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [kthreadd]
    3     be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [ksoftirqd/0]
    5     be/0     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [kworker/0:0H]
 2566  be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [kworker/u128:2]
    7     rt/4       root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [migration/0]
    8     be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [rcu_bh]
    9     be/4     root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [rcu_sched]
   10     rt/4      root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [watchdog/0]
   11     rt/4      root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [watchdog/1]
   12     rt/4      root        0.00 B/s          0.00 B/s        0.00 %      0.00 %     [migration/1]

5. 综合工具vmstat

1. vmstat参数

[root@wzy1 ~]# vmstat 1 10      # 每秒钟显示一次,显示10次

procs -----------memory----------      ---swap--    -----io----   -system--  ------cpu-----
 r  b   swpd   free     buff  cache       si   so         bi    bo     in   cs     us sy id wa st
 1  0      0 328956    892 1288568    0    0          2     9     17   24     0  0 100  0  0
 0  0      0 328956    892 1288568    0    0          0     1     73   97     0  0 100  0  0
 0  0      0 328956    892 1288568    0    0          0     0     59   90     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     64   95     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     63   96     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     69   93     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     59   92     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     54   85     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     62   98     0  0 100  0  0
 0  0      0 328924    892 1288568    0    0          0     0     70   93     0  0 100  0  0

重点关注 CPU下的wa 代表等待CPU的百分比

  1. procs: r (包括已经运行及排队的进程);b(被阻塞的进程)
  2. swap:si ;so (swap使用情况)
  3. io: bi ; bo (磁盘使用情况)
  4. CPU:id (100-id值可以得出使用率); wa (等待的进程)
    如果swapd 下值或者 swap下si,so值不为零,说明内存不够用了

6. 监控网卡流量(sar,nload)

1. sar

  • 包含在sysstat包中
[root@wzy1 ~]# sar -n DEV 1 10            # 常用
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年06月05日     _x86_64_    (4 CPU)

14时46分50秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
14时46分51秒        lo            0.00      0.00      0.00      0.00      0.00         0.00      0.00
14时46分51秒     ens33        1.00      0.00      0.30      0.00      0.00         0.00      0.00      # 只有一块网卡ens33   

14时46分51秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
14时46分52秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
14时46分52秒     ens33      2.00      1.00      0.36      0.40      0.00      0.00      0.00

14时46分52秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
14时46分53秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
14时46分53秒     ens33      2.00      1.00      0.36      0.40      0.00      0.00      0.00

需要关注的项: rxkB/s

  1. bit :比特(带宽单位); Byte:字节(速度传输单位)
  2. 8bit = 1Byte
  3. 100Mbit = 12.8MB/s

2. sar历史文件

sar历史文件路径在/var/log/sa/下。
使用sar -f /var/log/sa/sa日期 来访问历史内容
使用sar -n DEV -f /var/log/sa/sa29 访问具体的信息
记录信息长短取决于开机长短。文件名后面的数字代表日期

[root@wzy1 ~]# ls /var/log/sa/
sa04  sa05  sa29  sa30  sar29

[root@wzy1 ~]# sar -f /var/log/sa/sa29
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年05月29日     _x86_64_    (4 CPU)

16时11分20秒       LINUX RESTART

16时20分01秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
16时30分01秒     all      0.00      0.00      0.02      0.00      0.00     99.98
16时40分01秒     all      0.12      0.00      0.18      0.01      0.00     99.69
16时50分01秒     all      0.16      0.00      0.16      0.01      0.00     99.67
17时00分01秒     all      0.00      0.00      0.01      0.00      0.00     99.98
17时10分01秒     all      0.00      0.00      0.02      0.00      0.00     99.98
17时20分01秒     all      0.00      0.00      0.02      0.01      0.00     99.9

[root@wzy1 ~]# sar -n DEV -f /var/log/sa/sa29            # 可以只查看网卡监控信息

Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年05月29日     _x86_64_    (4 CPU)

23时20分01秒     ens33      0.01      0.00      0.00      0.00      0.00      0.00      0.00
23时30分01秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
23时30分01秒     ens33      0.02      0.00      0.00      0.00      0.00      0.00      0.00
23时40分01秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
23时40分01秒     ens33      0.01      0.00      0.00      0.00      0.00      0.00      0.00

23时40分01秒     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
23时50分01秒        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
23时50分01秒     ens33      0.02      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
平均时间:     ens33      0.95      0.42      1.19      0.04      0.00      0.00      0.00

3. 其他参数

[root@wzy1 ~]# sar -b             # 磁盘读写
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年06月05日     _x86_64_    (4 CPU)

06时04分38秒       LINUX RESTART

06时10分01秒       tps      rtps      wtps   bread/s   bwrtn/s
06时20分01秒      0.04      0.00      0.04      0.00      0.53
06时30分01秒      0.06      0.00      0.06      0.05      0.64
06时40分01秒      0.04      0.00      0.04      0.00      0.40
06时50分01秒      0.06      0.00      0.05      0.12      0.65

[root@wzy1 ~]# sar -q               # 历史系统负载
Linux 3.10.0-514.el7.x86_64 (wzy1)  2019年06月05日     _x86_64_    (4 CPU)

06时04分38秒       LINUX RESTART

06时10分01秒   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
06时20分01秒         0       168      0.00      0.01      0.01         0
06时30分01秒         0       167      0.00      0.01      0.01         0
06时40分01秒         0       167      0.00      0.01      0.01         0

4. nload : 动态显示网卡流量

-包含在epel-release包(扩展包)中

[root@wzy1 ~]#  yum install -y epel-release
[root@wzy1 ~]#  yum install -y nload

Device ens33 [192.168.31.130] (1/2):          # 按方向键切换网卡
==================================
Incoming:

                                            Curr: 3.29 kBit/s
                                            Avg: 3.70 kBit/s
                                            Min: 3.28 kBit/s
                                            Max: 6.59 kBit/s
                                            Ttl: 12.51 MByte
Outgoing:

                                            Curr: 10.07 kBit/s
                                            Avg: 9.88 kBit/s
                                            Min: 4.27 kBit/s
                                            Max: 11.72 kBit/s
                                            Ttl: 1.27 MByte

5. ethtool,mii-tool

都是后接网卡名

[root@wzy1 ~]# ethtool ens33
Settings for ens33:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off (auto)
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes                          # 连接状态正常

[root@wzy1 ~]# mii-tool ens33
ens33: negotiated 1000baseT-FD flow-control, link ok     # 网卡连接状态正常

7. 查看进程PS

1. 命令参数

[root@wzy1 ~]# ps                    # 不加任何参数
  PID TTY          TIME CMD
 2314 pts/0    00:00:00 bash
 2517 pts/0    00:00:00 ps

[root@wzy1 ~]# ps aux             # 查看前后台系统进程
USER    PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1        0.0      0.1     190672  3652 ?        Ss       07:46   0:01    /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root         2        0.0      0.0          0     0 ?                S        07:46   0:00     [kthreadd]
root         3        0.0      0.0          0     0 ?                S        07:46   0:00     [ksoftirqd/0   ]
root         5        0.0      0.0          0     0 ?                S<       07:46   0:00     [kworker/0:0H]
root         7        0.0      0.0          0     0 ?                S        07:46   0:00      

[root@wzy1 ~]# ps -elf              # 同样可以查看后台进程
F S UID        PID  PPID  C PRI  NI   ADDR SZ      WCHAN  STIME TTY      TIME        CMD
4 S root         1     0         0  80   0       -     47668    ep_pol     07:46    ?        00:00:01    /usr/lib/systemd/systemd --switched-root --system --deserialize 21
1 S root         2     0         0  80   0       -         0        kthrea      07:46    ?        00:00:00    [kthreadd]
1 S root         3     2         0  80   0       -         0        smpboo   07:46    ?        00:00:00    [ksoftirqd/0]
1 S root         5     2         0  60 -20     -         0        worker      07:46    ?        00:00:00    [kworker/0:0H]
1 S root         7     2         0 -40   -       -         0        smpboo    07:46    ?        00:00:00    [migration/0]

[root@wzy1 ~]# ps -eLf              # 查看多线程
UID           PID  PPID   LWP C NLWP STIME TTY          TIME      CMD
php-fpm   1126  1100  1126  0    1       06:41       ?        00:00:00   php-fpm: pool bbs
php-fpm   1127  1100  1127  0    1       06:41       ?        00:00:00   php-fpm: pool bbs
php-fpm   1128  1100  1128  0    1       06:41       ?        00:00:00   php-fpm: pool blog
php-fpm   1129  1100  1129  0    1       06:41       ?        00:00:00   php-fpm: pool blog
php-fpm   1131  1100  1131  0    1       06:41       ?        00:00:00   php-fpm: pool www
php-fpm   1133  1100  1133  0    1       06:41       ?        00:00:00   php-fpm: pool www
mysql       1198   996  1198  0   30      06:41        ?        00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1424  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1801  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1902  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1904  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1905  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1906  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql
mysql       1198   996  1908  0   30      06:41        ?        00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql

ps aux列出的项

  1. user:用户
  2. PID:进程ID,通过查找进程ID发现哪些程序启动的
  3. %CPU,%MEM:CPU及内存使用率
  4. VSZ:虚拟内存使用率
  5. RSS:实际内存使用率
  6. TTY:登录的终端,状态都为0,说明都是在后台运行
  7. STAT:进程的状态
    S:sleep休眠状态
    R:running运行中的进程
    Ss:' s '代表父进程
    S< :' < ' 代表排队的优先级较高
    SN:' N ' 代表排队的优先级较低
    S< sl :' l ' 代表多线程进程
    R+:' + ' 代表前台进程
    Z:代表僵尸进程,父进程不存在,子进程无法管理,所占资源无法回收,只能通过重启服务器释放资源
    根据PID可以查找进程ID
    需要关注的项:%CPU , %MEM , RSS (top命令中的RES同为真是内存) , COMMAND
    ps aux 比 -elf用的多一点

2. 根据PID查看进程使用哪些命令

[root@wzy1 ~]# ls -l /proc/1104         # 查找进程ID为1104的进程使用哪些命令
总用量 0
dr-xr-xr-x 2 php-fpm php-fpm 0 6月   6 12:36 attr
-rw-r--r-- 1 root    root    0 6月   6 12:36 autogroup
-r-------- 1 root    root    0 6月   6 12:36 auxv
-r--r--r-- 1 root    root    0 6月   6 12:36 cgroup
--w------- 1 root    root    0 6月   6 12:36 clear_refs
-r--r--r-- 1 root    root    0 6月   6 10:30 cmdline
lrwxrwxrwx 1 root    root    0 6月   6 12:36 cwd -> /
-r-------- 1 root    root    0 6月   6 12:36 environ
lrwxrwxrwx 1 root    root    0 6月   6 12:36 exe -> /usr/local/php-fpm/sbin/php-fpm     # 使用php-fpm命令执行
dr-x------ 2 root    root    0 6月   6 12:36 fd
  • 只有使用ps -eLf 时才能查看线程

8. netstat查看网络连接状况

1. 命令参数

-lnp:显示全部状态
-lnutp:查看udp 和 tcp 网络状态
-lntp:只查看tcp协议网络状态
-an :系统所有的网络连接

[root@wzy1 ~]# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address    State       PID/Program name    
tcp        0               0          0.0.0.0:22              0.0.0.0:*               LISTEN      956/sshd            
tcp        0               0          127.0.0.1:25          0.0.0.0:*               LISTEN      1603/master         
tcp6      0               0          :::3306                   :::*                        LISTEN      1198/mysqld         
tcp6      0               0          :::22                       :::*                        LISTEN      956/sshd            
tcp6      0               0          ::1:25                     :::*                        LISTEN      1603/master         
raw6     0               0          :::58                       :::*                        7                 603/NetworkManager  
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     18878    1100/php-fpm: maste  /tmp/bbs.socket
unix  2      [ ACC ]     STREAM     LISTENING     14341    1/systemd            /run/lvm/lvmetad.socket
unix  2      [ ACC ]     STREAM     LISTENING     18880    1100/php-fpm: maste  /tmp/blog.socket

[root@wzy1 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address    State       PID/Program name    
tcp         0             0         0.0.0.0:22              0.0.0.0:*               LISTEN      956/sshd            
tcp         0             0         127.0.0.1:25          0.0.0.0:*               LISTEN      1603/master         
tcp6       0             0         :::3306                   :::*                        LISTEN      1198/mysqld         
tcp6       0             0         :::22                       :::*                        LISTEN      956/sshd            
tcp6       0             0         ::1:25                     :::*                        LISTEN      1603/master         

[root@wzy1 ~]# netstat -lnutp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address  State       PID/Program name    
tcp        0            0           0.0.0.0:22              0.0.0.0:*               LISTEN      956/sshd            
tcp        0            0           127.0.0.1:25          0.0.0.0:*               LISTEN      1603/master         
tcp6      0            0           :::3306                   :::*                        LISTEN      1198/mysqld         
tcp6      0            0           :::22                       :::*                        LISTEN      956/sshd            
tcp6      0            0           ::1:25                     :::*                        LISTEN      1603/master

[root@wzy1 ~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q  Local Address            Foreign Address         State      
tcp        0             0          0.0.0.0:22                 0.0.0.0:*                     LISTEN     
tcp        0             0         127.0.0.1:25              0.0.0.0:*                     LISTEN     
tcp        0            52        192.168.31.130:22  192.168.31.1:50935   ESTABLISHED
tcp6      0             0         :::3306                        :::*                            LISTEN     
tcp6      0             0         :::22                            :::*                            LISTEN     
tcp6      0             0         ::1:25                          :::*                            LISTEN     
raw6     0             0         :::58                            :::*                            7          
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     18878    /tmp/bbs.socket
unix  2      [ ACC ]     STREAM     LISTENING     14341    /run/lvm/lvmetad.socket
unix  2      [ ACC ]     STREAM     LISTENING     18880    /tmp/blog.socket

2. ss -an 查看网络连接状态

作用同netstat类似,产生结果的速度有时比netstat要快一些

[root@wzy1 ~]# ss -an
Netid      State      Recv-Q Send-Q         Local Address:Port                        Peer Address:Port              
nl          UNCONN     0        0                          0:0                                                *                   
nl          UNCONN     0        0                          0:-1451228581                             *                   
nl          UNCONN     0        0                          0:-1451228581                             * 
u_str     ESTAB         0        0      /var/run/dbus/system_bus_socket 14305         * 14304              
u_dgr    UNCONN     0        0                          * 14294                                         * 6621               
udp        UNCONN    0        0                         :::58                                                :::*                  
tcp         LISTEN       0        128                        *:22                                             *:*                  
tcp         LISTEN       0        100                127.0.0.1:25                                       *:*                  
tcp         ESTAB        0        816           192.168.31.130:22                          192.168.31.1:50935 

9. 抓包工具tcpdump

  • 目的根据网络异常尝试抓包分析问题

1. 安装tcpdump

[root@wzy1 ~]# yum install -y tcpdump

2. 抓包命令

tcpdump -nn -i ens33 -c 5 -w /tmp/1.cap
-nn参数直接将域名解析为IP地址,方便阅读

[root@wzy1 ~]# tcpdump -nn -i ens33 -c 5            # 经过ens33网卡只抓5个包
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
12:26:26.315585 IP 192.168.31.130.22 > 192.168.31.1.50935: Flags [P.], seq 835511267:835511479, ack 2805937221, win 297, length 212
12:26:26.315715 IP 192.168.31.1.50935 > 192.168.31.130.22: Flags [.], ack 212, win 4101, length 0
12:26:26.315881 IP 192.168.31.130.22 > 192.168.31.1.50935: Flags [P.], seq 212:504, ack 1, win 297, length 292
12:26:26.316345 IP 192.168.31.130.22 > 192.168.31.1.50935: Flags [P.], seq 504:668, ack 1, win 297, length 164
12:26:26.316418 IP 192.168.31.1.50935 > 192.168.31.130.22: Flags [.], ack 668, win 4106, length 0
5 packets captured
5 packets received by filter
0 packets dropped by kernel

3. 存储抓包及读取

tcpdump -nn -i ens33 -c 5 -w /tmp/1.cap
-w 后接路径代表抓包的内容同时写入到自定义路径下,方便查找

tcpdump -nn -r /tmp/1.cap
-r 后接存储文件即可以阅读包记录的内容

[root@wzy1 ~]# tcpdump -nn -i ens33 -c 5 -w /tmp/1.cap       # 存储抓取的包
tcpdump: listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
5 packets captured
5 packets received by filter
0 packets dropped by kernel

[root@wzy1 ~]# tcpdump -nn -r !$                           # 读取存储的数据包
tcpdump -nn -r /tmp/1.cap
reading from file /tmp/1.cap, link-type EN10MB (Ethernet)
12:37:52.411632 IP 192.168.31.130.22 > 192.168.31.1.50935: Flags [P.], seq 835514191:835514339, ack 2805939157, win 297, length 148
12:37:52.411765 IP 192.168.31.1.50935 > 192.168.31.130.22: Flags [.], ack 148, win 4102, length 0
12:37:52.654078 IP 192.168.31.1.137 > 192.168.31.255.137: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
12:37:53.292612 IP 192.168.31.1.54915 > 192.168.31.255.54915: UDP, length 263
12:37:54.289483 IP 192.168.31.1.54915 > 192.168.31.255.54915: UDP, length 263

4. 增加过滤条件

tcpdump -i ens33 -nn not port 22 and not port 80 and not host 192.168.222.1
增加了3个过滤条件
not port 22
not port 80
not host 192.168.222.1

5. 另一个分析工具tshark(命令行工具)

  • 需要安装wireshark包(此包图形工具)

tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"
执行此语句后,结果跟日志文件类似,方便阅读

[root@wzy1 ~]# yum install -y wireshark

[root@wzy1 ~]# tshark -nn -i ens33 -c 5
Running as user "root" and group "root". This could be dangerous.
Capturing on 'ens33'
  1 0.000000000 192.168.31.1 -> 192.168.31.130 TCP 60 50935 > 22 [ACK] Seq=1 Ack=1 Win=4104 Len=0
  2 0.422204387 192.168.31.1 -> 192.168.31.255 UDP 305 Source port: 54915  Destination port: 54915
  3 0.673716617 192.168.31.130 -> 192.168.31.1 SSH 314 Encrypted response packet len=260
  4 0.715382655 192.168.31.1 -> 192.168.31.130 TCP 60 50935 > 22 [ACK] Seq=1 Ack=261 Win=4103 Len=0
  5 1.218342849 192.168.31.130 -> 192.168.31.1 SSH 298 Encrypted response packet len=244
5 packets captured

[root@wzy1 ~]# tshark -i ens33 -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"

2. 监控介绍

监控的必要性:提前发现潜在故障隐患,第一时间解决,把影响降低

1. 常用监控软件

  1. cacti :早期图形化界面,较友好
  2. nagios:
  3. zabbix :通过浏览器访问配置
  4. open-falcon :小米出品,开源
  5. prometheus
  6. grafana 与prometheus经常一起用

3. 安装zabbix4.0

官网
https://www.zabbix.com/
中文产品手册
https://www.zabbix.com/documentation/4.0/zh/manual

1. 安装zabbix yum源

1. 下载rpm包

# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm      # 获取rpm包
获取http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.A7EwTl: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:zabbix-release-4.0-1.el7         ################################# [100%]

[root@wzy1 ~]# yum list | grep zabbix                       # 查看需要安装的rpm包

zabbix-agent.x86_64                     4.0.8-1.el7                    zabbix   
zabbix-get.x86_64                         4.0.8-1.el7                    zabbix   
zabbix-java-gateway.x86_64         4.0.8-1.el7                    zabbix   
zabbix-proxy-mysql.x86_64           4.0.8-1.el7                    zabbix   
zabbix-proxy-pgsql.x86_64            4.0.8-1.el7                    zabbix   
zabbix-proxy-sqlite3.x86_64          4.0.8-1.el7                    zabbix   
zabbix-sender.x86_64                    4.0.8-1.el7                    zabbix   
zabbix-server-mysql.x86_64          4.0.8-1.el7                    zabbix   
zabbix-server-pgsql.x86_64           4.0.8-1.el7                    zabbix   
zabbix-web.noarch                         4.0.8-1.el7                    zabbix   
zabbix-web-japanese.noarch         4.0.8-1.el7                    zabbix   
zabbix-web-mysql.noarch              4.0.8-1.el7                    zabbix   
zabbix-web-pgsql.noarch               4.0.8-1.el7                    zabbix   

2. 安装rpm包

需要安装的包:
zabbix-agent :客户端程序
zabbix-get :命令行工具
zabbix-server-mysql :
zabbix-web :web界面管理工具
zabbix-web-mysql :数据库

[root@wzy1 ~]# yum install zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql

zabbix需要在web浏览器中进行设置,需要httpd,php环境

2. 创建server端数据库

在单台机上既需要充当server端,也需要充当客户端

[root@wzy1 ~]# mysql -uroot -pmysqlpass     # 登录数据库
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.3.12-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix;      # 创建zabbix数据库
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| bbs                |
| blog               |
| information_schema |
| mysql              |
| performance_schema |
| test               |
| zabbix             |              # 创建成功
| zrlog              |
+--------------------+
8 rows in set (0.000 sec)

MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zabbixpass';
Query OK, 0 rows affected (0.001 sec)      # 创建并授权用户zabbix,密码zabbixpass

MariaDB [(none)]> quit
Bye

3. zabbix_server修改配置文件

根据创建数据库时设置的密码,以及本机运行server端修改配置文件
91行中:DBHost 修改为127.0.0.1
124行中: DBPassword修改为zabbixpass (创建数据库时创建的密码)

[root@wzy1 ~]# ls -lh /etc/zabbix/            # 查看zabbix目录下配置文件
总用量 32K
drwxr-x--- 2 apache apache  33 5月  29 16:48 web
-rw-r--r-- 1 root   root   11K 5月  28 17:28 zabbix_agentd.conf
drwxr-xr-x 2 root   root    38 5月  29 16:48 zabbix_agentd.d
-rw-r----- 1 root   zabbix 17K 5月  28 17:28 zabbix_server.conf
[root@wzy1 ~]# vi /etc/zabbix/zabbix_server.conf         # 编辑server配置文件

     84 ### Option: DBHost
     85 #       Database host name.
     86 #       If set to localhost, socket is used for MySQL.
     87 #       If set to empty string, socket is used for PostgreSQL.
     88 #
     89 # Mandatory: no
     90 # Default:
     91 DBHost=127.0.0.1                   # 修改DBHost为127.0.0.1

        118 ### Option: DBPassword
    119 #       Database password.
    120 #       Comment this line if no password is used.
    121 #
    122 # Mandatory: no
    123 # Default:
    124 DBPassword=zabbixpass       # 修改密码为zabbixpass

4. 启动zabbix-server服务

zabbix-server 日志文件路径为/var/log/zabbix/zabbix_server.log
使用cat命令访问日志文件

[root@wzy1 ~]# systemctl start zabbix-server
[root@wzy1 ~]# systemctl enable zabbix-server            # 使zabbix-server随系统启动而启动
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.

[root@wzy1 ~]# cat /var/log/zabbix/zabbix_server.log    # 查询日志文件,此时数据库没有正确导入,最后一行有提示
  3158:20190612:102000.111 Starting Zabbix Server. Zabbix 4.0.8 (revision 2b50c941de).
  3158:20190612:102000.111 ****** Enabled features ******
  3158:20190612:102000.111 SNMP monitoring:           YES
  3158:20190612:102000.111 IPMI monitoring:           YES
  3158:20190612:102000.111 Web monitoring:            YES
  3158:20190612:102000.111 VMware monitoring:         YES
  3158:20190612:102000.111 SMTP authentication:       YES
  3158:20190612:102000.111 Jabber notifications:      YES
  3158:20190612:102000.111 Ez Texting notifications:  YES
  3158:20190612:102000.111 ODBC:                      YES
  3158:20190612:102000.111 SSH2 support:              YES
  3158:20190612:102000.111 IPv6 support:              YES
  3158:20190612:102000.111 TLS support:               YES
  3158:20190612:102000.111 ******************************
  3158:20190612:102000.111 using configuration file: /etc/zabbix/zabbix_server.conf
  3158:20190612:102000.114 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]
  3158:20190612:102000.114 cannot use database "zabbix": database is not a Zabbix database

5. 向数据库zabbix导入表create.sql

需要导入的表位置:
/usr/share/doc/zabbix-server-mysql-4.0.8/create.sql.gz

[root@wzy1 ~]# ls -lh /usr/share/doc/zabbix-server-mysql-4.0.8/
总用量 2.3M
-rw-r--r-- 1 root root   98 5月  28 17:22 AUTHORS
-rw-r--r-- 1 root root 943K 5月  28 17:22 ChangeLog
-rw-r--r-- 1 root root  18K 5月  28 17:22 COPYING
-rw-r--r-- 1 root root 1.3M 5月  28 17:27 create.sql.gz    # 需要导入的表
-rw-r--r-- 1 root root   52 5月  28 17:22 NEWS
-rw-r--r-- 1 root root 1.3K 5月  28 17:22 README

[root@wzy1 ~]# gzip -d /usr/share/doc/zabbix-server-mysql-4.0.8/create.sql.gz        # 解压create.sql.gz压缩包

[root@wzy1 ~]# mysql -uroot -pmysqlpass zabbix < /usr/share/doc/zabbix-server-mysql-4.0.8/create.sql      # 向数据库zabbix导入表

[root@wzy1 ~]# ps aux |grep zabbix               # 此时zabbix-server服务已经启动
zabbix    3962  0.7  0.2 259304  4284 ?        S    10:38   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
zabbix    3964  0.0  0.1 259304  2516 ?        S    10:38   0:00 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]
zabbix    3965  0.0  0.1 259304  2516 ?        S    10:38   0:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
zabbix    3966  0.0  0.1 259304  2852 ?        S    10:38   0:00 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.002458 sec, idle 59 sec]
zabbix    3967  0.0  0.1 259304  2856 ?        S    10:38   0:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000524 sec, idle 5 sec]
zabbix    3968  0.2  0.2 363664  5212 ?        S    10:38   0:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.007483 sec, idle 60 sec]

[root@wzy1 ~]# netstat -lntp       # zabbix_server服务监听端口为10051
Active Internet connections (only servers)
Proto Recv-Q Send-Q    Local Address        Foreign Address   State         PID/Program name    
tcp        0            0             0.0.0.0:80            0.0.0.0:*               LISTEN      2397/nginx: master  
tcp        0            0             0.0.0.0:22            0.0.0.0:*               LISTEN      952/sshd            
tcp        0            0             127.0.0.1:25        0.0.0.0:*               LISTEN      1539/master         
tcp        0            0             0.0.0.0:10051      0.0.0.0:*               LISTEN      3962/zabbix_server   # 监听端口为10051
tcp6      0            0             :::3306                 :::*                        LISTEN      1245/mysqld         
tcp6      0            0             :::22                     :::*                        LISTEN      952/sshd            
tcp6      0            0             ::1:25                   :::*                        LISTEN      1539/master         
tcp6      0            0             :::10051               :::*                        LISTEN      3962/zabbix_server 

6. 启动zabbix_agent服务

1. 修改配置文件zabbix_agentd.conf

[root@wzy1 ~]# vi /etc/zabbix/zabbix_agentd.conf

### Option: Server
#       Incoming connections will be accepted only from the hosts listed here.
#       If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
#       and '::/0' will allow any IPv4 or IPv6 address.
#       '0.0.0.0/0' can be used to allow any IPv4 address.
#       Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=

Server=127.0.0.1         # ip都要指向服务器ip  ,指定来取数据的serverIP地址

### Option: ServerActive
#       List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies for active checks.
#       If port is not specified, default port is used.
#       IPv6 addresses must be enclosed in square brackets if port for that host is specified.
#       If port is not specified, square brackets for IPv6 addresses are optional.
#       If this parameter is not specified, active checks are disabled.
#       Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=
ServerActive=127.0.0.1     # 激活的服务ip需要指向服务器ip,即本机ip

2. 启动zabbix_agent服务

[root@wzy1 ~]# systemctl start zabbix-agent

[root@wzy1 ~]# ps aux | grep zabbix_agent
zabbix    4092  0.0  0.0  80968  1296 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix    4093  0.0  0.0  80968  1448 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix    4094  0.0  0.0  80968  1852 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix    4095  0.0  0.0  80968  1852 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix    4096  0.0  0.0  80968  1852 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix    4097  0.0  0.1  81100  2140 ?        S    11:29   0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root      4101  0.0  0.0 112668   976 pts/1    R+   11:29   0:00 grep --color=auto zabbix_agent

7.停止nginx服务,启动httpd服务

如果不能停止nginx服务,需要更改httpd端口为8080,或者再nginx中设置代理httpd

[root@wzy1 ~]# systemctl stop nginx  
[root@wzy1 ~]# systemctl start httpd
[root@wzy1 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      952/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1539/master         
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      4092/zabbix_agentd  
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      3962/zabbix_server  
tcp6       0      0 :::3306                 :::*                    LISTEN      1245/mysqld         
tcp6       0      0 :::80                   :::*                    LISTEN      4133/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      952/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1539/master         
tcp6       0      0 :::10050                :::*                    LISTEN      4092/zabbix_agentd  
tcp6       0      0 :::10051                :::*                    LISTEN      3962/zabbix_server

zabbix_agentd 监听的端口是10050
zabbix_server监听端口是10051

8. web访问zabbix

通过IE浏览器访问192.168.31.130/zabbix进入UI安装界面

监控linux系统状态

监控linux系统状态

1. 设置time zone

[root@wzy1 ~]# vi /etc/php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Shanghai         # 添加时区

2. 重启httpd

[root@wzy1 ~]# systemctl restart httpd

监控linux系统状态

3. 授予写入权限

在ui配置界面时,提示/usr/share/zabbix/assets文件需要写入权限

[root@wzy1 ~]# ls -lh /usr/share/zabbix/
总用量 1.1M

drwxr-xr-x  5 zabbix root   44 5月  29 16:48 assets    # 默认不可写

[root@wzy1 ~]# chmod 777 /usr/share/zabbix/assets    # 权限全部放开

4. 完成web页面配置

zabbix 后台默认用户名和密码分别为 admin zabbix,后期需要更改
修改密码可以通过管理-用户-选择需要修改的用户-输入两次密码完成修改

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态


4. 监控客户机

1. 添加主机

  1. 服务器端搭建起来以后需要添加客户机进行检测和管理
  2. 打开另一个虚拟机,安装客户端
  3. 在服务器中添加新客户机,达到检测的目的

1. 客户机安装zabbix客户端

[root@wzy2 ~]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
获取http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.1QUgJ5: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:zabbix-release-4.0-1.el7         ################################# [100%]

[root@wzy2 ~]# yum install -y zabbix-agent     # 安装zabbix-agent客户端

2. 修改zabbix-agentd配置文件

  • 修改两处IP地址,使客户机能够指向服务器
[root@wzy2 ~]# vi /etc/zabbix/zabbix_agentd.conf       # 修改配置文件

### Option: Server
#       List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
#       Incoming connections will be accepted only from the hosts listed here.
#       If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
#       and '::/0' will allow any IPv4 or IPv6 address.
#       '0.0.0.0/0' can be used to allow any IPv4 address.
#       Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=

Server=192.168.31.130              # 修改为服务器IP

##### Active checks related

### Option: ServerActive
#       List of comma delimited IP:port (or DNS name:port) pairs of Zabbix servers and Zabbix proxies for active checks.
#       If port is not specified, default port is used.
#       IPv6 addresses must be enclosed in square brackets if port for that host is specified.
#       If port is not specified, square brackets for IPv6 addresses are optional.
#       If this parameter is not specified, active checks are disabled.
#       Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=

ServerActive=192.168.31.130         # 修改为服务器IP

3. 启动zabbix-agent服务

[root@wzy2 ~]# systemctl start zabbix-agent
Job for zabbix-agent.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-agent.service" and "journalctl -xe" for details

发生报错,查看启动日志文件

  1. 原因是防火墙阻止引起
  2. 关闭防火墙即可
[root@wzy2 ~]# cat /var/log/zabbix/zabbix_agentd.log        # 查看日志信息
  2514:20190613:092926.587 Starting Zabbix Agent [Zabbix server]. Zabbix 4.0.9 (revision 97a69d5d5a).
  2514:20190613:092926.587 **** Enabled features ****
  2514:20190613:092926.587 IPv6 support:          YES
  2514:20190613:092926.587 TLS support:           YES
  2514:20190613:092926.587 **************************
  2514:20190613:092926.587 using configuration file: /etc/zabbix/zabbix_agentd.conf
  2514:20190613:092926.587 cannot set resource limit: [13] Permission denied
  2514:20190613:092926.587 cannot disable core dump, exiting...

[root@wzy2 ~]# getenforce                    # 查看防火墙状态
Enforcing
[root@wzy2 ~]# setenforce 0                 # 关闭防火墙

[root@wzy2 ~]# systemctl start zabbix-agent         # 启动zabbix-agent服务

[root@wzy2 ~]# ps aux | grep zabbix      # 服务已经启动
zabbix    2694  0.0  0.0  80864  1284 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix    2695  0.0  0.0  80864  1588 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix    2696  0.0  0.1  80864  2036 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix    2697  0.0  0.1  80864  2068 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix    2698  0.0  0.1  80864  2064 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix    2699  0.0  0.1  80996  2224 ?        S    09:34   0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root      2714  0.0  0.0 112664   972 pts/1    S+   09:47   0:00 grep --color=auto zabbix

[root@wzy2 ~]# netstat -lntp                # 查看监听该端口为10050
Active Internet connections (only servers)
Proto Recv-Q  Send-Q     Local Address      Foreign Address    State         PID/Program name    
tcp        0           0             0.0.0.0:22             0.0.0.0:*                LISTEN      968/sshd            
tcp        0           0             127.0.0.1:25         0.0.0.0:*                LISTEN      1527/master         
tcp        0           0             0.0.0.0:10050       0.0.0.0:*                LISTEN      2694/zabbix_agentd  
tcp6      0           0             :::22                      :::*                         LISTEN      968/sshd            
tcp6      0           0             ::1:25                    :::*                         LISTEN      1527/master         
tcp6      0           0             :::10050                :::*                         LISTEN      2694/zabbix_agentd

4. 将10050端口加入到防火墙的白名单中

将服务器地址192.168.31.130加入到防火墙白名单,使客户机端口10050和服务器端口10051可以进行通信
如果不添加防火墙放开端口,客户机无法被zabbix连接,服务器端显示客户机状态为红色,即无法连接(no route)

[root@wzy2 ~]# iptables -I INPUT -s 192.168.31.130 -j ACCEPT

[root@wzy2 ~]# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      *       192.168.31.130       0.0.0.0/0          # 策略已经添加成功
  626 45127 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
 1894  540K INPUT_direct  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 1894  540K INPUT_ZONES_SOURCE  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 1894  540K INPUT_ZONES  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID
 1893  540K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

5. 服务器端防火墙放开客户机ip访问

服务器端需要防火墙允许客户机192.168.31.131的访问
或者关闭防火墙: ' systemctl stop friewalld '

[root@wzy1 ~]# iptables -I INPUT -s 192.168.31.131 -j ACCEPT

[root@wzy1 ~]# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts       bytes       target                                   prot opt      in     out          source               destination         
    0         0             ACCEPT                               all    --          *      *       192.168.31.131       0.0.0.0/0           
1062K     194M     ACCEPT                               all    --          *      *       0.0.0.0/0                  0.0.0.0/0            ctstate RELATED,ESTABLISHED
19769    1186K     ACCEPT                               all    --          lo     *       0.0.0.0/0                  0.0.0.0/0           
35269    9399K     INPUT_direct                       all     --          *      *       0.0.0.0/0                  0.0.0.0/0           
35269    9399K     INPUT_ZONES_SOURCE  all     --          *      *       0.0.0.0/0                  0.0.0.0/0           
35269    9399K     INPUT_ZONES                    all    --          *      *       0.0.0.0/0                  0.0.0.0/0           
   14      560          DROP                                   all     --         *      *       0.0.0.0/0                   0.0.0.0/0            ctstate INVALID
32497   9255K REJECT                                    all     --         *      *       0.0.0.0/0                   0.0.0.0/0            reject-with icmp-host-prohibited

2. 服务器端添加客户主机

通过服务器端访问web页面的zabbix

  1. 新建客户机host,新建的模板或者客户机是没有监控项的,需要去模板组中使用已经设置好的监控项。

监控linux系统状态

监控linux系统状态

  1. 通过选择模板中已存在的监控项items

监控linux系统状态
监控linux系统状态

  1. 可以选择复制到模板或者客户机中

监控linux系统状态
监控linux系统状态
监控linux系统状态

  1. 添加后可以在自定义模板或者客户机中看到item项已经存在。

监控linux系统状态
监控linux系统状态

3. 管理模板

1. 克隆模板

  1. 使用克隆clone功能将已存在的模板生成一个副本,成为自定义的模板,根据需求只需要修改此模板中的监控项即可
  2. 比如Discovery 里的项就是不可复制的,但是通过克隆就可以直接获取里面的监控项
  3. 克隆模板的时候需要先克隆再保存,然后取消此模板的链接模板,直接取消链接模板会造成克隆后的模板无法完成保存
  • 使用克隆选项clone模板

监控linux系统状态

  • 完成克隆后,根据需求删除不需要的监控项,以免浪费系统资源

监控linux系统状态

  • 当设置好自定义的克隆模板后,将客户机链接到自定义的模板。开始监控

监控linux系统状态

  • 每个监控项目都有监控间隔,都有默认值,如果间隔时间过长可以通过立即更新(check now)强制生成监控结果

监控linux系统状态

监控linux系统状态

2. 使用命令行确定链接状态

[root@wzy1 ~]# zabbix_get --h        # 使用--h来获取帮助信息

[root@wzy1 ~]# zabbix_get -s 192.168.31.131 -k vm.memory.size[total]
1920761856
[root@wzy1 ~]# zabbix_get -s 192.168.31.131 -k agent.version
4.0.9
[root@wzy1 ~]# zabbix_get -s 192.168.31.131 -k system.cpu.load[percpu,avg1]
0.000000
[root@wzy1 ~]# zabbix_get -s 192.168.31.131 -k vfs.fs.size[/boot,pfree]
44.689641

格式说明: zabbix_get -s 192.168.31.131 -k agent.version

  1. -s :后跟目标ip地址
  2. -k:后跟item 的key值 就是监控项的关键字

上例中依次查询了

  1. testtemplate: Total memory
  2. testtemplate: Version of zabbix_agent(d) running
  3. testtemplate: Processor load (1 min average per core)
  4. Mounted filesystem discovery: Free disk space on /boot (percentage)
  • key值可以通过如下图方式找到

监控linux系统状态

3. Discovery

  1. Monitoring中的Discovery指的是局域网中发现新的host主机,会自动加入到监控服务器中
  2. 自动加入监控服务器的主机有一个必要条件,就是这些host主机需要安装zabbix-agent服务并启动。

4. 监控客户机-管理图形和窗口

1. Monitoring

  1. Dashboard :仪表盘
  2. Problem:问题
  3. Overview:概览
  4. Web:网页
  5. Latest data:最新数据
  6. Graphs:图形
  7. Screens:聚合图形
  8. Maps:地图
  9. Discovery:自动发现
  10. Services:服务
  1. 其中可以在Dashboard中添加自定义显示的数据

监控linux系统状态

  1. 可以单独添加graphs单独一个图形,也可以添加screan聚合图形(多个图形),可以新建screan,分配好图形后,点击右上角收藏按钮(星星图标),然后在仪表盘中添加Favorite screan即可在仪表盘中显示出来(不显示图形,而只是超链接)

监控linux系统状态

5. 监控客户机-配置触发器

触发器可以使用模板中默认的,也可以自定义创建

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

  • 触发器表达式的中默认单位为byte,10M就是10,000,000b

5. 解决中文名称不能写数据库的问题

  1. 在导入数据库表之前如果没有修改字符集,导入mysql库后,使用web管理zabbix就会出现一些自定义项的名称不能取中文并提示报错,这就是字符集(默认字符是latin1)导致的问题。
  2. 如果没有修改字符集导致无法保存数据库表,可以将表先导出,然后修改字符集为中文(utf8)就可以正常保存了。

监控linux系统状态

[root@wzy1 ~]# mysql -uroot -pmysqlpass zabbix       # 登录mysql直接访问zabbix库

MariaDB [zabbix]> show create table triggers\G     
CONSTRAINT `c_triggers_1` FOREIGN KEY (`templateid`) REFERENCES `triggers` (`triggerid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1         # 默认字符集是latin1,需要修改为utf8

1. 将之前导入mysql库的表导出

[root@wzy1 ~]# mysqldump -uroot -pmysqlpass --default-character-set=utf8 zabbix > zabbix.sql           # 导出数据库

2. 编辑导出的数据库zabbix.sql

[root@wzy1 ~]# vim !$
vim zabbix.sql

在一般模式下,使用命令将所有labin1替换为utf8,完成字符集的转换,命令如下
:1,$s/latin1/utf8/g

3. 导入修改后的数据库zabbix.sql

[root@wzy1 ~]# mysql -uroot -pmysqlpass --default-character-set=utf8 zabbix < zabbix.sql  
  • 导入后可以正常添加中文名称了

监控linux系统状态

  • 主机名是不可以修改为中文名

6. 解决图形中乱码

  1. 由于系统字体中不含有中文,回导致图像中的中文显示为方框,无法正常显示,这是由于系统字体不包含中文导致的
  2. 解决的方法是从windows中拷贝字体文件到linux中,然后才能正常显示出来
  • 图形中的中文字显示为方块

监控linux系统状态

1. 解决方法

1. 查看zabbix字体文件存放的路径

[root@wzy1 zabbix]# cd /usr/share/zabbix

[root@wzy1 zabbix]# find . -type f -name "*inc*"   # 查找文件名中包含inc的所有文件
./include/defines.inc.php       # 在结果中需要查找的文件

# 查看zabbix字体文件保存路径
[root@wzy1 zabbix]# vim ./include/defines.inc.php      # 进入标记模式下输入/font 查找font关键字

define('ZBX_FONTPATH',                          realpath('assets/fonts')); // where to search for font (GD > 2.0.18)
define('ZBX_GRAPH_FONT_NAME',           'graphfont'); // font file name
define('ZBX_GRAPH_LEGEND_HEIGHT',       120); // when graph height is less then this value, some legend will not show up

字体文件在assets/fonts中

2. 从C:\Windows\Fonts下拷贝需要的字体文件(simkai.ttf 楷体)

  1. 通过rz命令从windows系统拷贝进linux虚拟机中
  2. 移动到/usr/share/zabbix/assets/fonts/下

3. 两种修改字体的方法

  1. 通过修改配置文件的方法达到修改字体的目的
  2. 通过修改软连接的方式达到修改字体的目的
    以下是通过第二种方法,比较快捷
[root@wzy1 zabbix]# ls -lh assets/fonts/     
总用量 12M
lrwxrwxrwx 1 root root  33 6月  19 12:08 graphfont.ttf.bak -> /etc/alternatives/zabbix-web-font
-rw-r--r-- 1 root root 12M 8月   9 2018 simkai.ttf

[root@wzy1 fonts]# mv graphfont.ttf graphfont.ttf.bak     # 将grapfont.tff换名备份
[root@wzy1 fonts]# ln -s ./simkai.ttf graphfont.ttf             # 创建软连接
[root@wzy1 fonts]# ls -lh
总用量 12M
lrwxrwxrwx 1 root root  12 6月  25 10:57 graphfont.ttf -> ./simkai.ttf     
lrwxrwxrwx 1 root root  33 6月  19 12:08 graphfont.ttf.bak -> /etc/alternatives/zabbix-web-font
-rw-r--r-- 1 root root 12M 8月   9 2018 simkai.ttf
  • 完成修改后,图形上的中文字体已经可以正常显示了。

监控linux系统状态


7. zabbix邮件告警

1. 阿里云服务设置

推荐使用阿里云邮件推送服务

  1. 阿里云 -> 管理控制台 -> 产品与服务 -> 云通信 -> 邮件推送
  2. 立即开通 -> 发信域名 -> 新建域名 -> 点击配置
  3. dnspod -> TXT记录/MX记录/CNME
    4.验证
  4. 发信地址 -> 新建发信地址 -> 域名/账号/发信类型(触发) -> 设置smtp密码
  5. SMTP服务地址: smtpdm.aliyun.com , SMTP端口号 : 25/80/465(SSL机密),根据情况选择其中一个

2. 创建发邮件脚本

[root@wzy1 ~]# vi mail.py
# 以下为python脚本内容

#!/usr/bin/python
#coding:utf-8

import smtplib
from email.mime.text import MIMEText
import sys

mail_user = 'username'                # 申请的用户名
mail_pass = 'password'               #  设置的密码

def send_mail(to_list,subject,content);
    me = "zabbix 监控告警平台"+"<"+mail_user+">"
    msg = MIMEText(content, 'plain', 'utf-8')
    msg['Subject'] = subject
    msg['From'] = me
    msg['to'] = to_list

    try:
        s = smtplib.SMTP("smtpdm.aliyun.com", 25)             #  smtpdm.aliyun.com为网站上申请的服务器地址
        s.login(mail_user,mail_pass)
        s.sendmail(me,to_list,msg.as_string())
        s.close()
        return True
    except Exception,e:
        print str(e)
        return False

if __name__=="__main__":
    sed_mail(sys.argv[1], sys.argv[2], sys.argv[3])

---------------------------

[root@wzy1 ~]# chmod 755 mail.py           # 修改权限

[root@wzy1 ~]# ./mail.py abc@qq.com "测试邮件" “`”      # 如果配置成功,邮箱中会收到一封邮件,标题为测试邮件

3. 设置zabbix_server配置文件

1. 编辑配置zabbix_server.conf文件,查找alertscripts路径

[root@wzy1 ~]# vim /etc/zabbix/zabbix_server.conf 

### Option: AlertScriptsPath
#       Full path to location of custom alert scripts.
#       Default depends on compilation options.
#       To see the default path run command "zabbix_server --help".
#
# Mandatory: no
# Default:
# AlertScriptsPath=${datadir}/zabbix/alertscripts

AlertScriptsPath=/usr/lib/zabbix/alertscripts      # 通过查找关键字Alert找到alertscripts路径

2. 移动my.py到alertscripts路径下

目的是通过web的ui界面可以调用这个python文件(mail.py)

[root@wzy1 ~]# mv mail.py /usr/lib/zabbix/alertscripts

[root@wzy1 ~]# ls /usr/lib/zabbix/alertscripts
mail.py

[root@wzy1 ~]# ls -lh /usr/lib/zabbix/alertscripts
总用量 4.0K
-rwxr-xr-x 1 root root 621 6月  25 14:45 mail.py      # 需要确保mail.py有可执行权限,因为运行此脚本的用户是zabbix而不是root

4. 设置zabbix的WEB UI

1. 设置报警媒介

  • 参照如下图示新建新的媒介类型

脚本参数依次填写:
Add ALERT.SENDTO
Add ALERT.SUBJECT
Add ALERT.MESSAGE

监控linux系统状态

监控linux系统状态

2. 设置接收邮件地址

在设置接收邮件地址时,可以使用系统自带的用户如admin。
也可以自己手动创建,需要注意权限必须是可读可执行的,否则无法收到主机发出的告警邮件

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

3. 配置动作

可以使用系统默认的动作,也可以自己添加自定义的动作

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态

5. 测试邮件告警

  1. 先禁用zabbix server,只保留wzy02主机
  2. 修改wzy02下的triggers中的网卡进触发器,将值修改为>=10000000,此时发送故障邮件到所设置的邮箱中去(46417636@qq.com)
  3. 当把值恢复为<=10000000,根据设置会发送resolve邮件到邮箱中去,提示故障已经解除。
  4. 当邮件发送一段时间后,监视器中的报错信息会自动消失。

监控linux系统状态

监控linux系统状态

监控linux系统状态

监控linux系统状态


8. zabbix监控Nginx


9. zabbix监控Tomcat

  • 由于虚拟机2中未安装tomcat,所以以下操作都运行在虚拟机器1中

配置思路

  1. 安装zabbix_java_gateway
  2. 配置zabbix_java_gateway配置文件和zabbix_server配置文件,指定监听端口,启动进程数
  3. 编辑Tomcat配置文件,开启JMX
  4. 添加host,指定JMX interface
  5. 链接TOMCAT模板

1. 安装zabbix_java_gateway

yum install -y zabbix-java-gateway

2. 修改配置文件

vi /etc/zabbix/zabbix_java_gateway.conf
定义 LISSTEN_PORT 和 START_POLLERS
将几下几项前面#去掉,使其生效

LISTEN_IP="0.0.0.0"       # 监控IP地址,全为0代表监控全网
LISTEN_PORT=10052    # 监控端口,默认就是10052
START_POLLERS=5      # 进程数

-------
vi /etc/zabbix/zabbix_server.conf
定义JavaGateway 和 JavaGatewayPort 和 StartJavaPollers

JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5

-------
systemctl start zabbix-java-gateway
启动zabbix-java-gateway服务 

--------
systemctl restart zabbix-server
重启zabbix-server服务

3. 开启JMX

vi /usr/local/tomcat/bin/catalina.sh

#!/bin/sh    # 在第二行加入以下字段
export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote"
-Djava.rmi.server.hostname=192.168.222.128
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
  • 重启tomcat
  • /usr/local/tomcat/bin/shutdown.sh
  • /usr/local/tomcat/bin/startup.sh

4. 添加Host链接模板

Configuration -> Hosts -> Cearte host
Agent interfaces -> remove
JMX interfaces -> Add -> 192.168.31.130 9999
Templates -> Select -> Template App Apache Tomcat JMX -> select -> Add -> Add


10. zabbix监控MySQL

# cat /etc/zabbix/zabbix_agentd.d/userparameter_muysql.conf   # 定义了mysql的一些指令

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值