zabbix报错集锦_received empty response from zabbix agent at [127.-程序员宅基地

技术标签: 系统运维  监控类  

1. 在启动zabbix-agent 时系统日志输出

PID file /run/zabbix/zabbix_agentd.pid not readable (yet?) after star

zabbix-agent.service never wrote its PID file. Failing

重启zabbix-agent服务依旧不能正常启动,查看/var/log/zabbix/zabbix-agentd.log 发现系统提示zabbix共享内存报错

zabbix_agentd [5922]: cannot open log: cannot create semaphore set: [28] No space left on device

后通过修改

#vim /etc/sysctl.conf
kernel.sem =500  64000   64      256

#sysctl -p /etc/sysctl.conf  

后便能够正常启动了。(报错原因:kernel.sem参数设置过小 ,原先系统默认设置的为 250 32000 32 128)

参数含义:
上面的4个数据分别对应:SEMMSL、SEMMNS、SEMOPM、SEMMNI这四个核心参数,具体含义和配置如下。

  • SEMMSL :用于控制每个信号集的最大信号数量。
  • SEMMNS:用于控制整个 Linux 系统中信号(而不是信号集)的最大数。
  • SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量。

2. zabbix unreachable poller processes more than 75 busy

unreachable poller processes 一直在处于busy的状态,那这个具体代表什么意思呢,查看官方文档zabbix internal process、unreachable poller - poller for unreachable devices 用于轮询不可到达到的设备。

可能情况:

  • 通过Zabbix agent采集数据的设备处于moniting的状态但是此时机器死机或其他原因导致zabbix agent死掉server获取不到数据,此时unreachable poller就会升高。
  • 通过Zabbix agent采集数据的设备处于moniting的状态但是server向agent获取数据时时间过长,经常超过server设置的timeout时间,此时unreachable poller就会升高。
  • 支撑Zabbix的MySQL卡住了,Zabbix服务器的IO卡住了都有可能,Zabbix进程分配到内存不足都有可能。

解决办法:
增加Zabbix Server启动时初始化的进程数量,这样直接增加了轮询的负载量,从比例上来讲忙的情况就少了

[root@localhost zabbix]#  vi /etc/zabbix/zabbix_server.conf

将这个值设置成StartPollers=500,然后重启zabbix-server服务。也可以定时重启zabbix服务。

3. Zabbix alerter processes more than 75% busy

收到几百条zabbix告警信息:
Zabbix alerter processes more than 75% busy

可能原因:

  • zabbix的数据库问题
  • zabbix服务器的IO负载
  • zabbix进程分配到内存不足
  • 网络延时或者不通

处理方法:

[root@localhost zabbix] vim /etc/zabbix/zabbix_server.conf

将其默认值5修改为20:

StartPollers=500

修改的位置

StartDiscoverers=1

StartDiscoverers=100

4. zabbix-server服务挂了,启动后又自动停机了,并且日志中很多下面这个错误

报警提示:

Zabbix value cache working in low memory mode
Less than 25% free in the configuration cache

日志打印:

[root@localhost zabbix] cat /var/log/zabbix/zabbix_server.log

6278:20180320:190117.775 using configuration file: /etc/zabbix/zabbix_server.conf

6278:20180320:190117.807 current database version (mandatory/optional): 03020000/03020001

6278:20180320:190117.807 required mandatory version: 03020000

6278:20180320:190118.378 __mem_malloc: skipped 0 asked 136 skip_min 4294967295 skip_max 0

6278:20180320:190118.378 [file:dbconfig.c,line:653] zbx_mem_malloc(): out of memory (requested 136 bytes)

6278:20180320:190118.378 [file:dbconfig.c,line:653] zbx_mem_malloc(): please increase CacheSize configuration parameter

6354:20180320:190128.632 Starting Zabbix Server. Zabbix 3.2.10 (revision 74337).

解决办法:
修改配置,重启

[root@localhost zabbix] vi /etc/zabbix/zabbix_server.conf

### Option: CacheSize

#       Size of configuration cache, in bytes.

#       Shared memory size for storing host, item and trigger data.


# Mandatory: no

# Range: 128K-8G

# Default:

# CacheSize=8M

CacheSize=2048M

[root@localhost zabbix]# systemctl restart zabbix-server

5. zabbix-server日志报错,提示connection to database ‘zabbix’ failed: [1040] Too many connections错误,mariadb正常。

应该是mysql最大连接数问题。

1、查看默认最大连接数,默认是151

[root@localhost zabbix]# /usr/bin/mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14872
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

2、修改/etc/my.cnf配置文件
在[mysqld]新添加一行:

[root@localhost zabbix]# vi /etc/my.cnf
max_connections=1000
重启mariadb服务,并验证最大连接数(没显示我们修改的):

[root@localhost zabbix]# systemctl restart mariadb.service
[root@localhost zabbix]# /usr/bin/mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 446
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 214   |
+-----------------+-------+
1 row in set (0.00 sec)

3、配置/usr/lib/systemd/system/mariadb.service来调大打开文件数目。

[root@localhost zabbix]# vi /usr/lib/systemd/system/mariadb.service
在[Service]新加这两行:
LimitNOFILE=10000
LimitNPROC=10000

4、重新加载系统服务,并重启mariadb服务

[root@localhost zabbix]# systemctl --system daemon-reload
[root@localhost zabbix]# systemctl restart mariadb.service

5、重新验证下,是否为1000

MariaDB [(none)]> show variables like 'max_connections';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    5
Current database: *** NONE ***
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
1 row in set (0.00 sec)

6. 报警提示More than 100 items having missing data for more than 10 minutes和Zabbix poller processes more than 75% busy错误。

解决办法:
修改配置文件增大线程数和缓存

[root@localhost zabbix]#  vim /usr/local/zabbix/etc/zabbix_server.conf

StartPollers=500

StartPollersUnreachable=50

StartTrappers=30

StartDiscoverers=6

CacheSize=1G

CacheUpdateFrequency=300

StartDBSyncers=20

HistoryCacheSize=512M

TrendCacheSize=256M

HistoryTextCacheSize=80M

ValueCacheSize=1G

7. server日志很多first network error, wait for 15 seconds报错

server配置文件Timeout时间改大,我改成了30s。

8. zabbix告警“Zabbix poller processes more than 75% busy”(网友)

告警原因:
1.某个进程卡住了,
2.僵尸进程出错,太多,导致慢了
3.网络延迟(可忽略)
4.zabbix消耗的内存多了

告警危害:
普通告警,暂无危害(但是最好处理)

处理方法:

  1. 简单,粗暴(重启zabbix-server可结合定时任务使用)
service zabbix-server restart
crontab -e 调出Cron编辑器中增加一个计划:
@daily service zabbix-server restart > /dev/null 2>&1
  1. 编辑Zabbix Server的配置文件/etc/zabbix/zabbix_server.conf,找到配置StartPollers的段落:
### Option: StartPollers
#       Number of pre-forked instances of pollers.
#
# Mandatory: no
# Range: 0-1000
# Default:
# StartPollers=5
#取消StartPollers=一行的注释或者直接在后面增加:
StartPollers=10

将StartPollers改成多少取决于服务器的性能和监控的数量,将StartPollers设置成12之后就再没有遇到过警报。如果内存足够的话可以设置更高。

9.报错:No route to host处理

今天在客户端配置Zabbix_agentd后,通过自动注册到 Zabbix_Server 页面中,点击主机列表却发现ZBX显示红色,无法被监控到,查看报错为:

No route to host

在客户端telnet服务端的10051端口发现没有问题,服务端telnet 客户端10050端口报错:
telnet 1.1.1.1 10050
Trying 1.1.1.1...
telnet: connect to address 120.27.241.253: No route to host
原来是被客户端的防火墙档掉了,关闭客户端防火墙或者配置相应规则即可

10. active check configuration update from [1.1.1.1:10051] started to fail (ZBX_TCP_READ() timed out)

现象:

查看日志/var/log/zabbix/zabbix_agentd.log,大量的报错

1404:20161225:183259.913 active check configuration update from [1.1.1.1:10051] started to fail (ZBX_TCP_READ() timed out)

原因:
原来是zabbix_sender需要主动向服务器发送数据,而zabbix-server端的10051端口被防火墙挡住了,重新放行端口问题解决

11. zabbix安装完成后启动提示错误

[root@bogon zabbix-2.2.2]# /usr/local/zabbix-2.2.2/sbin/zabbix_server 
/usr/local/zabbix-2.2.2/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

这是因为找不到 libmysqlclient.so.16 文件所致,可以查找mysql的安装目录,找到此文件然后做一个软链接即可:

#ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib

或者打开  /etc/ld.so.confrs 文件
# vim  /etc/ld.so.confrs
      在其中添加:
/usr/local/mysql/lib

12.Received empty response from Zabbix Agent at [127.0.0.1]. Assuming that agent dropped connection because of access permissions.

意思是说没有权限访问agent端口10050
解决方法如下:
将server的agent链接IP 127.0.0.1修改为本机IP

重启服务

systemctl restart zabbix-server

13.Zabbix discoverer processes more than 75% busy

增加Zabbix Server启动时初始化的进程数量,这样直接增加了轮询的负载量,从比例上来讲忙的情况就少了

[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf
修改为
StartDiscoverers=5
重启
[root@zabbix-server ~]# systemctl restart zabbix-server

14.zabbix-agent无法启动错误

# tail -20 /var/log/zabbix/zabbix_agentd.log

.........................

zabbix_agentd [1232]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory

zabbix_agentd [3847]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory

zabbix_agentd [1724]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [13] Permission denied

解决

[root@elkstack ~]# mkdir -p /var/run/zabbix/
[root@elkstack ~]# chown zabbix.zabbix /var/run/zabbix/
[root@elkstack ~]# systemctl restart zabbix-agent.service

15.Web页面报错总结

问题一: Zabbix alerter processes more than 75% busy

问题原因:
zabbix服务器邮件进程繁忙导致的,一般是因为设置动作的间隔太短。特殊情况下会产生大量告警,如服务器发几万封邮件过程中,邮件进程发挂了

解决方案:

  • 删除数据库解决(风险较大,不建议)
  • 修改邮件脚本,将邮件的动作改为打印时间,等待邮件完全释放再改回来,如下
 [root@m01 ~]# cat /usr/lib/zabbix/alertscripts/sms 
 #!/bin/bash 
 echo `date` >>/tmp/sms.txt 

问题二: Zabbix discoverer processes more than 75% busy

问题原因:

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

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

解决方案:

  • 01.修改配置文件中的StartDiscoverers进程数量,取消其之前的#号并将数值修改为5,最后重启服务

(注:根据系统硬件配置,可以设置成更高的数值,但其范围为0~250)

[root@m01 ~]# grep 'StartDiscoverers' /etc/zabbix/zabbix_server.conf

 ### Option: StartDiscoverers
  StartDiscoverers=5
  [root@m01 ~]# systemctl restart zabbix-server.service
  • 02.编写定时任务脚本重启zabbix_server来降低负载
[root@m01 ~]# crontab -e 
@daily service zabbix-server restart > /dev/null 2>&1 #计划会每天自动重启Zabbix服务以结束僵尸进程并清理内存等

问题三: Zabbix poller processes more than 75% busy

问题原因:

  • 01.通过Zabbix agent采集数据的设备死机或其他原因导致zabbix agent死掉server获取不到数据
  • 02.server向agent获取数据时时间过长,超过了server设置的timeout时间

解决方案:

  • 01.增加Zabbix Server启动时初始化的进程数量
 ### Option: StartPollers 
  StartPollers=10 #改成多少取决于服务器的性能和监控的数量,如果内存足够的话可以设置更高 
  • 02.修改模板自动发现规则中的保留失去的资源期间为0

问题四: Zabbix housekeeper processes more than 75% busy

问题原因:

为了防止数据库持续增大,zabbix有自动删除历史数据的机制即housekeeper,而mysql删除数据时性能会降低,就会报错

解决方案:

调整HousekeepingFrequency参数

HousekeepingFrequency=1  #间隔时间 
MaxHousekeeperDelete=1000000 #最大删除量 

问题五: Zabbix server内存溢出,无法启动

问题原因:

zabbix使用一段时间后,再次加入一批交换机监控,zabbix-server将无法启动,查看日志显示如下(提示内存溢出,需调整zabbix服务器配置zabbix_server.conf)

1 2816:20170725:174352.675 [file:dbconfig.c,line:652] zbx_mem_realloc(): out of memory (requested 162664 bytes)2 3 2816:20170725:174352.675 [file:dbconfig.c,line:652] zbx_mem_realloc(): please increase CacheSize configuration parameter

解决方案:

#vim zabbix_server.conf 
CacheSize=1024M #默认为8M

问题六:PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 11 bytes)

问题原因:

zabbix某些页面无法打开,查看php日志发现,当访问这个页面时报错内存不足

解决方案:

不清楚是否内存泄露,最简单的方法是调大php进程的可用内存

  [root@zabbix-master ~]# grep 'memory_limit' /etc/httpd/conf.d/zabbix.conf  
 php_value memory_limit 512M #默认128M 

16.cannot connect to [[172.16.2.225]:10050]: [113] No route to host

这种一般是网络连接问题

排查:在server上telnet 172.16.2.225 10050,是同样的报错,查看是否关闭iptables和selinux

17.zabbix server is not running: the information displayed may not be current.

排查:编辑zabbix.conf.php文件,把$ZBX_SERVER的原来的值localhost改为本机的IP地址。

vim /etc/zabbix/web/zabbix.conf.php
$ZBX_SERVER = '172.16.2.116'; 

18.

  1. 打开zabbix web界面点击profile出现以下报错信息:

    scandir() has been disabled for security reasons [profile.php:198 → CView->
    

    解决:

    php环境中把scandir写在了disable_functions中。在php.ini文件把disable_functions中的scandir去掉即可。
    
    (重启php-fpm和nginx)
    
  2. 添加windows监控时候报错:

    Get value error: ZBX_TCP_READ() failed: [104] Connection reset by peer
    

    解决:
    windows下agentd.conf文件IP地址不对

  3. zabbix打开既然没有任何数据显示

    我用360安全浏览器使用打开没有任何数据显示,然而用IE打开zabbix数据就能正常的显示呈现。

  4. 配置zabbix-server监控IPMI

    编译加--with-openipmi参数报错。
    
    configure: error: Invalid OPENIPMI directory - unable to find ipmiif.h
    

    解决:

         需提前安装
    #yum install net-snmp-devel OpenIPMI OpenIPMI-devel rpm-build
    

19. zabbix_server dead but subsys locked错误

今天把Zabbix版本从3.2升级到了3.4。但在启动Zabbix_Server时出现了"zabbix_server dead but subsys locked"的错误状态。

问题原因

在查看了zabbix_server日志,发现日志里有下面的告警

zbx_mem_malloc(): out of memory (requested 256 bytes) zbx_mem_malloc(): please increase CacheSize configuration parameter

错误原因写的很明白,内存溢出,请调整CacheSize大小。

问题解决

编辑zabbix_server.conf配置文件,定位到CacheSize关键字位置,然后调高CacheSize大小,大小根据自己环境调整

# Size of configuration cache, in bytes. # Shared memory size for storing host, item and trigger data. # Mandatory: no # Range: 128K-8G # Default: CacheSize=32M 

最后重启zabbix_server服务即可。

Zabbix value cache working in low memory mode错误

问题解决:

编辑zabbix_server.conf配置文件,定位到ValueCacheSize关键字位置,然后调高ValueCacheSize大小,大小根据自己环境调整

# Option: ValueCacheSize # Size of history value cache, in bytes. # Shared memory size for caching item history data requests. # Setting to 0 disables value cache. # # Mandatory: no # Range: 0,128K-64G # Default: ValueCacheSize=2048M

20.错误解决:

  1. 安装zabbix时发生的错误:
    ①错误:编译zabbix时总是提示gcc not find之类
     解决:安装development tools,命令:
    yum -y groupinstall “Delvelopment Tools”
    ②错误:编译zabbix时提示mysqlclient not find之类
    解决:安装mysql-devel,命令:
    yum -y install mysql-devel
    ③错误:输入127.0.0.1/zabbix/setup.php提示403forbidden
    解决:关闭Selinux,使用setenforce 0命令,或者vim /etc/selinux/config,将SELINUX=enforcing改为SELINUX=disabled,再重启linux即可。

  2. 使用过程中发生的错误:
    ①错误:zabbix运行状态显示no,未运行
    解决:首先检查是否zabbix服务未启动,使用/etc/init.d/zabbix_server start启动zabbix服务;
    如果还是错误,vim/var/www/html/zabbix/conf/zabbix.conf.php,将配置文件中的$ZBX_SERVER字段为服务器的IP地址,默认是127.0.0.1,然后重启zabbix_server服务;
    ②错误:zabbix出现zabbix agent unreachable警告。
    解决:vim /usr/local/etc/zabbix_agentd.conf,(看个人情况选择路径)查看Hostname与组态–主机–主机名称是否相同,如果不同更 改主机名称,将Server改为ip。
    ③错误:zabbix出现Lack of free swap space警告
     解决:1.检查 Swap 空间,
         命令:free -m
    如果返回的信息概要是空的,则表示 Swap 文件不存在。
        2.检查文件系统,
         命令df-hal
         检查返回的信息,还剩余足够的硬盘空间即可。
        3.创建并允许 Swap 文件,
         命令dd if=/dev/zero of=/swapfile bs=1024 count=2048000
         参数解读:
         if=文件名:输入文件名,缺省为标准输入。即指定源文件。< if=input file >
         of=文件名:输出文件名,缺省为标准输出。即指定目的文件。< of=output file >
         bs=bytes:同时设置读入/输出的块大小为bytes个字节
         count=blocks:仅拷贝blocks个块,块大小等于bs指定的字节数。
        4.格式化并激活 Swap 文件,
         命令:格式化Swap:   mkswap /swapfile
            激活Swap:    swapon /swapfile
            查看Swap:    swapon -s
            修改 fstab 配置: vim /etc/fstab ,在最后加上/swapfile swap swap defaults 0 0
            授权:      chown root:root /swapfile
                     chmod 0600 /swapfile
    ④错误:zabbix自定义key显示未启用,log中显示bad interpreter错误
     解决:在windows用建立的sh文件在linux中运行时,因为window在每行后加入隐藏字符^M,所以当linux编译时 由于无法编译^M而导  致bad interpreter错误,使用 vi -b 找出^M 然后删除即可。

21.Zabbix 是一个基于WEB界面的企业级开源分布式监控软件,不少人在部署和配置zabbix时会重复遇到各种坑,临时解决后又忘记做记录,这是非常不好的习惯,技术一流汇总一下常见错误的解决方法供大家参考。

问题一:

使用源代码安装之后, 在zabbix的网页上不能使用MySQL数据库。

解决方法
zabbix需要php支持mysqli; 使用源码安装php时需要加上–with-mysqli=mysqlnd参数之后在网页可以显示。

问题二:
在./configure时,提示configure: error: Invalid Net-SNMP directory – unable to find net-snmp-config

解决方法:
执行 yum install -y net-snmp-devel libxml2-devel libcurl-devel

问题三:
在zabbix网页上填写MySQL信息后下一步提示The frontend does not match Zabbix database.报错

解决方法:
确认mysql账号信息无误后,再检查初始化zabbix库是否成功,若还报错则重新初始化zabbix数据库。

问题四:
网页安装zabbix提示要下载配置文件:Unable to create the configuration file.

解决方法:
设置 web服务器用户在zabbix网页的conf/目录具有写权限,配置文件会自动保存。

问题五
zabbix安装完成后,在管理后台>admin个人资料页面无法选择中文语言

**解决方法:**修改zabbix网站目录下的zabbix/include/locales.inc.php文件中的中文支持(默认存在中文语言支持的)

找到 ‘zh_CN’ => [‘name’ => _(‘Chinese (zh_CN)’), ‘display’ => false], 将false改为true

问题六:
后台修改语言为中文后,图形的汉字显示为方格乱码

解决方法:

[root@eazence ~]# cd /etc/nginx/html/zabbix/fonts/  #这个是存放zabbix网页的字体路径

[root@eazence fonts]# ls

DejaVuSans.ttf

[root@eazence fonts]# wget -c http://www.138096.com/simkai.ttf

[root@eazence fonts]# cp -p DejaVuSans.ttf DejaVuSans.ttf.bak

[root@eazence fonts]# mv -f simkai.ttf DejaVuSans.ttf     #完成这一步后刷新网页即可

22.

  1. 在Zabbix的Dashboard中Status of Zabbix的:
    Zabbix server is running’s value is “No”

    解决思路:

     考虑是Zabbix Server的配置文件中连接数据库的账户对zabbix数据库的权限不够,修改账户的对数据库的权限;
    
  2. ITEM收取不到数据,并报一下错误:

    Received value [0.05] is not suitable for value type [Numeric (unsigned)] 
    

    解决思路:
    修改Zabbix Server配置文件中CacheSize的默认值,尽量提升;
    或者是ITEM的配置中Type of information配置的有误,修改为合适的格式

23.导入percona模版报错

 Import failed

    Invalid XML tag "/zabbix_export/date": "YYYY-MM-DDThh:mm:ssZ" is expected.

解决办法

将zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.6.xml导入zabbix2.4中再导出。之后将新的导出xml导入到3.0中问题解决。

从zabbix3.0导出的percona模板:Percona-MySQL-Server-Template

24.Zabbix Server突然挂了,查看log报错如下:

using configuration file: /etc/zabbix/zabbix_server.conf...[file:dbconfig.c,line:545] zbx_mem_malloc(): out of memory (requested 16 bytes)[file:dbconfig.c,line:545] zbx_mem_malloc(): please increase CacheSize configuration parameter

报错里已经很明确的提示了修复办法:please increase CacheSize configuration parameter

所以,我们就去zabbix_server.conf中找到CacheSize字段

### Option: CacheSize#   Size of configuration cache, in bytes.
#   Shared memory size for storing host, item and trigger data
.## Mandatory: no# Range: 128K-8G# Default:
# CacheSize=8M

根据服务器配置情况,修改CacheSize

### Option: CacheSize
#   Size of configuration cache, in bytes.
#   Shared memory size for storing host, item and trigger data.
## Mandatory: no
# Range: 128K-8G# 
Default:CacheSize=2048M

重启Zabbix Server即可

25.Zabbix日志错误总结

zabbix_agentd.log

错误一

 no active checks on server [*.*.*.*:10051]: host [*] not found

出现该错误的原因是一般是zabbix_agentd.conf里面的Hostname和前端zabbix web(Monitoring->Configuration->Hosts 页面的Name)里面的配置不一样所造成的

解决:在zabbix web页面Monitoring->Configuration->Hosts 页面更改Host name和zabbix_agentd.conf里面的Hostname一样。

错误二

activecheck configuration update from [127.0.0.1:10051] started to fail (cannotconnect to [[127.0.0.1]:10051]: [111] Connection refused)

解决:
上面标注的地方有报错,我们可以编辑
etc/zabbix/zabbix_agentd.conf
注释掉#ServerActive=127.0.0.1
并且重启zabbix agent即可。

zabbix_server.log

1、failed to accept an incoming connection: connection from “” rejected, allowed hosts: “127.0.0.1” 这个是 zabbix_agentd.conf 文件配置错误的提示,好好检查一下

vim /usr/local/zabbix/etc/zabbix_agentd.conf

修改 :

Server=你的服务器地址ServerActive=你的服务器地址

Hostname=你的客户端名称

27.zabbix_agentd.log

  • 错误一
 no active checks on server [*.*.*.*:10051]: host [*] not found

出现该错误的原因是一般是zabbix_agentd.conf里面的Hostname和前端zabbix web(Monitoring->Configuration->Hosts 页面的Name)里面的配置不一样所造成的

解决

在zabbix web页面Monitoring->Configuration->Hosts 页面更改Host name和zabbix_agentd.conf里面的Hostname一样。

  • 错误二
activecheck configuration update from [127.0.0.1:10051] started to fail (cannotconnect to [[127.0.0.1]:10051]: [111] Connection refused)解决:

上面标注的地方有报错,我们可以编辑etc/zabbix/zabbix_agentd.conf 注释掉#ServerActive=127.0.0.1并且重启zabbix agent即可

28. failed to accept an incoming connection: connection from “” rejected, allowed hosts: “127.0.0.1”

这个是 zabbix_agentd.conf 文件配置错误的提示,好好检查一下

# vim /usr/local/zabbix/etc/zabbix_agentd.conf

修改 :
Server=你的服务器地址 ServerActive=你的服务器地址 Hostname=你的客户端名称
 尤其是Hostname
zabbix_agentd.conf里面的Hostname必须和web管理界面主机名称一样

配置----主机---要监控的主机---主机名称

29.登录Zabbix之前,却确认Nginx服务打开,php-fpm打开,service zabbix_server start server_agentd start

意外断电Zabbix登录出现如下错误

Database error

Error connecting to database: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
无法连接到数据库,请确认数据库是否开启

当我要开启数据库服务的时候,数据库又出错,因为我没有开启热备份。。。。

[root@dep5 ~]# service mysqld statusMySQL is not running, but lock file (/var/lock/subsys/mysql[失败]ts[root@dep5 ~]# service mysqld startStarting MySQL...The server quit without updating PID file [失败]mysql.pid).

#查看日志

#[root@dep5 ~]# vim /data/mysqldb/log/mysql-error.log 2016-09-03 16:26:43 10550 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace zabbix/groups uses space ID: 3 at filepath: ./zabbix/groups.ibd. Cannot open tablespace mysql/slave_relay_log_info which uses space ID: 3 at filepath: ./mysql/slave_relay_log_info.ibd2016-09-03 16:26:43 7f4097e0a720  InnoDB: Operating system error number 2 in a file operation.InnoDB: The error means the system cannot find the path specified.InnoDB: If you are installing InnoDB, remember that you must createInnoDB: directories yourself, InnoDB does not create them.InnoDB: Error: could not open single-table tablespace file ./mysql/slave_relay_log_info.ibdInnoDB: We do not continue the crash recovery, because the table may becomeInnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.InnoDB: To fix the problem and start mysqld:InnoDB: 1) If there is a permission problem in the file and mysqld cannotInnoDB: open the file, you should modify the permissions.InnoDB: 2) If the table is not needed, or you can restore it from a backup,InnoDB: then you can remove the .ibd file, and InnoDB will do a normalInnoDB: crash recovery and ignore that table.InnoDB: 3) If the file system or the disk is broken, and you cannot removeInnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnfInnoDB: and force InnoDB to continue crash recovery here.160903 16:26:43 mysqld_safe mysqld from pid file /tmp/mysql.pid ended

mysql 日志中给出了猜测和各自的解决方案

1)权限问题,修改权限就OK

2)就是说你不需要这些表的话,清空表,删除.ibd文件,就会恢复(这样的话你的zabbix也会没有,我想一下第三种方法)

