Nagios+Cacti整合

所需安装包


安装ndoutils

 tar xzvf ndoutils-1.4b9.tar.gz
 ls
 cd ndoutils-1.4b9
 ls
 ./configure
 make
 make install


更新配置文件

cd src/
ls
cp ndomod-3x.o ndo2db-3x file2sock log2ndo /usr/local/nagios/bin/
cd ../config
cp ndo2db.cfg-sample ndomod.cfg-sample /usr/local/nagios/etc/
cd /usr/local/nagios/etc/
ls
mv ndo2db.cfg-sample ndo2db.cfg
mv ndomod.cfg-sample ndomod.cfg
chmod 644 ndo2db.cfg
chown nagios.nagios *
cd ..
chown nagios.nagios bin/*


修改配置文件


vim /etc/nagios/nagios.cfg

在文件中添加: 添加以下一行(注意下面只能是一行,否则nagios启动报错)broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg


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

socket_type=tcp

db_servertype=mysql

db_host=127.0.0.1

db_port=3306

db_name=cacti

db_prefix=npc_

db_user=cacti

db_pass=cacti


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

output_type=tcpsocket

  output=127.0.0.1

#output=/var/www/html/nagios//var/ndo.sock

buffer_file=/var/www/html/nagios/var/ndomod.tmp



cp daemon-init /etc/init.d/ndo2db
vim /etc/init.d/ndo2db
cd /etc/init.d
chmod +x ndo2db
/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg



vim /etc/init.d/ndo2db

Ndo2dbBin=/usr/local/nagios/bin/ndo2db-3x

Ndo2dbCfgFile=/usr/local/nagios/etc/ndo2db.cfg

Ndo2dbVarDir=/usr/local/nagios/var

chmod +x /etc/init.d/ndo2db  





安装npc


tar xzvf cacti-plugin-0.8.7h-PA-v3.0.tar.gz
ls
cd cacti-plugin-arch/
cd ..
ls
cp -R cacti-plugin-arch/* /var/www/html/cacti/
cd /var/www/html/cacti/
ls
mysql -ucacti -pcacti cacti < pa.sql
vim include/config.php


vim include/config.php

修改(或新加入)为

 $url_path = "/cacti/";


打开插件管理功能:

打开“Console----> User Management----> admin”然后在“Realm Permissions”

项卡中勾选“Plugin Management”,然后点击Save 进行保存!  

此时我们会在控制台---> Configuration 选项卡下多了一个Plugin Management 选项卡,到此cacti 架构扩展完成!!




安装npc

1
2
3
4
cd /soft
tar zxvf npc- 2.0 . 4 .tar.gz
mv npc / var /www/html/cacti/plugins/
vim / var /www/html/cacti/ include /config.php

加入:

        $plugins[] = 'npc';


修改mysql中的表结构:

1
2
3
4
5
6
7
8
9
10
mysql
use  cacti;
alter table npc_eventhandlers add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_hostchecks add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_hoststatus add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_notifications add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_servicechecks add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_servicestatus add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_statehistory add long_outputTEXT NOT NULL  default  ''  after output;
alter table npc_systemcommands addlong_output TEXT NOT NULL  default  ''  after output;

1
2
service ndo2db restart
     service nagios restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值