或者源码安装
# tar xf php-json-ext-1.2.1.tar.gz
# cd php-json-ext-1.2.1
# phpize
# sh configure && make && make install 2、新建文件,添加信息如下:
# vim /etc/php.d/json.ini
extension=json.so
安装完成后如果先验证的话,可以写个index.php的页面看下,有json信息即可,如下:
[root@localhost~]# vim /var/www/html/index.php
但是看npc里发现空白的,没有数据,是因为php没有PDO_MYSQL支持,所以安装PDO_MYSQL
查看index.php网页,看是否安装过pdo-mysql,如果没安装,执行下面操作安装 http://blog.运维网.com/attachment/201311/145146368.png
# 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> use cacti; //复制粘贴如下内容即可
alter table npc_eventhandlers add long_output TEXT NOT NULL default '' after output;
alter table npc_hostchecks add long_output TEXT NOT NULL default '' after output;
alter table npc_hoststatus add long_output TEXT NOT NULL default '' after output;
alter table npc_notifications add long_output TEXT NOT NULL default '' after output;
alter table npc_servicechecks add long_output TEXT NOT NULL default '' after output;
alter table npc_servicestatus add long_output TEXT NOT NULL default '' after output;
alter table npc_statehistory add long_output TEXT NOT NULL default '' after output;
alter table npc_systemcommands add long_output TEXT NOT NULL default '' after output; 重新启动服务:
# service httpd restart
# service mysqld restart
# service nagios restart
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',