码迷,mamicode.com
首页 > 其他好文 > 详细

npc

时间:2014-07-22 22:37:55      阅读:456      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   文件   io   

cacti+nagios+ganglia

cacti,nagios,ganglia整合:(在之前部署好各个监控的条件下)

需要下载这几个包:npc-2.0.4.tar.gz    ndoutils-1.5.2.tar.gz        ##npc是cacti的一个插件

Installing NPC :

tar zxf npc-2.0.4.tar.gz   -C   /var/www/html/cacti/plugins

Nagios Command File Path /usr/local/nagios/var/rw/nagios.cmd

cacti界面plugin安装激活npc,并进行一下设置:

 bubuko.com,布布扣

Configuring Nagios :

tar zxf ndoutils-1.5.2.tar.gz        ##ndoutils是一个模块

cd ndoutils-1.5.2

./configure && make

vim /usr/local/nagios/etc/nagios.cfg

broker_module=/usr/local/nagios/bin/ndomod.o  config_file=/usr/local/nagios/etc/ndomod.cfg

添加模块:

cd ndoutils-1.5.2/src

cp ndomod-3x.o    /usr/local/nagios/bin/ndomod.o

chmod +x /usr/local/nagios/bin/ndomod.o        ##添加可执行权限

chown   nagios.nagios   /usr/local/nagios/bin/ndomod.o        ##添加用户和用户组

cp ndo2db-3x /usr/local/nagios/bin/ndo2db

chmod +x   /usr/local/nagios/bin/ndo2db

chown   nagios.nagios   /usr/local/nagios/bin/ndo2db

cd  ndoutils-1.5.2/config

cp  ndo2db.cfg-sample   /usr/local/nagios/etc/ndo2db.cfg

chmod +x   /usr/local/nagios/etc/ndo2db.cfg

chown   nagios.nagios   /usr/local/nagios/etc/ndo2db.cfg

cp ndomod.cfg-sample    /usr/local/nagios/etc/ndomod.cfg

chmod +x  /usr/local/nagios/etc/ndomod.cfg

chown   nagios.nagios  /usr/local/nagios/etc/ndomod.cfg

vim /usr/local/nagios/etc/ndo2db.cfg

socket_type=tcp 

#socket_type=tcp

tcp_port=5668 

db_name=cacti

db_prefix=npc_ #以npc开头的表

db_user=cacti 

db_pass=123 

debug_verbosity=1 

若忘记cacti密码, vim  /var/www/html/cacti/include/config.php查看。

vim /usr/local/nagios/etc/ndomod.cfg

output_type=tcpsocket 

output=127.0.0.1

以npc开头的表里没有字段 `long_output`

add.sql    根据nagios版本以及各插件版本的不同可编辑

nagios高于4.0(包括)

CREATE TABLE IF NOT EXISTS `npc_service_parentservices` (
  `service_parentservice_id` int(11) NOT NULL auto_increment,
  `instance_id` smallint(6) NOT NULL default ‘0‘,
  `service_id` int(11) NOT NULL default ‘0‘,
  `parent_service_object_id` int(11) NOT NULL default ‘0‘,
  PRIMARY KEY  (`service_parentservice_id`),
  UNIQUE KEY `instance_id` (`service_id`,`parent_service_object_id`)
) ENGINE=MyISAM  COMMENT=‘Parent services‘;
ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_services` ADD COLUMN `importance` varchar(8192) NOT NULL default ‘‘ AFTER `icon_image_alt`;
ALTER TABLE `npc_contacts` ADD COLUMN `minimum_importance` varchar(8192) NOT NULL default ‘‘ AFTER `notify_host_downtime`;
ALTER TABLE `npc_hosts` ADD COLUMN `importance` varchar(8192) NOT NULL default ‘‘ AFTER `z_3d`;

nagios版本低于4.0

ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;
ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default ‘‘ AFTER `output`;

把这个字段添加到cacti仓库 mysql -p123 cacti < add.sql

开启ndo2db:    /usr/local/nagios/bin/ndo2db   -c   /usr/local/nagios/etc/ndo2db.cfg

把开启程序写到开机文件里

vim /etc/rc.local

/usr/local/nagios/bin/ndo2db   -c   /usr/local/nagios/etc/ndo2db.cfg

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

/etc/init.d/nagios reload

如果没有问题的话,cacti和nagios(nagios已经和ganglia整合)就出现在同一界面,如下图:

bubuko.com,布布扣

bubuko.com,布布扣

 

  


npc,布布扣,bubuko.com

npc

标签:style   http   color   os   文件   io   

原文地址:http://my.oschina.net/leeypp1/blog/293678

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!