- 论坛徽章:
- 0
|
安装环境:fedora 2
作者:jiecho
Email:jiecho#eyou.com
一、安装
1.1安装apache,有方便就用方便的,不用满世界找rpm包。
[root@test src]# yum install httpd
1.2安装nagios
[root@test src]# wget http://umn.dl.sourceforge.net/sourceforge/nagios/nagios-2.0b3.tar.gz
[root@test src]# adduser nagios
[root@test src]# tar -zxvf nagios-2.0b3.tar.gz
[root@test src]# cd nagios-2.0b3
[root@test nagios-2.0b3]#./configure --with-cgiurl=/cgi-bin --with-htmurl=nagios --with-nagios-user=nagios --with-nagios-group=nagios
[root@test nagios-2.0b3]# make all
[root@test nagios-2.0b3]# make install
[root@test nagios-2.0b3]# make install-init
1.3安装nagios的Official Plugins
[root@test src]# wget http://umn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.tar.gz
[root@test src]# tar -zxvf nagios-plugins-1.4.tar.gz
[root@test src]# cd nagios-plugins-1.4
[root@test nagios-plugins-1.4]# ./configure
[root@test nagios-plugins-1.4]# make
[root@test nagios-plugins-1.4]# make install
至此,nagios安装完成,下面的工作就是需要配置了。
二、配置
2.1配置apache
修改httpd.conf,添加如下两行:
ScriptAlias /cgi-bin/ "/usr/local/nagios/sbin/"
Alias /nagios/ "/usr/local/nagios/share/"
2.2配置nagios
2.2.1拷贝/usr/local/nagios/etc下所有example文件为cfg文件
[root@test etc]#cp nagios.cfg-sample nagios.cfg
其余也一样
2.2.2修改minimal.cfg,把里面所有定义command的全部注释掉
2.2.3修改cgi.cfg
修改use_authentication=1为use_authentication=0,即不用验证.
三、启动nagios
3.1启动apache
[root@test src] /etc/rc.d/init.d/httpd start
3.2测试nagios
[root@test src] /usr/local/nagios/bin/nagios -v/usr/local/nagios/etc/nagios.cfg
如果没有错误,启动nagio
[root@test src] /etc/rc.d/init.d/nagios start
可以在浏览器里看一下效果:
http://192.168.0.30/nagios
四、添加主机、服务于联系人等
为了方便,分别把主机、服务于联系人等放在单独的文件里面,当然也可以放在一个文件里,修改nagios.cfg文件,把下面的行取消注释:
#cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
#cfg_file=/usr/local/nagios/etc/dependencies.cfg
#cfg_file=/usr/local/nagios/etc/escalations.cfg
#cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
#cfg_file=/usr/local/nagios/etc/timeperiods.cfg
修改什么可以根据自己的需要参照sample进行修改,然后就可以用nagios监控你的网络了,如果遇到host或者service down,nagios会给你发信告诉你,很方便吧 |
|