来自:网络
cacti+nagios+ganglia
cacti,nagios,ganglia整合:(在之前部署好各个监控的条件下)
需要下载这几个包:npc-2.0.4.tar.gz ndoutils-1.5.2.tar.gz ##npc是cacti的一个插件 nagios培训 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,并进行一下设置:
[ /uploads/space/2014/0721/175934_4LBd_1867979.png][/url]
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 nagios实施 添加模块:
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查看。 nagios配置 vim /usr/local/nagios/etc/ndomod.cfg
output_type=tcpsocket
output=127.0.0.1
以npc开头的表里没有字段 `long_output`
add.sql 根据nagios版本以及各插件版本的不同可编辑
nagios高于4.0(包括)
[ /leeypp1/blog/293678#]?[/url]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| 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 nagios安装
[ /leeypp1/blog/293678#]?[/url]
1
2
3
4
5
6
7
8
| 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整合)就出现在同一界面,如下图:
[ /uploads/space/2014/0721/175954_dXwx_1867979.png][/url]
[ /uploads/space/2014/0721/175957_RZ0W_1867979.png][/url]
--leeypp@gmail.com
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流 QQ群号 :476809427
|