3)如富哦这是文件系统或者磁损坏,你不能移除,你可以在你的my.cnf里面将设置innodb_force_recovery > 0,强制InnoDB引擎来…

解决:

[root@dep5 ~]# vim /etc/my.cnf
#innodbinnodb_file_per_table = 1
innodb_data_file_path = ibdata1:2048M:autoextend
innodb_log_file_size = 128m
innodb_log_files_in_group = 3
innodb_buffer_pool_size = 60M
innodb_buffer_pool_instances = -1
innodb_max_dirty_pages_pct = 70
#innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_buffer_size = 16m
innodb_flush_log_at_trx_commit = 2
innodb_force_recovery = 1 #添加这个就Ok了

#[root@dep5 ~]# vim /etc/my.cnf
#[root@dep5 ~]# service mysqld start
#Starting MySQL…

我看了一下启动成功之后的数据库日志有如下片段,猜测Zabbix无法正常打开= =

2016-09-03 16:41:33 18646 [Warning] Info table is not ready to be used. Table 'mysql.slave_master_info' cannot be opened.2016-09-03 16:41:33 18646 [Warning] InnoDB: Cannot open table mysql/slave_worker_info from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.2016-09-03 16:41:33 18646 [Warning] InnoDB: Cannot open table mysql/slave_relay_log_info from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.2016-09-03 16:41:33 18646 [Warning] Info table is not ready to be used. Table 'mysql.slave_relay_log_info' cannot be opened.2016-09-03 16:41:34 18646 [Note] Event Scheduler: Loaded 0 events2016-09-03 16:41:34 18646 [Note] /usr/local/mysql/bin/mysqld: ready for connections.Version: '5.6.31-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution2016-09-03 16:41:34 18646 [Note] Event Scheduler: scheduler thread started with id 12016-09-03 16:41:39 7feb5261e700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.2016-09-03 16:41:39 7feb5261e700 InnoDB: Error: Fetch of persistent statistics requested for table "zabbix"."users" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.2016-09-03 16:41:39 7feb5261e700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

