# 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
# /usr/local/php/bin/phpize
#./configure --with-php-config=/usr/bin/php-config
#make
#make install 修改数据库结构:
# mysql -u root –p
mysql> usr cacti; //复制粘贴如下内容即可
alter table npc_eventhandlers add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_hostchecks add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_hoststatus add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_notifications add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_servicechecks add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_servicestatus add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_statehistory add long_output TEXT NOT NULL default '' afteroutput;
alter table npc_systemcommands add long_output TEXT NOT NULL default '' afteroutput; 重新启动服务:
# service httpd restart
# service mysqld restart
# service nagios restart
之后再访问就可看到有数据了:
当查看/var/log/message文件时,出现如下错误,也请添加数据库
Nov 14 14:47:30 localhost ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO npc_servicechecks SET instance_id='0', service_object_id='0', check_type='0',