全部博文(534)
分类: LINUX
2012-09-23 13:44:51
问题1:
It appears as though you do not have permission to view information for any of the hosts you requested
临时解决:
sed -i 's/use_authentication=1/use_authentication=0/g' /usr/local/nagios/etc/cgi.cfg
(取消了认证 可以浏览主机状态 但是无法在 nagios web端 执行外部命令 )
解决:
登陆 nagios web接口的用户
需要和 /usr/local/nagios/etc/cgi.cfg 里面配置的用户匹配
没有可以手动添加 用逗号隔开
问题2:
Sorry Dave, I can't let you do that...
It seems that you have chosen to not use the authentication functionality of the CGIs.
I don't want to be personally responsible for what may happen as a result of allowing unauthorized users to issue commands to Nagios,so you'll have to disable this safeguard if you are really stubborn and want to invite trouble.
Read the section on CGI authentication in the HTML documentation to learn how you can enable authentication and why you should want to.
原因 : 未开启认证 开启认证可解决问题
编辑文件 /usr/local/nagios/etc/cgi.cfg
将 use_authentication 值设成1 (0/1 关闭/开启)
use_authentication=1
并重启 nagios
service nagios restart
问题3:
It appears as though you do not have permission to view information for any of the hosts you requested...
If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.
原因 : 认证用户不正确
开启认证 认证的用户必须是 cgi.cfg 配置文件里有的 默认是 nagiosadmin
如果你新建的其他用户 需要添加进去 多用户用逗号分开
authorized_for_system_information=nagiosadmin
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin
authorized_for_all_hosts=nagiosadmin
authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin
如果不是 nagiosadmin 需要到后面添加
例子 authorized_for_system_information=nagiosadmin,admin
问题4:
调用外部命令错误 可能权限不够
解决:
临时解决:
chown -R nagios.nagcmd /usr/local/nagios/var/rw
chmod -R 777 /usr/local/nagios/var/rw
为什么说临时解决 ? 因为重启nagios后 权限会还原 还是没权限执行
永久解决:
vi /etc/init.d/nagios 在start)部分加入
chmod -R 777 $NagiosVarDir/rw --启动nagios时设置权限
解决:
在安装 nagios 时 就要把用户选对 然后再安装
./configure --with-group=nagios --with-user=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include
make all
make install
make install-init
make install-config
make install-commandmode
===
rw agios.cmd 权限是 nagios.nagios
还需要把 web用户 加入到 nagios组里 这样才有权限执行 nagios.cmd
问题5: 3D浏览错误 提示下载 statuswrl.cgi
解决: 需安装3D浏览插件
原因是未安装支持vrml 3D浏览的插件
vrml 面向对象的三维造型语言 需要安装 vrml 支持插件才能浏览
Cortona VRML Client 是一个优秀的VRML浏览插件
问题6: 查看帮助文档时 无法看到图片
原因 url错误
图片源地址 http://nagios_ip/pub/images/reachability1.png
实际地址 /usr/local/nagios/share/docs/images/reachability1.png
解决
配置apache加入别名
Alias /pub "/usr/local/nagios/share/docs"
apachectl restart
重启apache 问题解决
问题7:check_oracle监控表空间
把nagios加入oracle的组中,usermod -G dba nagios
nagios用户有oracle用户拥有关于oracle的变量
cp /home/oracle/.bash_profile /home/nagios/.bash_profile
chown nagios.nagios /home/nagios/.bash_profile
确保nagios的安装目录及文件属于nagios用户
问题8:CHECK_NRPE: Error ? Could not complete SSL handshake
1. 确认check_nrpe 和 nrpe daemon的版本一定要一致。
2. 确认 check_nrpe和nrpe deamon端同时启用或者禁用ssl支持。
问题9:Error: NRPE daemon cannot be run as user/group root!
1. 修改nrpe.c文件,后在make,把nrpe考过去
cd nrpe-2.8.1/src
vi nrpe.c 注销下面4行
/* if(uid==0 || gid==0){
syslog(LOG_ERR,"Error: NRPE daemon cannot be run as user/group root!");
exit(STATE_CRITICAL);
}
*/
2.后在make,把nrpe考过去
make
cp nrpe /usr/local/nagios/bin
转自:
问题10:ndo2db-3x: Error: queue send error.(编辑sysctl.conf加入下面三行)
kernel.msgmni = 65536000 最大消息队列数
kernel.msgmax = 131072000 最大消息长度(字节数)
kernel.msgmnb = 131072000 消息队列中的最大字节数
清除消息队列脚本:
for i in `ipcs -q | grep nagios |awk '{print $2}'`; do ipcrm -q $i; done
问题11:centreon事件日志看不了,提示05:14|0|0|DB Error: no such table QUERY : DELETE FROM centreon_acl WHERE group_id NOT IN ('14')
google之,查到这是centreond ACL bug。解决办法是在nagios数据库中加一个centreon_acl表。
#mysql -u root -p
use nagios;
CREATE TABLE IF NOT EXISTS `centreon_acl` (
`id` int(11) NOT NULL auto_increment,
`host_name` varchar(255) default NULL,
`service_description` varchar(255) default NULL,
`group_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `host_name` (`host_name`),
KEY `service_description` (`service_description`),
KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
加上这个表后,一切恢复正常!
问题12: apache的error_log日志显示PHP Warning: date() 告警如下
[Sat Nov 03 19:16:10 2012] [error] [client 10.199.75.133] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/centreon/www/class/centreonGMT.class.php on line 138, referer:
vi /usr/local/php/etc/php.ini
找到date.timezone =
设置为date.timezone = Asia/Chongqing
问题13:安装centreon时提示PHP-POSIX未安装
安装:rpm -ivh php-process-5.3.3-3.el6_2.8.x86_64.rpm –nodeps
php -m | grep posix
posix
重启apache:/etc/init.d/httpd restart
再刷新即可通过
问题14:执行check_centreon_snmp_loadaverage等snmp命令是报如下错
[root@nagios libexec]# ./check_centreon_snmp_loadaverage
Can't locate Config/IniFiles.pm in @INC (@INC contains: /usr/local/nagios/libexec /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/centreon.pm line 51.
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/centreon.pm line 51.
Compilation failed in require at ./check_centreon_snmp_loadaverage line 50.
BEGIN failed--compilation aborted at ./check_centreon_snmp_loadaverage line 50.
安装三个包即可:perl-Config-IniFiles-2.56-1.el6.rf.noarch.rpm perl-Crypt-DES-2.05-3.2.el6.rf.x86_64.rpm perl-Net-SNMP-5.2.0-4.el6.noarch.rpm
问题15:ndo2db 提示 Could not open data sink! I'll keep trying, but some output may get los解决办法
在配置nagios 插件nagvis时,发现ndo2db没有正常存储数据,造成nagvis无法获取到nagios监控主机的数据。
将此过程记录下来,供自己和大家参考,省的今后忘了,也请大家多多指教,更正,也欢迎大家转载,写不写我的名字不重要哈。
通过google,发现主要集中在ndo2db配置和ndo的数据库上出了问题。
在sql上运行一下命令
mysql -uroot -p
mysql> grant all on nagios.* to 'nagios'@'localhost' identified by 'nagios';
mysql> flush privileges;
mysql> exit
sudo chmod 666 /usr/local/nagios/etc/ndo2db.cfg
sudo chmod 666 /usr/local/nagios/etc/ndomod.cfg
问题16:centreon页面工具ping成功,trace失败
替换了一下Traceroute.php文件后,倒是可以执行成功了,怀疑和pear包版本有关系
文件位置:/usr/share/pear/Net/Traceroute.php
替换前版本:Net_Traceroute 0.21
替换后版本:Net_Traceroute 0.21.3
包下载url:
问题17:apache的error_log日志提示timezone
日志如下:
[Sun Mar 31 04:08:26 2013] [error] [client 10.199.205.131] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.tim
ezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone
identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/centreon/www/class/centreonGMT.class.php on line 138, referer:
ain.php?p=20201&o=svc_critical&search=
解决办法:
php.ini,修改date.timezone = Asia/Chongqing,然后重启apache后解决
问题18:apache的error_log日志提示serviceXML.php的272行有错
Fri Apr 12 20:32:36 2013] [error] [client 10.199.205.42] PHP Notice: Undefined index: config_type in /usr/local/centreon/www/include/monitoring/status/Services/xml/ndo/serviceXML.php on line 272, referer: =
解决办法:
1、在269行中,将host改为service,如下
$ar_service_cache[$service['service_object_id'] . ":" . $service['config_type']] = $service;
2、将267行修改如下
$DBRESULT = $obj->DBNdo->query("SELECT ns.service_object_id as service_object_id, ns.notes as service_notes, ns.notes_url as service_notes_url, ns.action_url as service_action_url, ns.max_check_attempts as service_max_check_attempts, ns.icon_image as service_icon_image, ns.display_name as service_display_name, ns.config_type as config_type FROM " . $obj->ndoPrefix . "services as ns WHERE ns.service_object_id IN (" . implode(",", array_keys($ar_service_object_id)) . ")");
问题19:centreon中新添加服务,在页面中的状态信息和性能数据返回均正常,但无法显示图形
起因:后经确认是由于安全加固在/etc/profile文件中添加 umask 0027导致,新建服务后会生成对应的rrd文件,但rrd文件权限为640,centreon不可读,所以无法显示图形;
解决办法:1.去掉文件/etc/profile中添加的umask 0027
2.将已经生成的rrd文件属性设置为664,chmod 664 370.rrd
参考文档:
http://hackinglinuxexposed.blogspot.jp/2011/05/ndomod-could-not-open-data-sink-ill.html
截止到今天2012-5-21,这个问题还没有解决,估计需要恢复到以往的快照了,看看明天能不能解决这个问题。
蒸腾了一个晚上,还是没有解决,看了google很多关于ndo2db的文章,可就是没有办法解决,初步怀疑与版本有关系
平台相关信息:
ubuntu12.04
nagios V3.41
ndo2db:V1.50
如有时间,在ubuntu10.04上安装一下,这些日子要注意网站的更新啦。
2012-5-22
解决不了这个问题,我不甘心呀,恢复快照,从新开始安装。
今天上午,解决了这个问题,参考http://hi.baidu.com/hahale520/blog/item/e7e348c799d66d3b9d163d03.html,安装编译完成。
在原有的安装步骤上,增加了2个包,已记录。nnd。累死我了。可能是该死的两个包libmysql++-dev libmysqlclient-dev。
sudo apt-get install libmysql++-dev libmysqlclient-dev
转自:
nagios问题记录:http://youyizhimen.blog.163.com/blog/static/170917267201201745523276/