6.安装nagios
1.建立nagios安装需要的用户和组:
/usr/sbin/useradd -m nagios
/usr/sbin/useradd apache -M -s /sbin/nologin
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
2.编译安装nagios
tar zxvf nagios-3.2.0.tar.gz
cd nagios-3.2.0
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
#注:make install-webconf指定了登入nagios的web界面用的用户审核界面,指定的文件在/etc/httpd/conf.d/nagios.conf,里面的内容指定了审核文件的位置:
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make && make install
5.安装nagios的中文汉化插件:
tar xvfj nagios-cn-3.2.0.tar.bz2
cd nagios-cn-3.2.0
./configure
make all
make install
这样nagios的web界面就是是中文了!!
6.设置apache的配置文件
vi /etc/httpd/conf/httpd.conf +231 //查看是否为apache用户
vi /etc/httpd/conf/httpd.conf +265 //在下面添加ServerName 127.0.0.1:80
然后找到
DirectoryIndex index.html index.html.var
修改为
DirectoryIndex index.html index.php
接着增加如下内容:
AddType application/x-httpd-php .php
7.启动apache服务器
service httpd start
8.配置nagios的配置文件:
#添加监控报警接收邮件
vi /usr/local/nagios/etc/objects/contacts.cfg +35
把nagios@localhost改成自己的邮箱fantefei@163.com