Nagios4.0.8 详细安装配置

为百度知道的更多,我记录下我与网络上讲述的不一样的地方,标上注意点

为新手多点资料,一些小细节烦死人

1.下载nagios-4.0.8.tar.gz  和  nagios-plugins-2.0.tar.gz

wget http://jaist.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz

wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz


2.安装一批组件,差不多配置ganglia时都安装

我也是不太清楚 ,全给装上再说

yum install gd gd-devel --当然你要安装的更多,我的机器能装的都装上了,去度娘


3.这里网络上都创建nagios的用户及用户组,我使用的是 apache:apache,就没有创建了,命令如下

useradd nagios

groupadd nagios

usermod -G nagios nagios  --第一个nagios是用户组,第二个是用户

或者你如果需要的话,把apache用户也追加到 nagios 用户组   usermod -a -G nagios apache


4.安装nagios

tar -zxvf  nagios-4.0.8.tar.gz -C  /usr/local/nagios/

mv /usr/local/nagios/nagios-4.0.8 /usr/local/nagios/nagios

进入解压目录 cd /usr/local/nagios/nagios

.

   ./configure --perfix=/usr/local/nagios/nagios --with-command-group=apache --with-nagios-group=apache

   make && make install 

   make install-init  

   make install-config 

   make install-commandmode 

   make install-webconf 

   cp -R contrib/eventhandlers/ /usr/local/nagios/nagios/libexec/

   chown -R apache:apache /usr/local/nagios/nagios/libexec/eventhandlers

   /usr/local/nagios/nagios/bin/nagios -v /usr/local/nagios/nagios/etc/nagios.cfg

   service nagios start

5.配置web登陆账号和密码

htpasswd -c /usr/local/nagios/nagios/etc/htpasswd.users admin --注意这里有个 .user  不能忘了,


6.配置httpd

ScriptAlias /nagios/cgi-bin “/usr/local/nagios/nagios/sbin” 
<Directory “/usr/local/nagios/sbin”> 
     AuthType Basic 
     Options ExecCGI 
     AllowOverride None 
     Order allow,deny 
     Allow from all 
     AuthName “Nagios Access” 
     AuthUserFile /usr/local/nagios/nagios/etc/htpasswd.users             //用于此目录访问身份验证的文件 
     Require valid-user 
</Directory> 


Alias /nagios “/usr/local/nagios/nagios/share” 
<Directory “/usr/local/nagios/share”> 
     AuthType Basic 
     Options None 
     AllowOverride None 
     Order allow,deny 
     Allow from all 
     AuthName “nagios Access” 
     AuthUserFile /usr/local/nagios/nagios/etc/htpasswd.users
     Require valid-user 
</Directory>


7.安装nagios-plugins

   tar -zxvf nagios-plugins-2.0.tar.gz  -C /usr/local/nagios/

   cd nagios-plugins-2.0

   ./configure --prefix=/usr/local/nagios/nagios --with-nagios-user=apache --with-nagios-group=apache

   make && make install

8.设置开机启动

   chkconfig --add nagios

   chkconfig  nagios on

   service nagios start

   chkconfig --add httpd --注意这里如果你还没有装过httpd 你这个还需单独弄下

   chkconfig  httpd on

   service httpd start

9.关闭selinux和iptables

setenforce 0

service iptables stop

刚玩这个,关闭最好省事,

10.访问host/nagios   或者  IP/nagios

nagios截图

总结:在linux下玩技术,log文件很大程度上帮助解决问题

apache日志:大部分情况下,大家都是用yum安装,log位置一般在  /var/log/httpd 位置下,error_log

只是简单记录下Nagios的安装,慢慢的用到在记录

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章