这几天为了作监控在ubuntu服务器上部署了zabbix作监控。过程仍是遇到了一些问题,把他记录下来。但愿对你们有帮助吧。原文来源:http://www.jincon.com/archives/169/php
这里千万记住,zabbix 不建议用最新版本,唉~~~~找个稍微次级版本便可。json
此次安装过程过程出现了报错:ubuntu
zabbix红色弹出报错:zabbix server is not running: the information displayed may not be current jincon服务器
网页中不停地有如下红色提示:session
zabbix server is not running: the information displayed may not be current.socket
zabbix server is running | No.函数
查看/tmp/zabbix_server.log和/tmp/zabbix_agent.log无任何异常。看zabbix_server和zabbix_agent进程、端口都正常post
从网上查找了不少的资料,众说纷纭,浪费了我大量的时间。this
后来仍是决定从zabbix的php文件着手,毕竟弹出是zabbix的php系统里面的嘛。.net
系统会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函数就能够了。
原文来源:http://www.jincon.com/archives/169/ 转载请注明出处哈。。。