zabbix监控报错zabbix server is not running解决方法

这几天为了做监控在ubuntu服务器上部署了zabbix做监控。过程还是遇到了一些问题,把他记录下来。希望对大家有帮助吧。原文来源:http://www.jincon.com/archives/169/

这里千万记住,zabbix 不建议用最新版本,唉~~~~找个稍微次级版本即可。

这次安装过程过程出现了报错:

zabbix红色弹出报错:zabbix server is not running: the information displayed may not be current        jincon

 

142243844.jpg - 大小: 44.37 KB - 尺寸: 700 x 264 - 点击打开新窗口浏览全图

 

网页中不停地有以下红色提示:

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

zabbix server is running | No.

查看/tmp/zabbix_server.log和/tmp/zabbix_agent.log无任何异常。看zabbix_server和zabbix_agent进程、端口都正常

 

从网上查找了很多的资料,众说纷纭,浪费了我大量的时间。

查找问题:

后来还是决定从zabbix的php文件着手,毕竟弹出是zabbix的php系统里面的嘛。

系统会post数据到:zabbix/jsrpc.php?output=json-rpc

返回json数据。代码约在164行开始:

 

case 'zabbix.status':
$session = Z::getInstance()->getSession();
if (!isset($session['serverCheckResult']) || ($session['serverCheckTime'] 
+ SERVER_CHECK_INTERVAL) <= time()) {
	$zabbixServer = new CZabbixServer($ZBX_SERVER, $ZBX_SERVER_PORT, 
ZBX_SOCKET_TIMEOUT, 0);
	$session['serverCheckResult'] = $zabbixServer->isRunning();
	$session['serverCheckTime'] = time();
}
#http://www.jincon.com
$result = array(
	'result' => (bool) $session['serverCheckResult'],
	'message' => $session['serverCheckResult'] ? '' : _('Zabbix server is not 
running: the information displayed may not be current.')
);
break;

 

  

 

是的,就这里,首先实例化类:CZabbixServer,然后执行里面的方法:isRunning();

继续跟踪到文件是在:

zabbix/include/classes/server/CZabbixServer.php

最后跟踪方法是在 connect 执行了,

问题出在268行:

            if (!$socket = @fsockopen($this->host, $this->port, $errorCode, $errorMsg, $this->timeout)) {

是的,就在这里,fsockopen为空了。

怎么会为空呢,突然想到是不是被禁用了,phpinfo看了下果然。

 

当然问题找到了,就简单了,解决方法就是:

开启fsockopen函数就可以了。

 

111.jpg - 大小: 61.74 KB - 尺寸: 634 x 330 - 点击打开新窗口浏览全图

原文来源:http://www.jincon.com/archives/169/    转载请注明出处哈。。。

转载于:https://www.cnblogs.com/jincon/p/3755996.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值