這幾天爲了做監控在ubuntu服務器上部署了zabbix做監控。過程還是遇到了一些問題,把他記錄下來。希望對大家有幫助吧。原文來源:http://www.jincon.com/archives/169/
這裏千萬記住,zabbix 不建議用最新版本,唉~~~~找個稍微次級版本即可。
這次安裝過程過程出現了報錯:
zabbix紅色彈出報錯:zabbix server is not running: the information displayed may not be current jincon
網頁中不停地有以下紅色提示:
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行開始:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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/ 轉載請註明出處哈。。。