Nagvis 中的 PHP 错误 / Mk-livestatus

Nagvis 中的 PHP 错误 / Mk-livestatus

我通过 Debian 软件包安装了 Nagios 和 Nagvis,但当我运行 Nagvis 并尝试进入“常规配置”菜单时,出现了此错误

Error: (0) Array to string conversion (/usr/share/nagvis/share/server/core/classes/WuiViewEditMainCfg.php:126)

#0 /usr/share/nagvis/share/server/core/classes/WuiViewEditMainCfg.php(126): nagvisExceptionErrorHandler(8, 'Array to string...', '/usr/share/nagv...', 126, Array)
#1 /usr/share/nagvis/share/server/core/classes/WuiViewEditMainCfg.php(44): WuiViewEditMainCfg->getFields()
#2 /usr/share/nagvis/share/server/core/classes/CoreModMainCfg.php(56): WuiViewEditMainCfg->parse()
#3 /usr/share/nagvis/share/server/core/functions/index.php(120): CoreModMainCfg->handleAction()
#4 /usr/share/nagvis/share/server/core/ajax_handler.php(63): require('/usr/share/nagv...')
#5 {main}

我在 Nagvis 的后端也遇到了问题。check-mk-livestatus 已安装,但将鼠标悬停在项目上时出现此错误:

Problem (backend: live_1): Unable to connect to the /var/lib/nagios3/rw/live in backend live_1: Connection refused

或者尝试添加内容时:

Unable to fetch data from backend - falling back to input field.

/var/lib/nagios3/rw/ 存在,但没有“实时”文件。我真的不知道发生了什么,尤其是因为这些都是 Debian 软件包……这是 nagvis.ini.php 中最相关的部分:

; ----------------------------
; Backend definitions
; ----------------------------

; Example definition of a livestatus backend.
; In this case the backend_id is live_1
; The path /usr/local/nagios/var/rw has to exist
[backend_live_1]
backendtype="mklivestatus"
; The status host can be used to prevent annoying timeouts when a backend is not
; reachable. This is only useful in multi backend setups.
;
; It works as follows: The assumption is that there is a "local" backend which
; monitors the host of the "remote" backend. When the remote backend host is
; reported as UP the backend is queried as normal.
; When the remote backend host is reported as "DOWN" or "UNREACHABLE" NagVis won't
; try to connect to the backend anymore until the backend host gets available again.
;
; The statushost needs to be given in the following format:
;   "<backend_id>:<hostname>" -> e.g. "live_2:nagios"
;statushost=""
socket="unix:/var/lib/nagios3/rw/live"

/var/log/nagios3/nagios.log 中没有任何与“后端”或“mklivestatus”相关的内容。如能得到任何帮助,我们将不胜感激

答案1

Nagvis 的问题在于已知错误,这个问题显然已在上游得到修复。

rw 目录中套接字的问题可能是权限问题,该问题在 /usr/share/doc/nagios3/README.Debian 中有详细记录。

答案2

我知道这可能有点晚了,我也遇到了同样的问题。像这样修复它:

cd ~/source
wget wget http://mathias-kettner.com/download/mk-livestatus-1.2.4p2.tar.gz
tar zxvf mk-livestatus-1.2.4p2.tar.gz
cd mk-livestatus-1.2.4p2/
./configure --with-nagios4      (Or nagios3)
make install
vi /usr/local/nagios/etc/nagios.cfg

添加:

broker_module=/usr/local/lib/mk-livestatus/livestatus.o /usr/local/nagios/var/rw/live
event_broker_options=-1

在下面:

#broker_module=/somewhere/module1.o
#broker_module=/somewhere/module2.o arg1 arg2=3 debug=0

chown -R nagios:nagcmd /usr/local/nagios/var/rw
service nagios restart

相关内容