Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1380290
  • 博文数量: 77
  • 博客积分: 2104
  • 博客等级: 大尉
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 13:21
个人简介

关注于系统高可用、网站架构

文章分类

全部博文(77)

文章存档

2018年(1)

2017年(1)

2015年(4)

2014年(8)

2013年(4)

2012年(12)

2011年(17)

2010年(30)

分类: LINUX

2012-05-21 15:02:11

详细用法,可参考官方文档:
中文下载
使用root用户操作
1 准备
#> yum install httpd gcc glibc glibc-common gd gd-devel
#> yum install libjpeg libjpeg-devel libpng libpng-devel
#> yum install net-snmp net-snmp-devel net-snmp-utils

Create a new icinga user account and give it a password:

#> /usr/sbin/useradd -m icinga
#> passwd icinga

On some distributions you'll need to add the group in a single step:

#> /usr/sbin/groupadd icinga 

For sending commands from the classic web interface to Icinga, you'll need to create a new group icinga-cmd. Add the webuser and the Icinga user to this group:

#> /usr/sbin/groupadd icinga-cmd
 #> /usr/sbin/usermod -a -G icinga-cmd icinga
 #> /usr/sbin/usermod -a -G icinga-cmd www-data
Download Icinga and the Plugins
wget
 wget
tar jxvf icinga-cn-1.6.1.tar.bz2
cd icinga-cn-1.6.1
./configure --with-command-group=icinga-cmd

Compile the Icinga source code. To see available options, only use "make".

#> make all

Install binaries, init script, sample config files and set permissions on the external command directory.

#> make install
#> make install-init
#> make install-config
#> make install-commandmode

Edit the /usr/local/icinga/etc/objects/contacts.cfg config file with your favourite editor and change the email address associated with the icingaadmin contact definition to the address you'd like to use for receiving alerts.

#> vi /usr/local/icinga/etc/objects/contacts.cfg

Configure the Classic Web Interface

Icinga ships with the Classic Web Interface ("the CGIs") which can be installed via

#> make cgis
#> make install-cgis
#> make install-html

Install the Icinga Classic web config file in the Apache conf.d directory.

#> make install-webconf 

Create an icingaadmin account for logging into the Icinga classic web interface. If you want to change it later, use the same command. Remember the password you assign to this account - you'll need it later.

#> htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin

If you want to change it later or want to add another user, use the following command:

#> htpasswd /usr/local/icinga/etc/htpasswd.users
 #> service httpd restart

Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

#> cd /usr/src
#> tar xvzf nagios-plugins-1.4.15.tar.gz
#> cd nagios-plugins-1.4.15

Compile and install the plugins by changing install directory to /usr/local/icinga

#> ./configure \ --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-htmurl=/icinga \ --with-nagios-user=icinga --with-nagios-group=icinga
 #> make
 #> make install

Adjusting the SELinux settings

RHEL and derived distributions like Fedora and CentOS are shipped with activated SELinux (Security Enhanced Linux) running in "enforcing" mode. This may lead to "Internal Server Error" messages when you try to invoke the Icinga-CGIs.

Check if SELinux runs in enforcing mode

#> getenforce

Set SELinux in "permissive" mode

#> setenforce 0

To make this change permanent you have to adjust this setting in /etc/selinux/config and restart the system.

Instead of deactivating SELinux or setting it into permissive mode you can use the following commands to run the CGIs in enforcing/targeted mode:

#> chcon -R -t httpd_sys_script_exec_t /usr/local/icinga/sbin/
 #> chcon -R -t httpd_sys_content_t /usr/local/icinga/share/
#> chcon -t httpd_sys_script_rw_t /usr/local/icinga/var/rw/icinga.cmd 

Start Icinga

Add Icinga to the list of system services and have it automatically start when the system boots (make sure you have installed the init script before).

Fedora/RHEL/CentOS/openSuSE

#> chkconfig --add icinga
#> chkconfig icinga on

Verify the sample Icinga configuration files.

#> /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg

Instead of specifying the paths to binary and config file you can issue

#> /etc/init.d/icinga show-errors

which results in an OK message if everything is fine or several lines which show the location of the error(s).

If there are no errors, start Icinga.

Fedora/RHEL/CentOS/Ubuntu

#> service icinga start 

Login to the Classic Web Interface

You should now be able to access the Icinga classic web interface at the URL below. You'll be prompted for the username ( icingaadmin) and password you specified earlier.

 
阅读(4276) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~