icinga中文包:http://sourceforge.net/projects/icinga-cn/files/icinga-cn/
icinga英文包:https://www.icinga.org/download/packages/
1.安装icinga说需要的包
#> 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
2.安装icinga(icinga-cn-1.9以这个为案例)
2.1 添加icinga运行的相关用户和组
2.2 编译安装
#> /usr/sbin/useradd -m icinga #> passwd icinga #> /usr/sbin/groupadd icinga #> /usr/sbin/groupadd icinga-cmd #> /usr/sbin/usermod -a -G icinga-cmd icinga #> /usr/sbin/usermod -a -G icinga-cmd www-data #> cd /usr/src/ #> tar xvzf icinga-1.9.tar.gz #> cd icinga-1.9 #> ./configure --with-command-group=icinga-cmd --disable-idoutils #> make all #> make install #> make install-init #> make install-config #> make install-eventhandlers #> make install-commandmode #> make install-config #> vi /usr/local/icinga/etc/objects/contacts.cfg #> make cgis #> make install-cgis #> make install-html #> make install-webconf #> htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin #> htpasswd /usr/local/icinga/etc/htpasswd.users#> service httpd restart
3.安装Nagios-plugin
#> cd /usr/src #> tar xvzf nagios-plugins-1.4.16.tar.gz #> cd nagios-plugins-1.4.16 #> ./configure \ --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin \ --with-nagios-user=icinga --with-nagios-group=icinga #> make #> make install
4.设置防火墙和selinux
4.1这里测试就清空iptbales :iptables -F
#> getenforce Set SELinux in "permissive" mode #> setenforce 0 #> chcon -R -t httpd_sys_script_exec_t /usr/local/icinga/sbin/ #> chcon -R -t httpd_sys_content_t /usr/local/icinga/share/ #> chcon -R -t httpd_sys_script_rw_t /usr/local/icinga/var/rw/
5.设置开启启动项
#> chkconfig --add icinga #> chkconfig icinga on 验证下配置文件是否正确 #> /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg 或: #> /etc/init.d/icinga show-errors 启动 icinga #> /etc/init.d/icinga start
6.访问
http://yourdomain.com/icinga/
7.Nrpe的安装
#> yum install openssl openssl-devel #> wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz -O nrpe.tgz #> tar xzf nrpe.tgz #> cd icinga-nrpe #> ./configure #> make all #> make install-plugin FirstTest: #> /usr/src/icinga-nrpe/src/nrpe -n \ -c /usr/src/icinga-nrpe/sample-config/nrpe.cfg -d #> /usr/local/icinga/libexec/check_nrpe -H 127.0.0.1 -n
8.PNPnagios的安装
yum install rrdtool -y wget http://cdnetworks-kr-1.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.6.tar.gz tar -xvzf pnp4nagios-0.6.6.tar.gz cd pnp4nagios-0.6.6 ./configure --with-nagios-user=icinga --with-nagios-group=icinga make all make install make install-webconf make install-config make install-init
9.配置pnpnagios:
参照下面链接配置:
http://docs.icinga.org/latest/en/icinga-web-pnp.html#idp12815568
nagios-snmp
wget http://nchc.dl.sourceforge.net/project/nagios-snmp/nagios-snmp-plugins/1.1.1/nagios-snmp-plugins.1.1.1.tgz
安装snmp
1) By CPAN (best)
on command line, as root :
[your_host]# perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.76)
ReadLine support enabled
cpan> install Net::SNMP
tar xf nagios-snmp-plugins
cd nagios_plugins/
sh install.sh
输入安装的相关参数。
参考:
nagios 的snmp插件用法:http://nagios.manubulon.com/index_commands.html#load
https://wiki.icinga.org/display/howtos/Setting+up+PNP+with+Icinga#SettingupPNPwithIcinga-RRDToolandPerlBindings
icinga +pnp4nagios
参考文档:
http://docs.icinga.org/latest/en/quickstart-idoutils.html
http://docs.icinga.org/latest/en/
附录:nagios +pnp的文档:
http://wenku.baidu.com/view/4daf21a0284ac850ad02426c.html
pnp4nagios监控网卡流量:http://www.xmydlinux.org/201011/51.html
check_linux_stats:http://storysky.blog.51cto.com/628458/696749
http://blog.sina.com.cn/s/blog_6eee53080101a1dm.html