Cacti+Nagios整合安装部署-新版
- 格式:doc
- 大小:851.00 KB
- 文档页数:24
Nagios简介铁锤居士作品Nagios功能非常强大,它可以监控服务和主机,但是他自身并不包括这部分功能的代码,所有的监控、检测功能都是有插件来完成的。
再说报警功能,如果监控系统发现问题不能报警那就没有意义了,所以报警也是nagios很重要的功能之一。
但是,同样的,nagios 自身也没有报警部分的代码,甚至没有插件,而是交给用户或者其他相关开源项目组去完成。
nagios安装,是指基本平台,也就是nagios软件包的安装。
它是监控体系的框架,也是所有监控的基础。
打开nagios官方的文档,会发现nagios基本上没有什么依赖包,只要求系统是linux或者其他nagios支持的系统。
不过如果你没有安装apache(http服务),那么你就没有那么直观的界面来查看监控信息了,所以apache姑且算是一个前提条件。
Nagios 系统的特点主要有下面几点:∙监控主机资源和网络服务∙允许用户通过设计实现简单的插件来监控自己特定的服务∙当被监控对象出现问题时,会及时通知管理人员∙事先定义事件处理程序,当对象出现问题时自动调用对应的处理程序∙通过 web 页面来监视对象状态,警告提示和日志文件。
需要安装软件列表:php-devel-5.1.6-23.2.el5_3.i386.rpmphp-json-ext-1.2.1.tar.bz2cacti-plugin-0.8.7e-PA-v2.6.zipnagios-3.2.1.tar.gznagios-plugins-1.4.14ndoutils-1.4b9.tar.gznpc-2.0.4.tar.gzNagios安装/projects/nagios/files/[root@cacti-qmail soft]# wget/project/nagios/nagios-3.x/nagios-3.2.1/nagios-3.2 .1.tar.gz[root@cacti-qmail soft]# tar -zxvf nagios-3.2.1.tar.gz[root@cacti-qmail soft]#cd nagios-3.2.1[root@cacti-qmail nagios-3.2.1]# ./configure --prefix=/usr/local/nagios[root@cacti-qmail nagios-3.2.1]#make all输入make all 得到下面具体信息==============================================================*** Compile finished ***If the main program and CGIs compiled without any errors, you can continue with installing Nagios as follows (type 'make' without any arguments for a list of all possible options):make install- This installs the main program, CGIs, and HTML files使用make install来安装主程序,CGI和HTML文件make install-init- This installs the init script in /etc/rc.d/init.d使用make install-init在/etc/rc.d/init.d安装启动脚本make install-commandmode- This installs and configures permissions on thedirectory for holding the external command file使用make install-commandmode来配置目录权限make install-config- This installs *SAMPLE* config files in /usr/local/nagios/etcYou'll have to modify these sample files before you canuse Nagios. Read the HTML documentation for more infoon doing this. Pay particular attention to the docs onobject configuration files, as they determine what/howthings get monitored!使用make install-commandmode来安装示例配置文件,安装的路径是/usr/local/nagios/etcmake install-webconf- This installs the Apache config file for the Nagiosweb interface使用make install-webconf来安装apache的配置文件=================================================================make install在安装这个动作之前要增加一个nagios用户,并修改它的权限,不然会出现以下错误:=================================================================cd ./base && make installmake[1]: Entering directory `/home/yahoon/nagios/nagios-2.9/base'make install-basicmake[2]: Entering directory `/home/yahoon/nagios/nagios-2.9/base'/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin /usr/bin/install: invalid user `nagios' 非法用户nagiosmake[2]: *** [install-basic] Error 1make[2]: Leaving directory `/home/yahoon/nagios/nagios-2.9/base'make[1]: *** [install] Error 2make[1]: Leaving directory `/home/yahoon/nagios/nagios-2.9/base' make: *** [install] Error 2=====================================================================[root@cacti-qmail nagios-3.2.1]# useradd nagios[root@cacti-qmail nagios-3.2.1]#mkdir /usr/local/nagios[root@cacti-qmail nagios-3.2.1]#chown nagios.nagios /usr/local/nagios [root@cacti-qmail nagios-3.2.1]#make all[root@cacti-qmail nagios-3.2.1]#make install; make install-init;make install-commandmode;make install-config;make install-webconf验证程序是否被正确安装切换目录到安装路径(这里是/usr/local/nagios),看是否存在 etc、bin、 sbin、 share、var这五个目录,如果存在则可以表明程序被正确的安装到系统了。
后表是五个目录功能的简要说明:bin Nagios执行程序所在目录,nagios文件即为主程序etc Nagios配置文件位置,初始安装完后,只有几个*.cfg-sample文件sbin Nagios Cgi文件所在目录,也就是执行外部命令所需文件所在的目录Share Nagios网页文件所在的目录Var Nagios日志文件、spid 等文件所在的目录修改nagios页面文件[root@cacti-qmail nagios-3.2.1]# more /etc/httpd/conf/nagios.conf# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER# Last Modified: 11-26-2005## This file contains examples of entries that need# to be incorporated into your Apache web server# configuration file. Customize the paths, etc. as# needed to fit your system.ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"<Directory "/usr/local/nagios/sbin"># SSLRequireSSLOptions ExecCGIAllowOverride NoneOrder allow,denyAllow from all# Order deny,allow# Deny from all# Allow from 127.0.0.1AuthName "Nagios Access"AuthType BasicAuthUserFile /usr/local/nagios/etc/ers Require valid-user</Directory>Alias /nagios "/usr/local/nagios/share"<Directory "/usr/local/nagios/share"># SSLRequireSSLOptions NoneAllowOverride NoneOrder allow,denyAllow from all# Order deny,allow# Deny from all# Allow from 127.0.0.1AuthName "Nagios Access"AuthType BasicAuthUserFile /usr/local/nagios/etc/ersRequire valid-user</Directory>基本上这个文件可以直接使用,所以直接复制过去[root@cacti-qmail nagios-3.2.1]# cp /etc/httpd/conf/nagios.conf /var/www/html/ 生成nagios页面访问账号根据这个配置文件中指定的AuthUserFile项,它指定的是通过Apache访问Nagios的合法用户的帐户名单库文件,需要使用htpasswd命令对这个名单库进行用户的添加。