原文链接: http://hi.baidu.com/liuchangwengo/item/c837b5681c6cbb92c4d2492b
1.环境搭建(centos\redhat 和 ubuntu)
yum install -y wget httpd phpgcc glibc glibc-common gd gd-devel make net-snmp
(For Ubuntu users:
sudo apt-get install wgetinstall build-essential apache2 php5-gd wget libgd2-xpm libgd2-xpm-dev
libapache2-mod-php5)
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
2.软件包下载:
cd /tmp
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
wgethttp://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
3.两个软件包的安装
tar zxvf nagios-3.4.1.tar.gz
tar zxvfnagios-plugins-1.4.15.tar.gz
cd nagios
For RHEL/CentOS users:
./configure--with-command-group=nagcmd
For Ubuntu users:
./configure--with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail
Allsystems:
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cp -R contrib/eventhandlers//usr/local/nagios/libexec/
chown -R nagios:nagios/usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios-v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios start
For RHEL/CentOS users:
/etc/init.d/httpd start
htpasswd –c/usr/local/nagios/etc/htpasswd.users nagiosadmin
cd /tmp/nagios-plugins-1.4.15
./configure--with-nagios-user=nagios --with-nagios-group=nagios
make
make install
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on
For Ubuntu:
ln -s /etc/init.d/nagios/etc/rcS.d/S99nagios
http://<your.nagios.server.ip>/nagios
联入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/