这个就是Zabbix打开出现的界面,,

后面想着注释在my.cnf添加的哪一行,,

虽然mysql重新启动是OK了,但是mysql日志被刷新了一次…

2016-09-03 16:48:11 7f37cdfb7700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.2016-09-03 16:48:11 7f37cdfb7700 InnoDB: Error: Fetch of persistent statistics requested for table "zabbix"."media_type" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.

我就想着修复表。。。

[root@dep5 ~]# mysqlcheck -r zabbixzabbix.acknowledgesnote     : The storage engine for the table doesn't support repairzabbix.actionsnote     : The storage engine for the table doesn't support repairzabbix.alerts

悲剧了,我猜zabbix数据库的引擎应该为myisam,看不到引擎啊。。

使用MySQL5.6或者更高版本,自从MySQL被Oracle收购了,它的性能确实有不少的提升。请一定选择innodb,别选择myisam,因为zabbix在innodb的性能比在myisam快1.5倍,而且myisam不安全,zabbix监控数据量很大,一旦表坏了,那就是一个悲剧。

悲剧啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

注意:

毕竟我也是新手,然后能想到的最笨的办法就是所有重来(没做配置备份,引擎没有修改,好尴尬)

最后的处理办法,闪库,重新建库建表,并且重新导入zabbix表把。。想搭建zabbix服务器那样,前面做了什么全部清理掉,然后重新来

