一、nagios 安装

 

    Nagios可以运行在各种版本的linux及主流的unix环境,我的环境有Redhat5.4来部署nagios的。安装完操作系统之后,需要把多余的服务都关掉,只留sshd这个服务。

安装前的准备工作

1.建用户和组

 

[[email protected] ~]# useradd -m nagios

[[email protected] ~]# groupadd nagcmd

[[email protected] ~]# usermod -a -G nagcmd nagios

[[email protected] ~]# usermod -a -G apache nagios

2.安装:安装过程中会用到的一些服务和软件安装

[[email protected] ~]#yum groupinstall "Development Libraries" "Development Tools" "Legacy Software Development" "X Software  Development" -y

[[email protected] ~]# yum install gcc glibc glibc-devel  glibc-common gd gd-devel –y

 

[[email protected] ~]# yum install httpd httpd-devel php -y

3.安装nagios-3.4.1.tar.gz

 

[[email protected] ~]# tar -zvxf nagios-3.4.1.tar.gz

[[email protected] ~]#cd nagios

[[email protected] nagios]#./configure  --prefix=/usr/local/nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd- inc=/usr/include     ----运行Nagios配置脚本,并                                                                          把nagcmd更改为之前所创建的组

[[email protected] nagios]# make all

[[email protected] nagios]# make install

[[email protected] nagios]# make install-init

[[email protected] nagios]# make install-commandmode

[[email protected] nagios]# make install-config

[[email protected] nagios]# make install-webconf

 

[[email protected] ~]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin      

   --为nagios增添用户nagiosadmin 并设密码。(此时为登录nagiosweb页面而用,并非先前建立的nagios)

 

[[email protected] ~]# chkconfig --add nagios

[[email protected] ~]# chkconfig nagios on

[[email protected] ~]# chkconfig httpd on

           ---做的开机启动

、编译安装Nagios插件nagios-plugins-1.4.16.tar.gz

 

 

 

[[email protected] ~]# tar -zxvf nagios-plugins-1.4.16.tar.gz

[[email protected] ~]# cd nagios-plugins-1.4.16

[[email protected] nagios-plugins-1.4.16]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios

[[email protected] nagios-plugins-1.4.16]# make

[[email protected] nagios-plugins-1.4.16]# make install

 

[[email protected] ~]# service nagios start

Starting nagios: done.

[[email protected] ~]# service httpd start

启动 httpd[确定]

[[email protected] ~]#

到此时已安安装完。

用ie用测试http://192.168.111.105/nagios    如下图:

 

nagios 、nagios-plugins安装与配置