cacti+nagios整合:
http://pkgs.fedoraproject.org/repo/pkgs/php-json/php-json-ext-1.2.1.tar.bz2/e06e701412a055f3372775216ec3d604/php-json-ext-1.2.1.tar.bz2
http://sourceforge.net/projects/nagios/files/ndoutils-2.x/ndoutils-2.0.0/ndoutils-2.0.0.tar.gz/download
http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
http://down.51cto.com/data/558499
$ sudo apt-get install libmysqld-dev
$ sudo apt-get install php5-dev
$ tar jxfv php-json-ext-1.2.1.tar.bz2
$ cd php-json-ext-1.2.1
$ ./configure
$ sudo make
$ sudo make install
$ cd
$ tar zxfv ndoutils-2.0.0.tar.gz
$ cd ndoutils-2.0.0
$ ./configure --prefix=/usr/local/nagios --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
$ sudo make
$ sudo cp src/ndomod-3x.o /usr/local/nagios/bin/
$ sudo cp src/ndo2db-3x /usr/local/nagios/bin/
$ sudo cp src/log2ndo /usr/local/nagios/bin/
$ sudo cp src/file2sock /usr/local/nagios/bin/
$ sudo cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
$ sudo cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
$ sudo vi /usr/local/nagios/ndo2db.cfg
ndo2db_user=nagios
ndo2db_group=nagios
socket_type=tcp (去掉前#,socket_type=unix前加#)
db_prefix=npc_ (默认为db_prefix=nagios_)
db_name=cacti //cacti的数据库名
db_user=cactiuser //cacti的数据库用户
db_pass=123456 //cacti的数据库用户的密码
:wq
$ sudo vi /usr/local/nagios/etc/ndomod.cfg
output_type=tcpsocket (去掉前面的#,output_type=unixsocket前加#
output=127.0.0.1 (去掉前面的#,output=/usr/local/nagios//var/ndo.sock前加#
:wq
启动ndo2db:
$ sudo /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
$ sudo vi /usr/local/nagios/etc/nagios.cfg
process_performance_data=1 (确保该处值为1且没被注释掉)
broker_modules=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg (在最后添加)
:wq
$ sudo service nagios restart
$ cd /var/www/cacti/plugins/ (将下载好的npc.tar.gz放到该目录下)
$ tar zxfv npc.tar.gz
$ sudo vi /var/www/cacti/include/config.php
$plugins[]=‘npc‘;
:wq
$ sudo service apache2 restart
$ cd
$ tar zxfv PDO_MYSQL-1.0.2.tgz
$ sudo ln -s /usr/include/php5 /usr/include/php
$ cd PDO_MYSQL-1.0.2
$ phpize
$ ./configure
$ sudo make
$ sudo make install
$ mysql -u root -p123456
mysql> use cacti;
mysql> alter table npc_eventhandlers add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_hostchecks add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_hoststatus add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_notifications add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_servicechecks add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_statehistory add long_output TEXT NOT NULL default ‘‘ after output;
mysql> alter table npc_systemcommands add long_output TEXT NOT NULL default ‘‘ after output;
访问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” 博客,谢绝转载!