cacti+icinga整合完整步骤:
http://sourceforge.net/projects/icinga-cn/files/icinga-cn/icinga-cn-1.11/icinga-cn-1.11.5.tar.gz/download
http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
http://down.51cto.com/data/558499
icinga部分:
$ sudo useradd icinga
$ sudo apt-get install libdbi-dev
$ sudo apt-get install apache2
$ sudo apt-get install mysql-server libdbd-mysql (root密码设置123456,可改)
$ tar zxfv icinga-cn-1.11.5.tar.gz
$ cd icinga-cn-1.11.5
$ ./configure --prefix=/usr/local/icinga --enable-idoutils
$ sudo make all
$ sudo make install
$ sudo make install-init
$ sudo make install-commandmode
$ sudo make install-idoutils
$ sudo make install-config
$ sudo make install-webconf
$ sudo make install-webconf-auth
$ cd
$ tar zxfv nagios-plugins-2.0.3.tar.gz
$ cd nagios-plugins-2.0.3
$ ./configure --prefix=/usr/local/icinga
$ make
$ sudo make install
检查配置是否有误
$ sudo /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
启动icinga:
$ sudo service icinga start
开机启动icinga:
$ sudo vi /etc/rc.local (在exit 0前一行)
sudo service icinga start
:wq
修改httpd的配置文件/etc/apache2/site-available/default (在中间添加)
ScriptAlias /icinga/cgi-bin "/usr/local/icinga/sbin"
<Directory "/usr/local/icinga/sbin">
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Icinga Access"
AuthUserFile /usr/local/icinga/etc/htpasswd.users
Require valid-user
</Directory>
:wq
$ sudo ln -s /usr/local/icinga/share /var/www/icinga
$ sudo htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
输入密码(如:123456)
后面修改密码命令:
$ sudo htpasswd /usr/local/icinga/etc/htpasswd.users icingaadmin
重启apache2:
$ sudo service apache2 restart
访问:http://ip/icinga (输入用户名icinga及密码)
$ mysql -u root -p123456
> create database icinga default character set utf8;
> grant all on icinga.* to idouser@localhost identified by '123456';
> quit
$ cd icinga/icinga-1.11.5/module/idoutils/db/mysql
$ sudo cp mysql.sql mysql.sql.bak
$ sudo vi mysql.sql
:1,$ s/icinga_/npc_/g
:wq
$ mysql -u idouser -p icinga < mysql.sql
$ sudo vi /usr/local/icinga/etc/ido2db.cfg
db_user=idouser
db_pass=123456
db_prefix=npc_
$ sudo service ido2db restart
$ sudo service icinga restart
$ sudo cat /usr/local/icinga/var/icinga.log (确保idomod连接data正常:idomod:Successfully connected to data sink)
cacti部分:
$ sudo apt-get install libapache2-mod-php5
$ sudo apt-get install php5
$ sudo apt-get install php5-mysql
$ sudo apt-get install php5-snmp
$ sudo apt-get install snmp snmpd
$ sudo apt-get install rrdtool
$ cd /var/www/ (将下载好的cacti包放到该目录下)
$ tar zxf cacti-0.8.8b.tar.gz
$ sudo mv cacti-0.8.8b cacti
$ sudo useradd cactiuser
$ sudo chown -R cactiuser:cactiuser cacti/rra cacti/log
$ sudo mysql -u idouser -p icinga < cacti/cacti.sql
$ cd cacti/include
$ sudo vi config.php
<? php
$ database_type = "mysql";
$ database_default = "icinga";
$ database_hostname = "localhost";
$ database_username = "idouser";
$ database_password = "123456";
$ database_port = "3306";
?>
$ sudo /usr/bin/php /var/www/cacti/poller.php
$ sudo crontab -e
*/5 * * * * /usr/bin/php /var/www/cacti/poller.php & > /dev/null
$ sudo service apache2 restart
浏览器:http://localhost/cacti
cacti安装向导界面 - 下一步 - 全新安装(php路径为/usr/local/php/bin/php) - 完成
用户名密码默认均为admin,第一次会让修改密码
$ cd /var/www/cacti/plugins/ (将下载好的npc包放到该目录下)
$ tar zxfv npc.tar.gz
$ sudo service apache2 restart
访问http://localhost/cacti-console-Plugin Managent-点击Npc行的Actions向下箭头图标-点击向右图标-就会出现npc界面
点击console-Settings-NPC-勾中Remote Commands-Nagios Command File Path:/usr/local/nagios/var/rw/nagios.cmd-Nagios URL:http://ip/nagios-点击Save
本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/1541546如需转载请自行联系原作者
yangzhimingg