Ngios plugin for cacti(NPC)

发布时间:2020-08-10 07:39:42 作者:木鱼梵心
来源:网络 阅读:4586

Ngios plugin forcacti(NPC)

1.实验环境:

rhel6.3

cactingios主机: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.npccacti的一个插件,其作用是将nagios的监控信息整合到cacti的监控页面中。

2.npc的安装:

首先确保你的php 支持 pdo json 模块

选择Setting

Ngios plugin for cacti(NPC)

选择NPC

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(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

Ngios plugin for cacti(NPC)

可以看见cacti下可以查看nagios的页面.

此时执行cat /var/log/messages 可看到如下报错:

Aug 3003:51:18 desk32 ndo2db: mysql_error: 'Unknown column 'long_output' in'field list''

NPC下的

Ngios plugin for cacti(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

如果是源码安装的phpmysql的化可能会出现找不到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

<?php

phpinfo();

?>

http://desk32/index.php

出现php包含了pdo_mysql模块,即可以:

Ngios plugin for cacti(NPC)

再访问cactihttp://desk32/cacti

Ngios plugin for cacti(NPC)

Ngios plugin for cacti(NPC)

一切搞定.有什么问题联系!!!!!




西安石油大学计算机学院

王兹银

904483782

mailofwzy@qq.com

2013-10-07


附件:http://down.51cto.com/data/2363583
推荐阅读:
  1. 如何在linux中安装php与配置Apache服务器
  2. 如何在centos 7系统中搭建LNMP架构

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

php mysql nagios

上一篇:转发 微博 Qzone 微信 Linux使用「网云穿」【Centos7演示】

下一篇:Oracle表连接操作——Hash Join(哈希连接)上

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》