网络上有好多安装方法,我仅记录自己安装后的问题
1,网页打不开
service iptables stop 关闭防火墙
或者 vi /etc/sysconfig/iptables
添加此条目 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 开通80口
vi /etc/httpd/conf/httpd.conf
<IfModule dir_module>
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php
</IfModule> 这两个很重要 ,我两次安装,都打错字!!
后追加
#Setting for nagios
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
Alias /nagios /usr/local/nagios/share
<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
2,权限问题打不开
vi /etc/selinux/config
SELINUX=disabled
3,检查所有配置文件的正确性
/usr/local/nagios/bin/nagios-v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
都是0,很明显,没问题。如果有问题,请仔细查看报错项目
4,出问题,看日志
cat /usr/local/apache2/logs/error_log
不急不躁,方能成功
5,如果commands.cfg报错 后追加
# ‘notify-host-by-email’ command definition
define command{
command_name host-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /bin/mail -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
}
# ’service_notification_commands’ command definition
define command{
command_name service-notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$” | /bin/mail -s “** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
6./usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl: line 94: lynx: command not found
#yum install lynx -y