31.

  1. 在启动zabbix-agent 时系统日志输出
PID file /run/zabbix/zabbix_agentd.pid not readable (yet?) after star

zabbix-agent.service never wrote its PID file. Failing

同时通过输入 systemctl status zabbix-agent.service 看其中提到了selinux,后通过输入getenforce 发现selinux是打开的,便关闭了selinux

重启zabbix-agent服务依旧不能正常启动,查看/var/log/zabbix/zabbix-agentd.log 发现系统提示zabbix共享内存报错

zabbix_agentd [5922]: cannot open log: cannot create semaphore set: [28] No space left on device

如图:

后通过修改 vim /etc/sysctl.conf

kernel.sem =500 64000 64 256

sysctl -p /etc/sysctl.conf 后便能够正常启动了。(报错原因:kernel.sem参数设置过小 ,原先系统默认设置的为 250 32000 32 128)

参数含义

上面的4个数据分别对应:SEMMSL、SEMMNS、SEMOPM、SEMMNI这四个核心参数,具体含义和配置如下。

1.SEMMSL :用于控制每个信号集的最大信号数量。

2.SEMMNS:用于控制整个 Linux 系统中信号(而不是信号集)的最大数。

3.SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量。

4.SEMMNI :内核参数用于控制整个 Linux 系统中信号集的最大数量。

