Nagios安装流程(centos5.5环境+nagios-cn-3.2.3.tar.bz2)

 Nagios安装流程(centos 5.5环境 + nagios-cn-3.2.3.tar.bz2  +)

创新互联专注于罗城企业网站建设,响应式网站设计,商城网站建设。罗城网站建设公司,为罗城等地区提供建站服务。全流程按需网站设计,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

1、 更新yum源

2、 安装组件

[root@localhost ~]# yum -y install httpd gettext MySQL mysql-server mysql-devel php php-mysql php-pear

[root@localhost ~]# yum -y install gd gd-devel php-gd

安装nagios时需要加--with-gd-lib=/usr/lib --with-gd-inc=/usr/include  

不然不能生成statusmap.cgi 也就不能看状态图了!

3、 增加帐号

[root@localhost nagios-cn-3.2.3]# useradd nagios

[root@localhost nagios-cn-3.2.3]# passwd nagios

nagios

[root@localhost nagios-cn-3.2.3]# usermod -s /sbin/nologin nagios

[root@localhost nagios-cn-3.2.3]# groupadd nagcmd

[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd nagios

[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd apache

4、 解压nagios-cn文件

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

5、 进入解压文件夹

[root@localhost nagios-cn-3.2.3]#cd nagios-cn-3.2.3

6、  运行安装命令

./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include

备注:提示错误

Nagios安装流程(centos 5.5环境 + nagios-cn-3.2.3.tar.bz2)

解决办法:因为是centos linux,默认可以采用yum方式安装,则采用如下命令安装gcc编译器即可:# yum -y install gcc

7、 再次运行安装命令(第6步命令),提示没有错误后运行make all命令然后依次执行下面的命令

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

[root@localhost nagios-cn-3.2.3]#make install-init   //安装启动脚本到/etc/init.d

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

[root@localhost nagios-cn-3.2.3]#make install-config  //安装初始配置文件到/usr/local/nagios

8、 退出nagios文件夹并解压nagios-plugins并进入

[root@localhost nagios-cn-3.2.3]#cd ..

[root@localhost nagios-cn-3.2.3]# tar -zxvf nagios-plugins-1.4.15.tar.gz

[root@localhost nagios-cn-3.2.3]#cd nagios-plugins-1.4.15

9、 执行安装命令

[root@localhost nagios-plugins-1.4.15]#./configure --prefix=/usr/local/nagios-plugins --with-nagios-user=nagios --with-nagios-group=nagios

10、             然后执行以下命令

[root@localhost nagios-plugins-1.4.15]# make

[root@localhost nagios-plugins-1.4.15]# make install

11、             安装完成以后在/usr/local/nagios-plugins会产生一个 libexec的目录,将该目录全部移动到/usr/local/nagios目录下即可。 

[root@localhost nagios-plugins-1.4.15]#mv /usr/local/nagios-plugins/libexec /usr/local/nagios/

12、             配置Apache:在apache的httpd.conf文件中加入如下内容:

[root@localhost /]# vi /etc/httpd/conf/httpd.conf

###nagios

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

 

#  SSLRequireSSL

    Options ExecCGI

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#  Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd.users

    Require valid-user

 

Alias /nagios "/usr/local/nagios/share"

 

#  SSLRequireSSL

    Options None

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#    Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd.users

    Require valid-user

13、             启动Apache服务

[root@localhost /]# service httpd restart

14、             设置报报警邮箱

[root@localhost /]# vi /usr/local/nagios/etc/objects/contacts.cfg

将nagios@localhost改为自己的邮箱(310475629@qq.com),保存并退出。

15、             设置登陆web密码

[root@localhost /]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password:(nagiosadmin)

Re-type new password:(nagiosadmin)

Adding password for user nagiosadmin

16、             启动(重启)相关服务(Apache及nagios服务)

[root@localhost /]# service httpd restart

[root@localhost /]# service nagios restart

 

17、             检查配置文件是否正确

如果出现如下显示就说明配置没问题

Total Warnings: 0

Total Errors:   0

18、             现在就可以http://你的 IP/nagios/访问 nagios(实验IP地址为192.168.1.8),提示正常的界面则nagios安装成功。


分享题目:Nagios安装流程(centos5.5环境+nagios-cn-3.2.3.tar.bz2)
转载源于:http://azwzsj.com/article/jgocoj.html