nagios安装

 

server端

1.安装准备

①下载安装包:nagios-4.1.1.tar.gz、

                    nagios-plugins-2.1.1.tar.gz

                    nrpe-2.15.tar.gz

②下载依赖包:yum install httpd php gcc glibc glibc-common gd gd-devel xinetd openssl-devel mysql-devel php-mysql

说明:web前端需要安装apache,图片和图形展示需要安装libpng、libjpeg、gd三个图形库。

        nagios唯一的依赖包是zlib

        插件的依赖关系因插件而异,一般configure时会提示需要哪些,按照提示安装即可

③创建用户、用户组

useradd nagios

passwd nagios

**********

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.创建一个新的nagcmd组允许外部命令通过web界面提交。把nagios和apache用户加到这个用户组

**********

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd apache

2.安装

①nagios-4.1.1

  • 编译安装

cd nagios-4.1.1

./configure --with-command-group=nagcmd 【–build='uname -m'  rh7.1】

make all

make install

make install-init

make install-config

make install-commandmode

(make fullinstall 完全安装nagios

   make uninstall  卸载nagios)

  • 配置联系人

做完上面的步骤,配置文件样例已经安装在了/usr/local/nagios/etc/中,为了继续下面的操作,需要编辑其中一个配置文件

vi /usr/local/nagios/etc/objects/contacts.cfg  **可以个性化其中的内容**

  • 配置web接口

make install-webconf

配置nagios web登录用户名密码

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

重启httpd服务以生效以上配置

service httpd restart

②安装nagios-plugin

cd nagios-plugins-2.1.1

./configure --with-nagios-user=nagios --with-nagios-group=nagios 【–build='uname -m'】

make

make install

③启动nagios

将Nagios添加到系统服务列表并在系统启动时自动启动

chkconfig --add nagios

chkconfig nagios on Verify the sample Nagios configuration files

验证

. /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

如果不报错则启动nagios

service nagios start

此时可以启动nagios web查看是否正常显示

④安装nrpe

cd nrpe-2.15

./configure  --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

验证

[root@mast1 nagios]# ll /usr/local/nagios/libexec/|grep check_nrpe

-rwxrwxr-x 1 nagios nagios  75501 Jun 17 16:35 check_nrpe

 

client端

1.准备

①创建用户、用户组

useradd nagios -d /usr/local/nagios

passwd nagios

②安装依赖

yum install xinetd

yum install openssl*

2.安装

①安装nagios-plugin

cd nagios-plugins-2.1.1

./configure --with-nagios-user=nagios --with-nagios-group=nagios 【–build='uname -m'】

make

make install

②安装nrpe(nagios remote plugin executor,nagios远程插件执行程序)

cd nrpe-2.15

./configure  --with-nagios-user=nagios --with-nagios-group=nagios

make all

make install-plugin

make install-daemon

make install-daemon-config

 

posted on 2016-06-17 17:29  roger888  阅读(335)  评论(0编辑  收藏  举报

导航