VMware Linux下Nagios的安装

平台:红帽RHEL 5.4

本次安装需要的软件

nagios-3.2.3.tar.gz(nagios的core)

nagios-plugins-1.4.15.tar.gz(功能插件)

nagios-cn-3.2.3.tar.bz2(中文插件)

其中中文插件的选择必须和core高度一致

本次安装需要开启的服务

apache和sendmail

另外还需以rpm或者yum的方式来安装php的功能模块

当然这两个软件也可以用源码编译的方式来安装,这里采用是系统默认安装的套件

1、安装前的准备

关闭selinux和清除防火墙规则(为了不影响测试)

[root@localhost ~]# useradd nagios
[root@localhost ~]# passwd nagios

2、安装nagios的core

[root@localhost ~]# ls nagios-3.2.3.tar.gz
nagios-3.2.3.tar.gz
[root@localhost ~]# tar zxvf nagios-3.2.3.tar.gz

[root@localhost ~]# cd nagios-3.2.3
[root@localhost nagios-3.2.3]# ./configure(环境的设置)

[root@localhost nagios-3.2.3]# make(编译)
[root@localhost nagios-3.2.3]# make install(安装)
[root@localhost nagios-3.2.3]# make install-init(制作/etc/rc.d/ini.d/的启动方式)
[root@localhost nagios-3.2.3]# make install-commandmode(对目录权限的限制)
[root@localhost nagios-3.2.3]# make install-config(检测变量的设置,主要在目录/usr/local/nagios/etc中)
[root@localhost nagios-3.2.3]# make install-webconf(解决和apache的融合)

3、安装nagios的功能插件

[root@localhost ~]# ls nagios-plugins-1.4.15.tar.gz
nagios-plugins-1.4.15.tar.gz
[root@localhost ~]# tar zxvf nagios-plugins-1.4.15.tar.gz
[root@localhost nagios-plugins-1.4.15]# ./configure

[root@localhost nagios-plugins-1.4.15]# make;make install
4、安装中文插件

[root@localhost ~]# ls nagios-cn-3.2.3.tar.bz2
nagios-cn-3.2.3.tar.bz2

[root@localhost ~]# tar jxvf nagios-cn-3.2.3.tar.bz2
[root@localhost nagios-cn-3.2.3]# ./configure

[root@localhost nagios-cn-3.2.3]# make all
[root@localhost nagios-cn-3.2.3]# make install

5、一些基本的配置

[root@localhost ~]# cd /etc/httpd/conf
[root@localhost conf]# vi httpd.conf (加上下边那句话,php的支持)

AddType applicatio/x-httpd-php  .php

[root@localhost ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin(设置管理用户)

New password:
Re-type new password:
Adding password for user nagiosadmin
[root@localhost ~]# cd /usr/local/nagios/etc/
[root@localhost etc]# chown nagios:nagios htpasswd.users

[root@localhost etc]# chmod g+w htpasswd.users
[root@localhost etc]# cat htpasswd.users
nagiosadmin:QfW0M.KNWetv2
6、测试

[root@localhost ~]# /etc/init.d/nagios restart
[root@localhost ~]# /etc/init.d/httpd restart
[root@localhost ~]# /etc/init.d/sendmail restart
在IE地址栏里输入 出现提示登录界面,输入nagiosadmin 和刚才设置的密码  登录即可

下边说下调试过程中出现的问题

初次安装nagios用源码的方式安装所有所需套件,一直出现莫名的错误,只好放弃以后再研究,后来决定试试用系统自带的apache和sendmail和以yum的方式来安装php,只用源码的方式安装配置nagios的套件,这样的设置在安装nagios的core的过程中由于没make install-webconf,所以一直出现权限的问题(Nagios 请检查HTTP服务器关于该CGI的访问权限设置),在网上搜寻说是htpasswd.users的权限的问题可是照做了之后仍然不行,后来就查看/usr/local/nagios/etc/cgi.cfg  中关于管理员用户的限定,后来发现里边限定的是nagiosadmin这个用户,于是就 htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin,直接设置成这个用户,再次重启服务之后刷新页面,上述的错位就没了,由于是新手,在安装这个套件的过程中一直重复,一直尝试,得来的结果是进一步了解了它的原理,这里介绍的只是安装,下边要学习的配置才是重点(见  ),至于安装就说到这里!    

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23094.html