首先要安装apache。要启用cgi模块。
一、下载最新的软件包nagios-3.0.tar.gz
wget
tar zxvf nagios-3.0.tar.gz
cd nagios-3.0
mkdir /usr/local/nagios
useradd -s /sbin/nologin nagios
chown nagios.nagios /usr/local/nagios
./configure --prefix=/usr/local/nagios
make
make install
make install-init
make install-commandmode
make install-config
二、安装nagios-plugs
wget
tar zxvf nagios-plugins-1.4.11.tar.gz
cd nagios-plugs-1.4.11
./configure --prefix=/usr/local/nagios
make
make install
vi /usr/local/apache/conf/httpd.conf
添加:
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/passwd
Require valid-user
Alias /nagios /usr/local/nagios/share
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/passwd
Require valid-user
##############################
htpasswd -c /usr/local/nagios/etc/passwd nagiosadmin
/usr/local/apache/bin/apachectl restart
/etc/init.d/nagios start
就可以访问到默认的监控本机的服务了。接下来就可以装其他的插件了,休息一下再来。
三、安装nrpe
wget
tar xzf nrpe-2.8.tar.gz
cd nrpe-2.8
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.
only_from = 127.0.0.1
Add the following entry for the NRPE daemon to the /etc/services file.
nrpe 5666/tcp # NRPE
Restart the xinetd service.
vi /etc/services
增加:
nrpe 5666/tcp #nrpe
service xinetd restart
netstat -at | grep nrpe
The output out this command should show something like this:
tcp 0 0 *:nrpe *:* LISTEN
然后修改防火墙的规则:
iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT
service iptables save
vi /usr/local/nagios/etc/nrpe.cfg
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_hda1
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_total_procs
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_zombie_procs
阅读(1156) | 评论(0) | 转发(0) |