分类: LINUX
2012-02-03 13:38:13
nagios分为3个部分
还依赖如下库文件 gd gd-devel glibc glibc-common
安装库
#yum -y install gcc glibc glibc-common gd gd-devel安装apache 和 php
#yum -y httpd phpnagios的安装创建一个名为nagcmd的用户组用于从Web接口执行外部命令
[root@centos ~]# useradd nagios [root@centos ~]# groupadd nagcmd将nagios用户和Apache用户都加入到该用户组中
[root@centos ~]# usermod -a -G nagcmd nagios [root@centos ~]# usermod -a -G nagcmd apache编译nagios主程序
[root@centos ~]# tar -zxvf nagios-3.2.1.tar.gz [root@centos ~]# cd nagios-3.2.1 [root@centos nagios-3.2.1]# ./configure --with-command-group=nagcmd [root@centos nagios-3.2.1]# make all [root@centos nagios-3.2.1]# make install 使用make install来安装主程序,CGI和HTML文件 [root@centos nagios-3.2.1]# make install-init 使用make install-init在/etc/rc.d/init.d安装启动脚本 [root@centos nagios-3.2.1]# make install-commandmode 来配置目录权限 [root@centos nagios-3.2.1]# make install-config 安装基本的配置 [root@centos nagios-3.2.0]# make install-webconf 自动添加apache的虚拟主机等权限设定。nagios目录功能的简要说明nagios文件的具体含义:(/usr/local/nagios/etc/objects)
设置访问密码
账号最好是nagiosadmin 存放密码文件的路径也必须是/usr/local/nagios/etc/htpasswd.users 因为/usr/local/nagios/etc/cgi.cfg默认配置了
安装nagios-plugins[root@centos nagios]# tar zxvf nagios-plugins-1.4.13.tar.gz [root@centos nagios-plugins-1.4.13]# ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd && make && make install安装nrpe[root@centos ~]# tar -xzvf nrpe-2.12.tar.gz [root@centos ~]# cd nrpe-2.12 [root@centos nrpe-2.12]# ./configure [root@centos nrpe-2.12]# make all [root@centos nrpe-2.12]# make install-plugin // 在Nagios服务器端只要安装nrpe监控插件就行将nrpe添加开机自启动
[root@centos nrpe-2.12]# cp init-script /etc/init.d/nrpe [root@centos nrpe-2.12]# chmod 755 /etc/init.d/nrpe [root@centos nrpe-2.12]# chkconfig --add nrpe [root@centos nrpe-2.12]# chkconfig nrpe on [root@centos nrpe-2.12]# chkconfig nagios on [root@centos nrpe-2.12]# chkconfig httpd on添加对nrpe的支持
[root@centos ~]#vim /usr/local/nagios/etc/objects/commands.cfg #'check_nrpe' command definition define command { command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
启动服务