开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合

nagios和cacti的安装请参考之前的文章安装,这里介绍二者如何整合在一起。


ndoutils将nagios的监控数据写入数据库

cacti则将ndoutil插件写入数据库的数据展示在页面上,因为数据写入数据库会因为各种因素延时,所以有时候nagios自身的页面有的监控项已经告警,但是cacti页面可能还是正常状态。

所以这套方案的核心还是nagios,所有监控和故障通知都由nagios完成,cacti只是担任web管理页面。


1.修改数据库结构

mysql> use nagios;
mysql> alter table npc_eventhandlers add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_hostchecks add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_hoststatus add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_notifications add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_servicechecks add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_servicestatus add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_statehistory add long_output TEXT NOT NULL default '' after output;
mysql> alter table npc_systemcommands add long_output TEXT NOT NULL default '' after output; 


2.cacti开启插件功能

#tar  -zxvf cacti-plugin-0.8.7h-PA-v3.0.tar.gz
#cp -R cacti-plugin-arch/* /var/www/html/cacti/
#cd /var/www/html/cacti/
#mysql -unagios -p nagios <pa.sql
#patch -p1 -N  <cacti-plugin-0.8.7h-PA-v3.0.diff 


3.安装NPC插件

#wget http://www.cactifans.org/plugins/npc.tar.gz
#tar -zxvf npc.tar.gz -C /var/www/html/cacti/plugins/


4.cacti设置

console->Plugin Management->Action

安装和激活NPC插件

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合


配置NPC插件

console->Plugin Management->Settings

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合


如果一切正常点开NPC你就可以看到如下图片所示的界面:

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合