nagios项目部署文档 下载本文

setenforce 0 如果要永久性更变它,需要更改/etc/selinux/config里的设置并重启系统。 不关闭SELinux或是永久性变更它的方法是让CGI模块在SELinux下指定强制目标模式: chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ chcon -R -t httpd_sys_content_t /usr/local/nagios/share/ 关闭即可。 8.3. nagios3.2.0以后,安装nagios在访问http://ip/nagios时出现如下错误提示: 解决方法如下:nagios3.2.0将页面从之前的html换成了php,首次安装需要先决条件php yum install php即可 8.4. 出现pnp小太阳图标,点击报错如下: Initalising Using /usr/local/nagios/share/perfdata/ RRDTool /usr/bin/rrdtool found. RRDTool /usr/bin/rrdtool is executable PHP Function proc_open is enabled PHP Function fpassthru is enabled PHP Function xml_parser_create is enabled PHP zlib Support found. PHP GD Support can’t found. 解决方法: yum –y install php-gd # service httpd restart 再次点击小太阳图标时,出现如下页面,则表示正常: 8.5. 安装NAGIOS时发现有Status Map、Alert Histogram打不开链接,提示找不到statusmap.cgi和histogram.cgi. 解决办法: 原因一:因为gd-devel没有安装的问题,造成NAGIOS在编译时不生成这statusmap.cgi 原因二:NAGIOS在编译在前, gd-devel安装在后,造成不生成这statusmap.cgi 8.6. 后台apache日志报错如下: # tail -f /etc/httpd/logs/error_log [Fri Feb 18 19:07:18 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Fri Feb 18 19:07:18 2011] [notice] Digest: generating secret for digest authentication ... [Fri Feb 18 19:07:18 2011] [notice] Digest: done [Fri Feb 18 19:07:18 2011] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations [Fri Feb 18 19:07:20 2011] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/ [Fri Feb 18 19:07:42 2011] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/ [Fri Feb 18 19:07:55 2011] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/ 监控http服务出现响应超时的情况,如下所示: # /usr/local/nagios/libexec/check_http -I localhost -w 15 -c 20 -t 30 HTTP WARNING: HTTP/1.1 403 Forbidden - 5240 bytes in 0.003 second response time |time=0.002991s;15.000000;20.000000;0.000000 size=5240B;;;0 解决方法: # echo -n none > /var/www/html/index.html 8.7. 进行编译安装ndoutils-1.4b7时,报错如下: #./db/installdb -ucacti -pcacti -d cacti DBD::mysql::db do failed: Table 'cacti.nagios_dbversion' doesn't exist at ./db/installdb line 51. 命令使用错误,解决方法如下: # ./installdb -ucacti -pcacti -h localhost -d cacti //加上 –h localhost参数 DBD::mysql::db do failed: Table 'cacti.nagios_dbversion' doesn't exist at ./installdb line 51. ** Creating tables for version 1.4b7 Using mysql.sql for installation... ** Updating table nagios_dbversion Done! 8.8. 安装后,查看/usr/local/nagios/var/nagios.log日志,报错如下: #tail –f /usr/local/nagios/var/nagios.log [1298198680] Error: Could not safely copy module '/usr/local/nagios/bin/ndomod.o'. The module will not be loaded: No such file or directory [1298202280] Auto-save of retention data completed successfully. 原因为:前面安装ndoutils-1.4b7,少了一个操作步骤。解决办法如下: # mv /usr/local/nagios/bin/ndomod-3x.o /usr/local/nagios/bin/ndomod.o //新添加 正确的日志如下: # tail -f /usr/local/nagios/var/nagios.log [1298346735] Event broker module '/usr/local/nagios/bin/ndomod.o' deinitialized successfully. [1298346735] Nagios 3.2.1 starting... (PID=13489) [1298346735] Local time is Tue Feb 22 11:52:15 CST 2011 [1298346735] LOG VERSION: 2.0 [1298346735] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors [1298346735] ndomod: Successfully connected to data sink. 0 queued items to flush. [1298346735] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully. [1298350335] Auto-save of retention data completed successfully. [1298353935] Auto-save of retention data completed successfully. [1298357535] Auto-save of retention data completed successfully. 8.9. 有时开机后,后台报错如下: # tail -f /usr/local/nagios/var/nagios.log [1298439477] ndomod: Still unable to connect to data sink. 23512 items lost, 5000 queued items to flush. [1298439493] ndomod: Still unable to connect to data sink. 23590 items lost, 5000 queued items to flush. 以上报错一般是由于ndo2db没有启动,手动启动即可: #/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 启动ndo2db 8.10. 访问npc插件页面时,主机图标为红色叉号: 解决办法如下: # cp -r /usr/local/nagios/share/images/logos/logo.gif /var/www/html/cacti/plugins/npc/logo.gif 重新刷新页面即可解决问题。正常页面为: 8.11. 访问点击小太阳后,报错如下: Hostnane is not set:是pnp的提示,pnp需要以以下方式访问index.php?host=$HOSTNAME$&srv=$SERVICEDESC$ 或者index.php?host=$HOSTNAME; 而通过脚本推送时,变量发生了变化,生成的文件如下: #define_host define host { name host-pnp register 0 process_perf_data 1 action_url /nagios/pnp/index.php?host=nagios.com.cn$ 这样不正确的 action_url /nagios/pnp/index.php?host=$HOSTNAME$ //这是正确格式 } #define_service define service { name srv-pnp register 0 process_perf_data 1 action_url /nagios/pnp/index.php?host=nagios.com.cn$&srv=$ 这样是不正确的 action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$ //正确格式 }