32.1.zabbix仪表板错误
问题:
zabbix server is not running: the information displayed may not be current
解决方案:

几种情况都有可能引起这个错误:1)可能是zabbix-server未安装zabbix-agent;或者安装了却没有检测到agent的端口2)

2.日志报错
问题:
172730.555 [Z3001] connection to database ‘zabbix’ failed: [1045] Access denied for
解决方案:

#修改配置文件shell->vim/etc/zabbix/zabbix-server.confDBPassword=zabbix#重启服务shell->/etc/init.d/zabbix-server restart#再次查看日志shell->tail -f /var/log/zabbix/zabbix-server.log

  1. 提示没有中文环境
    问题:
    You are not able to choose some of the languages, because locales for them are not installed on the

解决方案:

  1. 启用中文

    vi /usr/share/zabbix/include/locales.inc.php 把zh_CN后面参数写true 然后去web界面选择语言。 如果,去选择语言的时候,你发现还是不能选择. 提示: You are not able to choose some of the languages, because locales for them are not installed on the web server. 是因为你系统里没中文环境 那么:设置中文环境 第一步,安装中文包: apt-get install language-pack-zh-hant language-pack-zh-hans 第二步,配置相关环境变量: vi /etc/environment 在文件中增加语言和编码的设置: LANG=“zh_CN.UTF-8” LANGUAGE=“zh_CN:zh:en_US:en” 第三步,重新设置本地配置: dpkg-reconfigure locales 现在重启apache&zabbix_server两个服务一下,应该可以选了。。

  2. 但是我发现翻译的不好,有大神做了更好的翻译(未测)

点击参考

进入    cd /usr/share/zabbix/locale/zh_CN/LC_MESSAGES目录    代码: 全选    wget https://github.com/echohn/zabbix-zh_CN/ ... master.zip    unzip master.zip    rm frontend.mo    cp zabbix-zh_CN-master/frontend.mo frontend.mo     现在重启apache&zabbix_server两个服务    service zabbix-server restart    service apache2 restart
  1. 乱码问题

看图时候,如果有中文,会乱码 调整图像里的中文乱码 下载雅黑 代码: 全选
wget http://dx.sc.chinaz.com/Files/DownLoad/font2/dd.rar
解压缩文件 rar x dd.rar
cp dd/msyh.ttf msyh.ttf
然后修改 vi /usr/share/zabbix/include/defines.inc.php
找到 define(‘ZBX_GRAPH_FONT_NAME’, ‘graphfont’); // font file name
修改成: define(‘ZBX_GRAPH_FONT_NAME’, ‘msyh’); // font file name
cp msyh.ttf /usr/share/zabbix/fonts #少了这一步则图形下面没有字体 重启apache服务即可

zabbix3.0使用里面设置字体的地方43行跟93行设为一样即可

4.重要的mibs库,必须更新,否则snmp监控交换机时,mib会报错。(未测)

apt-get install snmp-mibs-downloade    ##一些提示 tips    重新启动zabbix-server服务进程    # service zabbix-server restart    重新启动zabbix-agent进程    # service zabbix-server restart    重启apache进程    #service apache2 restart     重要目录:    log: /var/log/zabbix/zabbix_server/log和agent.log 排查错误必须    conf:/etc/zabbix/*.conf    安装目录:/usr/share/zabbix 重要的include,font .etc    根web目录在var/www/html    ###原文:http://www.cnblogs.com/zangdalei/p/5712951.html
  1. apt-get update更新时报错
    问题:
Failed to fetch
http://ubuntu.kurento.org/dists/trusty/kms6/binary-i386/Packages 403 Forbidden [IP: 112.124.140.210 80]

