nagios的初级安装
为了安装好nagios这个开源软件,我花费了不少的时间,为了避免错误的再次发生,少走弯路,我觉的有写这篇文章的必要性我用的是redhat enterprise 5.3版本,nagios这软件可以从www.nagios.com中下载,我的目的是为了装好,没写的深入的配置。
我参考的nagios官方文档
所选择的包是nagios-3.2.0.tar.gz和插件nagios-plugins-1.4.14
建立nagios用户
useradd nagios
建立nagcmd组
groupadd nagcmd
建立从属组
usermod -G nagcmd nagios
usermod -G nagcmd apache
建立/usr/local/nagios
mkdir /usr/local/nagios
解压nagios-3.2.0.tar.gz,
tar -zxvf nagios-3.2.0.tar.gz
进入nagios-3.2.0文件,执行
./configure --prefix=/usr/local/nagios
make all
make install
make install-init
make install-config
make install-commandmode
解压nagios-plugins-1.4.14.tar.gz
tar -zxvf nagios-plugins-1.4.14.tar.gz
进入 nagios-plugins文件,执行
./configure --prefix=/usr/local/nagios
make all
make install
加入服务,开启服务
chkconfig --add nagios
chkconfig nagios on
service nagios restart
安装apache,yum install httpd* -y(我这有Yum仓库)
chkconfig httpd on
service httpd restart
进入配置文件,vim /etc/httpd/conf/httpd.conf
再最后面添加
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
![](../p_w_upload/200910/200910231256268840554.jpg)
添加用户 htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios
再在/usr/local/nagiso/etc/cgi.cfg添加需要验证的用户,这里是nagios
使用/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg检测配置文件的正确性。
再次重启service httpd restart
service nagios restart
关闭selinux属性
setenforce 0
最后,在自己的火狐浏览器上输入
172.24.0.6/nagios/index.php(我的IP地址是172.24.0.6)
就可以出现自己想要的那界面,如上面那图
不好意思,第一次写博客,写的烂,以后再慢慢更正。
转载于:https://blog.51cto.com/168536/215441