cszer

Linux监控利器nagios–安装

分类: 技术, Linux 运维   标签: ,    评论: 4   阅读:3,139 views

安装:
环境:CentOS6.0 32bit

1、先相关软件包

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

2、创建用户信息

useradd -m nagios  passwd 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[1]: *** [install] Error 1
make[1]: Leaving directory `/usr/src/nagios/html'
make: *** [install] 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即可

除非注明,文章皆由( csz )原创,转载请标明本文地址
本文地址: http://www.cszhi.com/20120326/nagios-setup.html

03-26
2012

4 Comments for Linux监控利器nagios–安装

发表评论

Trackbacks and Pingbacks: