本帖最后由monicazhang于2015-10-3021:42编辑
Nagios的安装与配置
安装环境环境说明: 监控机centos6.2x86_64 ip为172.26.188.201 被监控机centos6.2x86_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用户#useraddnagios #mkdir/usr/local/nagios #chown–Rnagios.nagios/usr/local/nagios
安装apache和php#yuminstallhttpd #yuminstallphpphp-mysqlphp-mbstringphp-gd*nagios配置
安装Nagios#tar-zxvfnagios-3.4.1.tar.gz #cdnagios #./configure--prefix=/usr/local/nagios #makeall #makeinstall #makeinstall-init #makeinstall-commandmode #makeinstall-config Nagios目录介绍Nagios安装完成后,各个目录结构以及功能说明如下表所示:
安装plugins插件这里下载的版本是nagios-plugins-1.4.16。 注意:插件版本与nagios版本的关联并不大。 #tar–zxvfnagios-plugins-1.4.16.tar.gz #cdnagios-plugins-1.4.16 #./configure--prefix=/usr/local/nagios #make #makeinstall 安装完成,在/usr/local/nagios下的libexec目录下,生成很多可执行文件,这些正是nagios所需要的插件。
安装nrpe#tar-zxvfnrpe-2.13.tar.gz #cdnrpe-2.13 #./configure--prefix=/usr/local/nagios #makeall #makeinstall-plugin
安装pnp4nagios-0.6.6插件#tar-zxvfpnp4nagios-0.6.19.tar.gz监控软件
#cdpnp4nagios-0.6.19
#./configure--with-nagios-user=nagios--with-nagios-group=nagios#makeall
#makeinstall#makeinstall-webconf#makeinstall-config#makeinstall-init创建配置文件#cd/usr/local/pnp4nagios/etc#cpmisccommands.cfg-samplemisccommands.cfg#cpnagios.cfg-samplenagios.cfg#cprra.cfg-samplerra.cfg#cdpages#cpweb_traffic.cfg-sampleweb_traffic.cfg#cd../check_commands#cpcheck_all_local_disks.cfg-samplecheck_all_local_disks.cfg#cpcheck_nrpe.cfg-samplecheck_nrpe.cfg#cpcheck_nwstat.cfg-samplecheck_nwstat.cfg重启服务#/etc/init.d/npcdrestart修改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'commanddefinitiondefinecommand{command_nameprocess-host-perfdatacommand_line/usr/local/pnp4nagios/libexec/process_perfdata.pl}#'process-service-perfdata'commanddefinitiondefinecommand{command_nameprocess-service-perfdatacommand_line/usr/local/pnp4nagios/libexec/process_perfdata.plnagios培训
|