解决方案:
apt-get update时出现没有权限(403)的问题,112.124.140.210 是apt代理地址,修改(或者删除,注释最好)apt.conf文件,取消掉这个代理就可以了,当然不用代理的话,您的ubuntu必须能够访问外网。

  1. zabbix微信报警时出现
    shell脚本中忘记开头!#/bin/bash 导致手动执行脚本微信可以发生消息,但是zabbix触发后action完成但是微信收不到消息!

32. zabbix3.2升级3.4报错Database error

zabbix3.2版本升级到zabbix3.4版本后打开页面报错,报错内容如下

Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 3020000/3020000. Required mandatory version: 3040000. Contact your system administrator.

解决办法:

进入数据库

mysql> show databases;

mysql> use zabbix;

mysql> update dbversion set mandatory=3040000;

mysql> flush privileges;

重新打开web即可解决

34.zabbix报错: cannot connect to [[192.168.119.110]:10050]: [111] Connection refused

错误分析:Connection refused 拒绝连接!
(1)客户端与服务端网络不通;

(2)客户端服务内用防火墙阻隔;

(3)网段内用物理防火墙阻隔。

解决方法:
(1)查看日志:查看、分析错误原因

root@a-desktop:~# tail /var/log/zabbix-agent/zabbix_agentd.log

  5927:20160913:101039.428 agent #2 started [listener #2]

  5923:20160913:102113.808 Got signal [signal:15(SIGTERM),sender_pid:5999,sender_uid:0,reason:0]. Exiting ...

  5923:20160913:102113.810 Zabbix Agent stopped. Zabbix 2.2.2 (revision 42525).

  6004:20160913:102113.824 Starting Zabbix Agent [Cloud_platform002]. Zabbix 2.2.2 (revision 42525).

  6004:20160913:102113.824 using configuration file: /etc/zabbix/zabbix_agentd.conf

  6005:20160913:102113.824 agent #0 started [collector]

  6006:20160913:102113.825 agent #1 started [listener #1]

  6007:20160913:102113.825 agent #2 started [listener #2]

  6008:20160913:102113.825 agent #3 started [listener #3]

  6009:20160913:102113.825 agent #4 started [active checks #1]

(2)如果是网络不通,可以做域名解析或者通过zabbix-agent实现数据收集

