#安装ndoutisl的依赖包
# 安装DBI
tar -zxvf DBI-1.616.tar.gz
cd DBI-1.616
perl Makefile.PL
make && make install
# 安装DBD-mysl
wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.018.tar.gz
tar xvf DBD-mysql-4.018.tar.gz -C /usr/local/soft
cd DBD-mysql-4.018
perl Makefile.PL --with-mysql=/usr/local/mysql --mysql_config=/usr/local/mysql/bin/mysql_config
make && make install
#安装php-json:
wget http://www.aurore.net/projects/php-json/php-json-ext-1.2.0.tar.bz2
tar xvjf php-json-ext-1.2.0.tar.bz2
cd php-json-ext-1.2.0
/usr/local/php/bin/phpize #编译前初始化php环境
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
# 安装PDO-mysql
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar -zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
ln -s /usr/local/mysql/include/* /usr/local/include/
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make && make install
#安装npc
wget http://dlwt.iyunv.com/fd.php?i=659714146741849&s=796b68562511c6534bfc15d7b04711f4/npc-2.0.3.tar.gz
tar -zxvf npc-2.0.3.tar.gz
cp -r npc-2.0.3 /usr/local/apache/htdocs/cacti/plugins/npc
三、整合错误
1.In file included from /data1/PDO_MYSQL-1.0.2/pdo_mysql.c:31
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory
In file included from /data1/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL’
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD’
/data1/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:53: error: expected specifier-qualifier-list before ‘MYSQL_RES’
原因:在编译时需要mysql的头的文件,而它按默认搜索找不到头文件的位置,所以才出现这个问题
解决:将 /usr/local/mysql/include/ 目录下的mysql头文件链接到 /usr/local/include/ 的目录下:
ln -s /usr/local/mysql/include/* /usr/local/include/
3.ndo2db: mysql_error: 'Unknown column 'importance' in 'field list''
解决:执行mysql-upgrade-2.0.0.sql
4.npc_commands SET ndo2db-4x: mysql_error: 'Data too long for column 'command_line' at row 1'
解决:扩大npc_commands表中command_line的字段长度
5.localhost ndo2db-4x: mysql_error: 'Unknown column 'long_output' in 'field list''
解决:
alter table nagios_eventhandlers add long_output TEXT NOT NULL after output;
alter table nagios_hostchecks add long_output TEXT NOT NULL after output;
alter table nagios_hoststatus add long_output TEXT NOT NULL after output;
alter table nagios_notifications add long_output TEXT NOT NULL after output;
alter table nagios_servicechecks add long_output TEXT NOT NULL after output;
alter table nagios_servicestatus add long_output TEXT NOT NULL after output;
alter table nagios_statehistory add long_output TEXT NOT NULL after output;
alter table nagios_systemcommands add long_output TEXT NOT NULL after output;