Ngiospluginforcacti(NPC)-创新互联
Ngios plugin forcacti(NPC)
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于做网站、成都网站建设、罗源网络推广、微信平台小程序开发、罗源网络营销、罗源企业策划、罗源品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联建站为所有大学生创业者提供罗源建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com1.实验环境:
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
选择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:
可以看见cacti下可以查看nagios的页面.
此时执行cat /var/log/messages 可看到如下报错:
Aug 3003:51:18 desk32 ndo2db: mysql_error: 'Unknown column 'long_output' in'field list''
在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模块,即可以:
再访问cacti:http://desk32/cacti
一切搞定.有什么问题联系!!!!!
西安石油大学计算机学院
王兹银
904483782
mailofwzy@qq.com
2013-10-07
附件:http://down.51cto.com/data/2363583另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享题目:Ngiospluginforcacti(NPC)-创新互联
网址分享:http://pwwzsj.com/article/degesh.html