Nagios完整的配置方案(1)
本帖最后由 monicazhang 于 2015-10-30 21:36 编辑20151030淡然
通过整合pnp4nagios,ndoutils,nconf提供了关于nagios的一套完整的配置方案安装nagios 操作系统Centos5.5目前nagios最新版本的nagios3.4.1相关依赖包yum -y installmysql perl mysql-server perl-DBI perl-DBD-MySQL httpd php gcc glibc glibc-common gd gd-devel ruby ruby-devel2 ruby-devel mysql-devel php-mysql libpng libpng-devel libjpeg libjpeg-devel zlib zlib-devel nagios安装yum默认安装的是5.1版本的php,但是pnp4nagios-0.6.6需要5.2以上版本的php,这里就装5.3的yum search php 看看有没有php53相关的包,没有请配置好相关的源yum install php53-*如遇到:Error: php53-common conflicts with php-commonYou could try using --skip-broken to work around the problemYou could try running: package-cleanup --problemspackage-cleanup –dupes
请使用如下命令安装:yum -y install php53-* --skip-broken准备如下软件包
-rw-r--r-- 1 root root1782817 Jul9 08:45 nagios-3.4.1.tar.gz
-rw-r--r-- 1 root root2087089 Jul 9 14:36 agios-plugins-1.4.16.tar.gz
-rw-r--r-- 1 root root 491706 Jul6 14:40 nconf-1.3.0-0.tgz
-rw-r--r-- 1 root root2135521 Jul6 14:42 ndoutils-1.4b9.tar.gz
-rw-r--r-- 1 root root 405725 Dec 142011 nrpe-2.12.tar.gz
-rw-r--r-- 1 root root 2815857 Sep 15 2011 np4nagios-0.6.15.tar.gz
-rw-r--r-- 1 root root 2135521Jul 6 14:42 doutils1.4b9_light.patch建立相关用户和组 useradd -m nagios
groupadd nagios
usermod -a -G nagios nagios
usermod -a -G apache nagios
安装nagios tar zxvf nagios-3.4.1.tar.gz -C /usr/src
cd /usr/src/nagios-3.4.1
./configure--prefix=/usr/local/nagios --with-command-group= nagios --with-gd-lib=/usr/lib --with-gd- 开源监控软件inc=/usr/includemake all
make install
make install-init
make install-commandmode
make install-config
make install-webconf创建web管理界面用户和密码 htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios登录nagios web界面时的用户为nagios下面输入的密码为此用户密码chkconfig --add nagios
chkconfig nagios on
chkconfig httpd on
chkconfig mysqld on
安装插件 tar zxvf nagios-plugins-1.4.16.tar.gz -C /usr/src
cd /usr/src/nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios nagios配置
make
make installservice nagios start
service httpd start
service mysqld start
使用http://localhost/nagios/来访问问题1: 点开service会看到本机的httpd服务有个告警,并提示HTTP WARNING: HTTP/1.1 403 Forbidden - 5240 bytes in 0.002 second response time解决方案: 修改下面的配置文件即可消除错误vim /usr/local/nagios/etc/objects/localhost.cfgdefine service{
use local-service ; Name of service template to use
host_name localhost
service_description HTTP
check_command check_http
notifications_enabled 1 #######此处改为1define service{
use local-service ; Name of service template to use
host_name localhost
service_description SSH
check_command check_ssh
notifications_enabled 1 ########此处改为1 监控软件
}问题2 提示HTTP WARNING: HTTP/1.1 403 Forbidden - 5240 bytes in 0.002 second response time是因为在目前网站根目录下面没有首页文件,解决方案 可自己建立一个index.html的文件放在/var/www/html/下面,如果是源码安装的请放在定义的网站根下面。重启Nagios和httpd服务刷新页面即可
安装pnp4nagios pnp4nagios的安装和配置,能够把nagios捕获到的数据绘制成图片安装前准备yum install rrdtool-perl rrdtool-devel rrdtool提示:在安装rrdtool时,提示“No package rrdtool available.”,请执行以下语句:wget rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm nagios实施yum install rrdtool-perl rrdtool-devel rrdtool
imagepak-base的安装
tar –xvzf imagepak-base.tar.gz
解压以后是base目录
cp –R base /usr/local/nagios/share/images/logostar zxvf pnp4nagios-0.6.19.tar.gz -C /usr/src
cd /usr/src/pnp4nagios-0.6.19
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
make install-webconf
make install-config
make isntall-init
make fullinstallpnp4nagios官方提供了三种配置方法,我这里选取一种 nagios培训
vi /usr/local/nagios/etc/nagios.cfg
待续:http://ITIL-foundation.cn/thread-53050-1-1.html
本帖关键字:Nagios
页:
[1]