nagios安装配置问题汇总

7.更改SELinux设置

Fedora与SELinux(安全增强型Linux)同步发行与安装后将默认使用强制模式。这会在你尝试入Nagios的CGI时导致一个"内部服务错误"消息。
如果是SELinux处于强制安全模式时需要做getenforce 令SELinux处于容许模式
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/

13.1.防火墙配置
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT(apache端口)
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
13.2.cannot find ssl libraries

CHECK_NRPE: Error – Could not complete SSL handshake 错误解决

nagios安装配置问题汇总 - herb - herb
 
13.3 Not have perimission
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.
1、修改/etc/cgi.cfg
vi    /usr/local/nagios/etc/cgi.cfg

use_authentication=1 #把1修改为0, 保存
[email=root@nagios#/service]root@nagios#/service[/email] nagios restart
13.4 Connection refused by host
[root@localhost nrpe-2.8.1]# /usr/local/nagios/libexec/check_nrpe -H localhost
Connection refused by host

vi /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1, 添加监控主机地址 以“,”间隔

vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1增加监控主机的地址,以空格间隔


[root@localhost etc]# service nagios start
Starting nagios:touch: 无法触碰 “/usr/local/nagios/var/nagios.log”: 权限不够
done.
[root@localhost etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL

Error: Cannot open main configuration file '/usr/local/nagios/etc/?v' for reading!
Warning: Cannot open log file '/usr/local/nagios/var/nagios.log' for writing
Nagios 3.0.6 starting... (PID=17055)
Warning: Cannot open log file '/usr/local/nagios/var/nagios.log' for writing
Local time is Tue Jun 07 06:31:56 CST 2011
Warning: Cannot open log file '/usr/local/nagios/var/nagios.log' for writing
Warning: Cannot open log file '/usr/local/nagios/var/nagios.log' for writing
Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=17055)
解决办法
chown nagios.nagios /usr/local/nagios
chown ‐R nagios.nagios /usr/local/nagios/libexec

[root@localhost local]# service httpd restart
停止 httpd: [确定]
启动 httpd:[Tue Jun 07 09:18:48 2011] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 1008 will probably never match because it overlaps an earlier Alias.
[Tue Jun 07 09:18:48 2011] [warn] The ScriptAlias directive in /etc/httpd/conf/httpd.conf at line 1025 will probably never match because it overlaps an earlier ScriptAlias.

it seems everything in conf.d is already included so uncommenting this line causes the nagios.conf file to be included twice. Once i fixed the mistake and restarted apache things were fine.
[root@localhost local]# vi /etc/httpd/conf.d/nagios.conf
#ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
#Alias /nagios "/usr/local/nagios/share"

[root@localhost nrpe-2.12]# ./configure -prefix=/usr/local/nagios/
*** Generating DH Parameters for SSL/TLS ***
Generating DH parameters, 512 bit long safe prime, generator 2
This is going to take a long time
.........................+......................................................+.................+.......................................+..++*++*++*++*++*++*
checking for Kerberos include files... could not find include files
checking for perl... /usr/bin/perl
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating subst
config.status: creating include/config.h


[root@localhost ~]# /usr/local/nrpe/libexec/check_nrpe -H localhost
Connection refused by host
[root@localhost ~]# vi /usr/local/nrpe/etc/nrpe.cfg
#server_address=127.0.0.1(保持默认)

Error: Check period 'service' specified for service 'CPU' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'DISK' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'MEM' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'USERS' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'hqfw_10001' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'hqfw_10002' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'mobihq_pro' on host 'EQ-mobihq-mobiwt13' is not defined anywhere!
Error: Check period 'service' specified for service 'CPU' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'DISK' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'MEM' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'USERS' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'hqfw_10001' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'hqfw_10002' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
Error: Check period 'service' specified for service 'mobihq_pro' on host 'EQ-mobihq-mobiwt14' is not defined anywhere!
[root@localhost objects]# vi /usr/local/nagios/etc/objects
define timeperiod{
timeperiod_name service (时间与service.cfg设置保持一致)
alias 24x7 Sans Holidays

use us-holidays ; Get holiday exceptions from other timeperiod

sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值