1.检查是否有下列包
rpm -qa | grep httpd
rpm -qa | grep gcc
rpm -qa | grep glibc
rpm -qa | grep glibc-common
rpm -qa | grep gd-devel
rpm -qa | grep gd
2.建立用户和组
su root
useradd -m nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
3.下载安装包
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
4.安装nagios
tar -xzvf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
5.更改简单信息
vi /usr/local/nagios/etc/objects/contacts.cfg
更改nagiosadmin的email
6.安装web界面
make install-webconf 为了安装nagios配置
这个将配置文件放到/etc/httpd/conf.d/nagios.conf处,将其中的内容拷到/usr/local/apache/conf/httpd.conf中
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin # apache basic auth
service httpd restart
7.安装nagios插件
tar -xzvf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
make
make install
8.检查配置文件
chkconfig --add nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
9.
http://localhost/nagios/