86565656 发表于 2015-9-8 11:27:29

系统监控nagios–安装

  安装:
环境:CentOS6.0 32bit
  1、先相关软件包

yum install httpd php gcc glibc glibc-common gd gd-devel make

  
  2、创建用户信息

useradd -m nagiospasswd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

  3、下载naiogs和nagios-plugins

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.3.1.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

  4、编译和安装nagios

tar zxf nagios-3.3.1.tar.gz
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode

  5、编辑配置文件(先修改下email地址)

vim /usr/local/nagios/etc/objects/contacts.cfg

  6、配置web界面及登陆验证

make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin   创建web登陆到帐号密码
/etc/init.d/httpd restart

  7.安装和编译nagios-plugins

tar zxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

  8、启动nagios

chkconfig --add nagios
chkconfig nagios on
/etc/init.d/nagios start

  9、检查nagios示例配置文件是否正确:

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

  其他问题:
在make installl时如果出现如下错误:

/usr/bin/install: omitting directory `includes/rss/extlib'
/usr/bin/install: omitting directory `includes/rss/htdocs'
/usr/bin/install: omitting directory `includes/rss/scripts'
make: *** Error 1
make: Leaving directory `/usr/src/nagios/html'
make: *** Error 2

  执行以下命令:

sed -i 's:for file in includes/rss/\*;:for file in includes/rss/\*.\*;:g' ./html/Makefile
sed -i 's:for file in includes/rss/extlib/\*;:for file in includes/rss/extlib/\*.\*;:g' ./html/Makefile

  重新make install即可
页: [1]
查看完整版本: 系统监控nagios–安装