zabbix-agent分布式监控可以参考我的另一篇分享《zabbix分布式监控(阿里云zabbix-server,… 》

(3)如果服务器防火墙

添加规则:iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT

(4)物理防火墙

同样的也是在墙上开个10050的TCP端口

35.sudo bug导致的zabbix断图问题

线上使用zabbix的host update来监测监控值是否完整(关于host update的实现请参考:

http://caiguangguang.blog.51cto.com/1652935/1345789)

一直发现有机器过一段时间update值就会莫名其妙变低,之前一直没有找到rc,只是简单通过重启agent来进行修复,最近同事细心地发现可能是和sudo的bug有关系。

回过头再来验证下整个的排查过程。

  1. 通过zabbix 数据库获取丢失数据的item,拿出缺失的(20分钟没有更新的)值的item列表
select b.key_,b.lastvalue,from_unixtime(b.lastclock) from hosts a,

 items b where a.hostid=b.hostid and a.host='xxxxxx' and 

 b.lastclock < (unix_timestamp() - 1200) limit 10;

比如这里看agent.ping:

观察监控图,发现在18点20分之后数据丢失

  1. 分析zabbix agent端的日志

发现在18点24粉左右出现下面的日志,没有看到正常的获取值和发送值的情况,只有大量的update_cpustats状态,同时发现有一行kill command 失败的日志:

27589:20141021:182442.143 In zbx_popen() command:'sudo hadoop_stats.sh nodemanager StopContainerAvgTime'

27589:20141021:182442.143 End of zbx_popen():5

48430:20141021:182442.143 zbx_popen(): executing script

27585:20141021:182442.284 In update_cpustats()

27585:20141021:182442.285 End of update_cpustats()

27585:20141021:182443.285 In update_cpustats()

27585:20141021:182443.286 End of update_cpustats()

27585:20141021:182444.286 In update_cpustats()

27585:20141021:182444.287 End of update_cpustats()

27585:20141021:182445.287 In update_cpustats()

27585:20141021:182445.287 End of update_cpustats()

27585:20141021:182446.288 In update_cpustats()

27585:20141021:182446.288 End of update_cpustats()

..........

27585:20141021:182508.305 In update_cpustats()

27585:20141021:182508.305 End of update_cpustats()

27585:20141021:182509.306 In update_cpustats()

27585:20141021:182509.306 End of update_cpustats()

27585:20141021:182510.306 In update_cpustats()

27585:20141021:182510.307 End of update_cpustats()

27585:20141021:182511.307 In update_cpustats()

27585:20141021:182511.308 End of update_cpustats()

27589:20141021:182512.154 failed to kill [sudo hadoop_stats.sh nodemanager StopContainerAvgTime]: [1] Operation not permitted

27589:20141021:182512.155 In zbx_waitpid()

27585:20141021:182512.308 In update_cpustats()

27585:20141021:182512.309 End of update_cpustats()

27585:20141021:182513.309 In update_cpustats()

27585:20141021:182513.309 End of update_cpustats()

对比正常的日志:

27589:20141021:180054.376 In zbx_popen() command:'sudo hadoop_stats.sh nodemanager StopContainerAvgTime'

27589:20141021:180054.377 End of zbx_popen():5

18798:20141021:180054.377 zbx_popen(): executing script

27589:20141021:180054.384 In zbx_waitpid()

27589:20141021:180054.384 zbx_waitpid() exited, status:1

27589:20141021:180054.384 End of zbx_waitpid():18798

27589:20141021:180054.384 Run remote command [sudo  hadoop_stats.sh nodemanager StopContainerAvgTime] Result [2] [-1]...

27589:20141021:180054.384 For key [hadoop_stats[nodemanager,StopContainerAvgTime]] received value [-1]

27589:20141021:180054.384 In process_value() key:'gd6g203s80-hadoop-datanode.idc.vipshop.com:hadoop_stats[nodemanager,StopContainerAvgTime]' value:'-1'

27589:20141021:180054.384 In send_buffer() host:'10.200.100.28' port:10051 values:37/50

27589:20141021:180054.384 Will not send now. Now 1413885654 lastsent 1413885654 < 1

27589:20141021:180054.385 End of send_buffer():SUCCEED

27589:20141021:180054.385 buffer: new element 37

27589:20141021:180054.385 End of process_value():SUCCEED

可以看到正常情况下脚本会有返回值,而出问题的时候,脚本是没有返回值的,并且由于是使用sudo 运行脚本,导致以普通用户启动的zabbix在超时时没有办法杀掉这个command(Operation not permitted 错误)

  1. 假设这里启动zabbix agent的普通用户为apps用户,我们看下这个脚本目前的状态
# ps -ef|grep hadoop_stats.sh

root     34494 31429  0 12:54 pts/0    00:00:00 grep 48430

root     48430 27589  0 Oct21 ?        00:00:00 sudo hadoop_stats.sh nodemanager StopContainerAvgTime

root     48431 48430  0 Oct21 ?        00:00:00 [hadoop_stats.sh] <defunct>

可以看到,这里产生了一个僵尸进程(关于僵尸进程可以参考:http://en.wikipedia.org/wiki/Zombie_process)

僵尸进程是由于子进程运行完毕之后,发送SIGCHLD到父进程,而父进程没有正常处理这个信号导致。

You have killed the process, but a dead process doesn't disappear from the process table 

until its parent process performs a task called "reaping" (essentially calling wait(3)

 for that process to read its exit status). Dead processes that haven't been reaped are

  called "zombie processes."

The parent process id you see for 31756 is process id 1, which always belongs to init. 

That process should reap its zombie processes periodically, but if it can't, they will

 remain zombies in the process table until you reboot.

正常的进程情况下,我们使用strace attach到父进程,然后杀掉子进程后可以看到如下信息:

Process 3036 attached - interrupt to quit

select(6, [5], [], NULL, NULL

)          = ? ERESTARTNOHAND (To be restarted)

--- SIGCHLD (Child exited) @ 0 (0) ---

rt_sigreturn(0x11)                      = -1 EINTR (Interrupted system call)

wait4(3037, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 3037

exit_group(143)                         = ?

Process 3036 detached

产生僵尸进程之后,可以通过杀掉父进程把僵尸进程变成孤儿进程(父进程为init进程)

但是这里因为是用sudo启动的脚本,导致启动用户都是root,apps用户就没有权限杀掉启动的命令,进而导致子进程一直是僵尸进程的状态存在

  1. 来看一下zabbix agent端启动的相关进程情况
# ps -ef|grep zabbix

apps     27583     1  0 Sep09 ?        00:00:00 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

apps     27585 27583  0 Sep09 ?        00:33:25 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

apps     27586 27583  0 Sep09 ?        00:00:14 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

apps     27587 27583  0 Sep09 ?        00:00:14 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

apps     27588 27583  0 Sep09 ?        00:00:14 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

apps     27589 27583  0 Sep09 ?        02:28:12 /apps/svr/zabbix/sbin/zabbix_agentd -c /apps/conf/zabbix_agentd.conf

root     34207 31429  0 12:54 pts/0    00:00:00 grep zabbix

root     48430 27589  0 Oct21 ?        00:00:00 sudo /apps/sh/zabbix_scripts/hadoop/hadoop_stats.sh nodemanager StopContainerAvgTime

通过strace我们发现27589的进程一直在等待48430的进程

strace  -p 27589

Process 27589 attached - interrupt to quit

wait4(48430, ^C <unfinished ...>

Process 27589 detached

而48430的进程即为僵尸进程的父进程,通过strace attach上去,可以看到在等待#5的fd

#strace  -p 48430

Process 48430 attached - interrupt to quit

select(6, [5], [], NULL, NULL^C <unfinished ...>

Process 48430 detached

通过lsof可以看到#5的fd其实是一个socket

#lsof  -p 48430

COMMAND   PID USER   FD   TYPE             DEVICE  SIZE/OFF       NODE NAME

sudo    48430 root  cwd    DIR                8,2      4096          2 /

sudo    48430 root  rtd    DIR                8,2      4096          2 /

sudo    48430 root  txt    REG                8,2    212904    1578739 /usr/bin/sudo

sudo    48430 root  mem    REG                8,2     65928    1441822 /lib64/libnss_files-2.12.so

sudo    48430 root  mem    REG                8,2  99158704    1573509 /usr/lib/locale/locale-archive

sudo    48430 root  mem    REG                8,2     91096    1441832 /lib64/libz.so.1.2.3

sudo    48430 root  mem    REG                8,2    141576    1442145 /lib64/libpthread-2.12.so

sudo    48430 root  mem    REG                8,2    386040    1442172 /lib64/libfreebl3.so

sudo    48430 root  mem    REG                8,2    108728    1575924 /usr/lib64/libsasl2.so.2.0.23

sudo    48430 root  mem    REG                8,2    243064    1441896 /lib64/libnspr4.so

sudo    48430 root  mem    REG                8,2     21256    1442186 /lib64/libplc4.so

sudo    48430 root  mem    REG                8,2     17096    1442187 /lib64/libplds4.so

sudo    48430 root  mem    REG                8,2    128368    1577789 /usr/lib64/libnssutil3.so

sudo    48430 root  mem    REG                8,2   1290648    1582418 /usr/lib64/libnss3.so

sudo    48430 root  mem    REG                8,2    188072    1575925 /usr/lib64/libsmime3.so

sudo    48430 root  mem    REG                8,2    220200    1587191 /usr/lib64/libssl3.so

sudo    48430 root  mem    REG                8,2    113952    1442182 /lib64/libresolv-2.12.so

sudo    48430 root  mem    REG                8,2     43392    1442173 /lib64/libcrypt-2.12.so

sudo    48430 root  mem    REG                8,2     63304    1442180 /lib64/liblber-2.4.so.2.5.6

sudo    48430 root  mem    REG                8,2   1979000    1442169 /lib64/libc-2.12.so

sudo    48430 root  mem    REG                8,2    308912    1442181 /lib64/libldap-2.4.so.2.5.6

sudo    48430 root  mem    REG                8,2     22536    1442171 /lib64/libdl-2.12.so

sudo    48430 root  mem    REG                8,2     58480    1442174 /lib64/libpam.so.0.82.2

sudo    48430 root  mem    REG                8,2     17520    1441884 /lib64/libutil-2.12.so

sudo    48430 root  mem    REG                8,2    124624    1441798 /lib64/libselinux.so.1

sudo    48430 root  mem    REG                8,2     99112    1442170 /lib64/libaudit.so.1.0.0

sudo    48430 root  mem    REG                8,2    156872    1442168 /lib64/ld-2.12.so

sudo    48430 root    0r   CHR                1,3       0t0       3916 /dev/null

sudo    48430 root    1w  FIFO                0,8       0t0 1429910151 pipe

sudo    48430 root    2w   REG                8,3 376639626     524292 /apps/logs/zabbix/zabbix_agentd.log

sudo    48430 root    3u  sock                0,6       0t0 1429910161 can't identify protocol

sudo    48430 root    4r   REG                8,2       764    2240617 /etc/group

sudo    48430 root    5u  unix 0xffff880179ee4680       0t0 1429910162 socket

这里通过查看/proc/pid/fd下的文件描述符的状态,发现这个fd其实是已经关闭的。

这里就有可能是子进程已经运行完成,而父进程没有正确处理子进程的返回信息导致父进程一直认为子进程还在运行,最终产生了僵尸进程。

这其实是sudo的一个bug,相关的bug id :

http://www.gratisoft.us/bugzilla/show_bug.cgi?id=447

关于bug的描述:

If the parent process gets re-scheduled after the “if” was executed, and at this very 

time the child process finishes and SIGCHLD is sent to the parent process, sudo gets 

in trouble. The SIGCHLD handler accounts in the variable “recvsig[]” that the signal

 was received, and then the parent process calls select(). This select will never be 

 interrupted, as the author had it in mind. In 99% of the cases, the parent process 

 will enter in the select() blocking state before the child process ended. 

 The child would then send SIGCHLD, which will be accounted in the handler procedure, 

 and will also interrupt select() which will return -1 in “nready”, and “errno”

  will be set to EINTR.

问题出在sudo的代码sudo/file/tip/src/exec.c,小于 1.7.5或1.8.0 之前的版本都有问题,当子进程恰好在select()这个系统调用前退出的时候,句柄已经被退出,所以sudo会卡在select这里

patch:

http://www.sudo.ws/repos/sudo/rev/99adc5ea7f0a

Avoid a potential race condition if SIGCHLD is received immediately before we call select().

网上有人遇到了同样地问题:

http://blog.famzah.net/2010/11/01/sudo-hangs-and-leaves-the-executed-program-as-zombie/

回过头总结,这个问题其实是多个潜在问题同时造成:

  1. zabbix agent的自定义监控配置中使用了sudo,导致僵尸进程的父进程不能正常关闭(如果需要sudo,写在脚本里面即可)

  2. sudo的bug导致产生了僵死进程(升级sudo即可)

  3. zabbix agent端的实现也有问题,某一个进程成为僵死进程后会影响其他的监控项获取(zabbix agent的进程被阻塞导致)

36 现象:

zabbix的配置什么都没有改,突然见zabbix-server启动报错:

Can't open PID file /run/zabbix/zabbix_server.pid (yet?) after start: No such file or directory

解决办法
重启虚拟机

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_21127151/article/details/113578249

智能推荐

JVM内存配置及叙述-程序员宅基地

文章浏览阅读79次。2019独角兽企业重金招聘Python工程师标准>>> ..._目前只有server vm支持64bit jvm

RxSwift和Combine的相同点和使用例子_combine swift 响应式编程-程序员宅基地

文章浏览阅读516次。RxSwift 和 Combine 都是响应式编程框架,用于简化异步和基于事件的代码。它们有很多相似之处,主要体现在设计理念和编程模式上。_combine swift 响应式编程

HDU2660 Accepted Necklace【0-1背包】_hdu男生专场公开赛 accepted necklace-程序员宅基地

文章浏览阅读259次。Accepted NecklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5018 Accepted Submission(s): 1979Problem DescriptionI have N precious st..._hdu男生专场公开赛 accepted necklace

免安装版jdk的配置及使用(附绿色版jdk1.7及jdk1.8)_jdk1.8.0_151 64位免安装-程序员宅基地

文章浏览阅读8.8w次,点赞21次,收藏98次。绿色版jdk1.7下载地址:https://pan.baidu.com/s/12E3WGsIJBCUCJTTeC41m_g 密码:no4v绿色版jdk1.8下载地址:https://pan.baidu.com/s/1GnGmmnBuw9SG_USrYxNsNg 密码:rgok将下载好的绿色版jdk解压,然后通过配置系统环境变量指向该文件即可系统环境变量配置过程如下:右击我的电脑(计算机)——属性—..._jdk1.8.0_151 64位免安装

教程 | 使用WeBASE开发智能合约Java应用-程序员宅基地

文章浏览阅读3.3k次,点赞5次,收藏30次。区块链中间件平台WeBASE功能丰富、操作友好,备受社区关注。WeBASE也不断迭代优化,致力于为社区带来更好的开发体验。在 WeBASE 的合约IDE中,“Java项目导出”功能除了提供..._fisco webasefront 导出java项目使用

MATLAB2019b安装详细教程_matlab2019要求配置-程序员宅基地

文章浏览阅读2.9w次,点赞46次,收藏137次。MATLAB2019b安装详细教程 W10 64位Matlab是由美国MathWorks公司出品的著名数学软件,软件的功能性十分强大。其中,MATLAB/Simulink也被某些推文称之万物皆可仿的工具。近年来,自动代码生成在人工智能、深度学习和汽车行业的快速发展,Matlab也变得热度很高,在这里将详细介绍一下Matlab的详细安装步骤和注意点,仅供大家学习交流使用。安装要求和注意点1.安装全程须断网,安装前先关闭360等所有杀毒软件,防止误杀补丁,否则可能安装不成功;2.Matlab2019b适_matlab2019要求配置

随便推点

java中方法名,对象名,变量名,标识符,关键字的规则_java中对象名的命名规则-程序员宅基地

文章浏览阅读2.7k次。java中方法名,对象名,变量名,标识符,关键字的规则总绪方法名对象名变量名标识符关键字总绪所有命名规则必须遵循以下规则:1)、名称只能由字母、数字、下划线、$符号组成2)、不能以数字开头3)、名称不能使用JAVA中的关键字。4)、坚决不允许出现中文及拼音命名。还要注意以下:1、由于Java面向对象编程的特性, 在命名时应尽量选择名词2、驼峰命名法(Camel-Case): 当变量名或函式名是由一个或多个单字连结在一起,而构成的唯一识别字时,首字母以小写开头,每个单词首字母大写(第一个单词_java中对象名的命名规则

全国计算机等级考试三级数据库技术pdf,全国计算机等级考试三级数据库技术新大纲.pdf...-程序员宅基地

文章浏览阅读456次。全国计算机等级考试三级数据库技术新大全国计算机等级考试三级数据库技术新大纲纲全国计算机等级考试三级数据库技术新大纲全国计算机等级考试三级数据库技术新大纲◆ 基本要求◆ 基本要求1. 掌握计算机系统和计算机软件的基本概念、计算机网路的基1. 掌握计算机系统和计算机软件的基本概念、计算机网路的基本知识和应用知识、信息安全的基本概念。本知识和应用知识、信息安全的基本概念。2. 掌握数据结构与算..._计算机三级数据库技术电子版

环境光重要性采样_重要性采样 球面采样-程序员宅基地

文章浏览阅读758次。重要性采样概述计算积分需要利用蒙特卡洛方法去近似,蒙特卡洛方法我这里就不讲了,有兴趣的可以看看我的知乎:蒙特卡洛方法的简单总结 - 知乎重要性采样的目的就是加快收敛速度,所以选择pdf比较重要。所以对于环境光采样,我们需要知道环境光每个方向上的概率密度。环境光贴图环境光贴图能用整个球的所有方向去采样,球面方向能转成极坐标θ[0, π]和φ[0, 2π]表示,所以我们用经纬图(long_latitude_map)来做环境光贴图。维度可以用θ,经度用φ,例如地球仪的贴图展开:采样_重要性采样 球面采样

Kettle连接Oracle(Oracle19c&Oracle11g)-程序员宅基地

文章浏览阅读5.2k次,点赞4次,收藏8次。Kettle连接Oracle19c&Oracle11g_kettle连接oracle

WebDav-Milton之一_java webdav milton-程序员宅基地

文章浏览阅读1.6k次。这几篇主要介绍下Milton,一个用java实现了WebDav协议的开源软件,并且可以集成Spring(貌似是唯一一个实现WebDav协议支持Spring) 原文地址:http://milton.io/programs/milton/anno/anno1/pgetting-started-with-annotations.html (原文地址时不时的访问不了) 我的例子是在官网例子上修改的(主_java webdav milton

SpringBoot接收参数的三种方式,SpringBoot访问静态资源。_springboot接收路参-程序员宅基地

文章浏览阅读988次。接收:1、在路由处写好要参数2、参数列表用注解,如果路径上写的参数名称与函数接收的名称不一致可以使用value参数来与路径上的保持一致。_springboot接收路参

推荐文章

热门文章

相关标签