本帖最后由 monicazhang 于 2015-10-30 21:42 编辑
Nagios的安装与配置
安装环境 环境说明: 监控机centos6.2 x86_64 ip为172.26.188.201 被监控机centos6.2 x86_64 ip为 172.26.188.202
所用软件包: nagios-3.4.1.tar.gz nagios-plugins-1.4.16.tar.gz nrpe-2.13.tar.gz pnp4nagios-0.6.19.tar.gz nagios的安装创建nagios用户 #useradd nagios #mkdir /usr/local/nagios #chown –R nagios.nagios /usr/local/nagios
安装apache和php #yum install httpd #yum install php php-mysql php-mbstring php-gd* nagios配置
安装Nagios # tar -zxvf nagios-3.4.1.tar.gz # cd nagios #./configure --prefix=/usr/local/nagios #make all #make install #make install-init #make install-commandmode #make install-config Nagios目录介绍 Nagios安装完成后,各个目录结构以及功能说明如下表所示:
安装plugins插件 这里下载的版本是nagios-plugins-1.4.16。 注意:插件版本与nagios版本的关联并不大。 #tar –zxvf nagios-plugins-1.4.16.tar.gz #cd nagios-plugins-1.4.16 #./configure --prefix=/usr/local/nagios # make # make install 安装完成,在/usr/local/nagios下的libexec目录下,生成很多可执行文件,这些正是nagios所需要的插件。
安装nrpe #tar -zxvf nrpe-2.13.tar.gz #cd nrpe-2.13 #./configure --prefix=/usr/local/nagios #make all #make install-plugin
安装pnp4nagios-0.6.6插件#tar -zxvf pnp4nagios-0.6.19.tar.gz 监控软件
#cd pnp4nagios-0.6.19
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios#make all
#make install# make install-webconf# make install-config# make install-init 创建配置文件#cd /usr/local/pnp4nagios/etc#cp misccommands.cfg-sample misccommands.cfg#cp nagios.cfg-sample nagios.cfg#cp rra.cfg-sample rra.cfg#cd pages#cp web_traffic.cfg-sample web_traffic.cfg# cd ../check_commands#cp check_all_local_disks.cfg-sample check_all_local_disks.cfg#cp check_nrpe.cfg-sample check_nrpe.cfg#cp check_nwstat.cfg-sample check_nwstat.cfg 重启服务#/etc/init.d/npcd restart 修改 nagios 的配置文件.打开performance_data#vi /usr/local/nagios/etc/nagios.cfg打开注释 nagios实施 项:process_performance_data=1host_perfdata_command=process-host-perfdataservice_perfdata_command=process-service-perfdata修改 commands.cfg#vi /usr/local/nagios/etc/objects/commands.cfg##添加# 'process-host-perfdata' command definitiondefine command{ command_name process-host-perfdata command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl }# 'process-service-perfdata' command definitiondefine command{ command_name process-service-perfdata command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl nagios培训
|