Zabbix5.0 问题记录

时间:2022-07-24
本文章向大家介绍Zabbix5.0 问题记录,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

中文乱码

语言设置为中文时,页面乱码如图,有小方块,影响监测

Windows10字体路径,选择想更换的字体

将zabbix默认字体修改为自己想换的字体

# pwd
/usr/share/zabbix/assets/fonts   //zabbix5.0字体文件目录
# ls
graphfont.ttf
# mv graphfont.ttf graphfont.ttf.bak
# ls
graphfont.ttf.bak
# ls
graphfont.ttf.bak  simsun.ttc
# mv simsun.ttc simsun.ttf

# vim /usr/share/zabbix/include/defines.inc.php  //脚本路径
define('ZBX_GRAPH_FONT_NAME',           'simsun'); // font file name
define('ZBX_FONT_NAME', 'simsun');

systemctl restart zabbix-server.service

Zabbix discoverer processes more than 75% busy

原因:

1. 配置的每个discovery任务在一定时间内占用1个discovery进程,而zabbix_server.conf中默认配置只有1个discovery(被注释,默认生效);

2. 同时为了快速验证自动发现效果,将discovery任务的"Delay"时间由默认的3600s设置成60s。

解决方法

vi /etc/zabbix/zabbix_server.conf

### Option: StartDiscoverers
#       Number of pre-forked instances of discoverers.
#
# Mandatory: no
# Range: 0-250
# Default:
StartDiscoverers=150

zabbix server is not running

页面显示zabbix server is not running

20200827原因:数据库连接满

现象:/var/log/zabbix/zabbix_server.log

one child process died

10051端口down

调整MariaDB修改最大连接数:

#vim /etc/my.cnf
[mysqld]
max_connections=3000

重启Mariadb

#systemctl restart mariadb.service

配置agent

配置文件解读

http://www.ttlsa.com/zabbix/zabbix_agentd-conf-description/

centos8.0

https://www.cnblogs.com/cloudos/p/8301756.html

Linux

使用root用户进入系统

# useradd -s /sbin/nologin zabbix

上传文件到/home/zabbix/,解压缩

# pwd
/home/zabbix
ls
# zabbix_agent-5.0.2-linux-3.0-amd64-static.tar.gz
tar -zxf zabbix_agent-5.0.2-linux-3.0-amd64-static.tar.gz
# ls
bin  conf  sbin  zabbix_agent-5.0.2-linux-3.0-amd64-static.tar.gz
vim /home/zabbix/conf/zabbix_agentd.conf
Server=10.2.2.100        # zabbix-server或者zabbix-proxy的ip
ServerActive=192.168.137.129     # zabbix-server或者zabbix-proxy的ip
Hostname=swarm-node3          # 主机名
AllowKey=system.run[*]        # 允许zabbix使用system.run监控项执行命令
# /home/zabbix/sbin/zabbix_agentd -c /home/zabbix/conf/zabbix_agentd.conf
# ps -ef | grep zabbix
zabbix    6197     1  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd -c /home/zabbix/conf/zabbix_agentd.conf
zabbix    6198  6197  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd: collector [idle 1 sec]                
zabbix    6199  6197  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd: listener #1 [waiting for connection]  
zabbix    6200  6197  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd: listener #2 [waiting for connection]  
zabbix    6201  6197  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd: listener #3 [waiting for connection]  
zabbix    6202  6197  0 17:53 ?        00:00:00 /home/zabbix/sbin/zabbix_agentd: active checks #1 [idle 1 sec]         
root      6214  3007  0 17:53 pts/0    00:00:00 grep zabbix

windows

使用预编译agent,直接安装即可

aix(agent模式目前没有解决方法,使用snmp)

https://my.oschina.net/kcw/blog/4319827

https://blog.csdn.net/czk097520/article/details/89030069

aix_rpm下载:ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/

SNMP方法

SNMP TRAP配置

官方文档:https://www.zabbix.com/documentation/4.0/zh/manual/config/items/itemtypes/snmptrap

vi zabbix_server.conf 

 StartSNMPTrapper=1
 SNMPTrapperFile=[TRAP FILE]

配置SNMPTT

snmptrapd应该配置为使用SNMPTT

配置centos epel源

rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
yum install -y epel-release

https://blog.51cto.com/11555417/2287685

WINDOWS SERVER 2012 搭建NTP服务器

zabbix监控时间不同步会有警告:

LINUX NTP客户端配置

# vim /etc/ntp.conf
server xxx.xxx.xxx.xxx                     ---添加NTP服务器地址
# vim /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
#/etc/init.d/ntpd start                    ---开启NTP服务
#hwclock --systohc                         ---同步硬件时间
# netstat -upnl |grep ntpd  //查看时程
  
# ntpq -pn  //查看同步的服务器IP
 remote      refid   st t when poll reach  delay  offset jitter
==============================================================================
 50.77.217.185  .INIT.     16 u  -  64  0  0.000  0.000  0.000
 202.90.158.4  .INIT.     16 u  -  64  0  0.000  0.000  0.000
 202.71.100.89  .INIT.     16 u  -  64  0  0.000  0.000  0.000
 202.134.1.10  .INIT.     16 u  -  64  0  0.000  0.000  0.000
*127.127.1.0   .LOCL.     10 l  18  64 377  0.000  0.000  0.001
  
# ntpstat  //同步的结果
synchronised to local net at stratum 11
 time correct to within 12 ms
 polling server every 512 s

LINUX CHRONY(linux 8以上)配置NTP客户端

#vim /etc/chrony.conf
pool xxx.xxx.xxx.xxx iburst
# systemctl start chronyd                  ---启动chrony服务
# systemctl enable chronyd                 ---开机启动chrony服务
# chronyc sources -v                       ---验证NTP同步状态
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                     |          |  zzzz = estimated error.
||                                 |    |           
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* bogon                         4   8   377    88  +6168us[+9738us] +/-  193ms