tjd0 2013-08-07
cd gd-2.0.35&&./configure --prefix=/usr/local/gd && make && make install cd nagios-3.5.0 && ./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/local/gd/lib/ --with-gd-inc=/usr/local/gd/include/ && make all && make install
cd nagios-plugins-1.4.16 && ./configure && make && make install cd nrpe-2.14 && ./configure && make && make install
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin" #配置http请求相对路径与cgi存储的位置 <Directory "/usr/local/nagios/sbin"> # SSLRequireSSL Options ExecCGI AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory> #以下的配置是用于执行php文件 Alias /nagios "/usr/local/nagios/share" #配置http请求相对路径nagios与php存储的目录 <Directory "/usr/local/nagios/share"> # SSLRequireSSL Options None AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 AuthName "Nagios Access" AuthType Basic AuthUserFile /usr/local/nagios/etc/htpasswd.users Require valid-user </Directory>
在发现http请求cgi文件时发现有Internal Server Error错误时,说明是你的linux的安全没有放开。请关闭SELinux防火墙。或者执行如下命令使相应目录不受防火墙控制。
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
通过nape检测命令,检服务的可用性,例如 :可以运行如下命令
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
define host{
use linux-server
host_name compute-36-03.local
alias compute-36-03
address 192.168.35.101
}
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define service{
use local-service ; Name of service template to use
host_name compute-36-03.local
service_description Current NRPE check Load
check_command check_nrpe!check_load
}