成都网站建设设计

将想法与焦点和您一起共享

Ngiospluginforcacti(NPC)

Ngios plugin forcacti(NPC)

花都ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

1.实验环境:

rhel6.3

cacti,ngios主机:desk32.example.com192.168.122.32

需要的安装包:

ndoutils-1.4b9.tar.gz

php-devel-5.3.3-3.el6_2.8.x86_64.rpm

PDO_MySQL-1.0.2.tgz

cacti的安装配置参见:http://wangziyin.blog.51cto.com/6948950/1305443

nagios的安装配置参见:http://wangziyin.blog.51cto.com/6948950/1305465

2.NPC的安装配置:

(1).npc是cacti的一个插件,其作用是将nagios的监控信息整合到cacti的监控页面中。

(2).npc的安装:

首先确保你的php 支持pdo 和json 模块

选择Setting

Ngios plugin for cacti(NPC)

选择NPC:

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(NPC)

保存退出,

[root@desk32 ~]# vim/usr/local/nagios/etc/nagios.cfg

broker_module=/usr/local/nagios/bin/ndomod.oconfig_file=/usr/local/nagios/etc/ndomod.cfg

[root@desk32 ~]# tar zxf ndoutils-1.4b9.tar.gz

[root@desk32ndoutils-1.4b9]# ./configure –enable-mysql

[root@desk32ndoutils-1.4b9]# make && make install

[root@desk32ndoutils-1.4b9]# cd src/

[root@desk32 src]# cpndomod-3x.o /usr/local/nagios/bin/ndomod.o

[root@desk32 src]# cpndo2db-3x /usr/local/nagios/bin/ndo2db

[root@desk32 src]# cd../config

[root@desk32 config]# cpndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg

[root@desk32 config]# cpndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg

[root@desk32 config]# cd/usr/local/nagios/bin/

[root@desk32 bin]# chownnagios.nagios * -R

[root@desk32 bin]# cd/usr/local/nagios/etc/

[root@desk32 etc]# chownnagios.nagios * -R

[root@desk32 etc]# vimndo2db.cfg

lock_file=/usr/local/nagios/var/ndo2db.lock

ndo2db_user=nagios

ndo2db_group=nagios

socket_type=tcp

socket_name=/usr/local/nagios/var/ndo.sock

tcp_port=5668

use_ssl=0

db_servertype=mysql

db_host=localhost

db_port=3306

db_name=cacti

db_prefix=npc_

db_user=cacti

db_pass=cacti

max_timedevents_age=1440

max_systemcommands_age=10080

max_servicechecks_age=10080

max_hostchecks_age=10080

max_eventhandlers_age=44640

max_externalcommands_age=44640

debug_level=1

debug_verbosity=1

debug_file=/usr/local/nagios/var/ndo2db.debug

max_debug_file_size=1000000

[root@desk32 etc]# vimndomod.cfg

instance_name=default

output_type=tcpsocket

output=127.0.0.1

tcp_port=5668

use_ssl=0

output_buffer_items=5000

buffer_file=/usr/local/nagios/var/ndomod.tmp

file_rotation_interval=14400

file_rotation_timeout=60

reconnect_interval=15

reconnect_warning_interval=15

data_processing_options=-1

config_output_options=2

[root@desk32 etc]#/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

没有报错即可

[root@desk32 etc]# ps ax

6798? Ss 0:00 /usr/local/nagios/bin/ndo2db -c/usr/local/nagios/etc/ndo2db.cfg

[root@desk32 etc]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

[root@desk32 etc]#/etc/init.d/nagios restart

[root@desk32 html]# vim/var/www/html/cacti/include/config.php

打开:$cacti_session_name= "Cacti";

测试:

http://desk32/cacti

选择NPC插件:

然后选择Reporting下的Nagios:

Ngios plugin for cacti(NPC)

可以看见cacti下可以查看nagios的页面.

此时执行cat /var/log/messages 可看到如下报错:

Aug 3003:51:18 desk32 ndo2db: mysql_error: 'Unknown column 'long_output' in'field list''

在NPC下的

Ngios plugin for cacti(NPC)

所有的界面都没有显示:

解决方法如下:

[root@desk32 ~]# mysql-pwestos cacti < add.sql

[root@desk32 ~]# cat add.sql

ALTERTABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

ALTERTABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOTNULL default '' AFTER `output`;

[root@desk32 ~]# tar zxfPDO_MYSQL-1.0.2.tgz

[root@desk32 ~]# cdPDO_MYSQL-1.0.2

[root@desk32 ~]# rpm -ivhphp-devel-5.3.3-3.el6_2.8.x86_64.rpm

[root@desk32PDO_MYSQL-1.0.2]# phpize

如果是源码安装的php与mysql的化可能会出现找不到include文件,与mysql的位置:

{# ln -s/usr/local/lnmp/mysql/include/* /usr/local/include/

[# ./configure --with-php-config=/usr/local/lnmp/php/bin/php-config–with-pdo-mysql=/usr/local/lnmp/mysql/

}

[root@desk32PDO_MYSQL-1.0.2]# ./configure

[root@desk32PDO_MYSQL-1.0.2]# make

[root@desk32PDO_MYSQL-1.0.2]# make install

[root@desk32PDO_MYSQL-1.0.2]# vim /etc/php.ini

添加:extension=pdo_mysql.so

测试:

[root@desk32 html]# vim/var/www/html/index.php

phpinfo();

?>

http://desk32/index.php

出现php包含了pdo_mysql模块,即可以:

Ngios plugin for cacti(NPC)

再访问cacti:http://desk32/cacti

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(NPC)

一切搞定.有什么问题联系!!!!!

西安石油大学计算机学院

王兹银

904483782

mailofwzy@qq.com

2013-10-07

附件:http://down.51cto.com/data/2363583

分享题目:Ngiospluginforcacti(NPC)
链接URL:http://chengdu.cdxwcx.cn/article/gcedds.html