nagios与cacti的整合

9、nagios与cacti的整合

9.1 ndoutils安装

tar -zxvf ndoutils-1.4b9.tar.gz

cd ndoutils-1.4b9

./configure –prefix=/var/www/localhost/htdocs/nagios 

--with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios

Make不需要make install

cd src/

cp ndomod-3x.o ndo2db-3x log2ndo file2sock /var/www/localhost/htdocs/nagios/bin

cd ../config

cp ndo2db.cfg-sample /var/www/localhost/htdocs/nagios/etc/ndo2db.cfg

cp ndomod.cfg-sample /var/www/localhost/htdocs/nagios/etc/ndomod.cfg

cd /var/www/localhost/htdocs/nagios/etc

vi ndo2db.cfg

socket_name=/var/www/localhost/htdocs/nagios/var/ndo.sock

db_name=cactidb

db_prefix=npc_ 

db_user=cactiuser

db_pass=cactipass

debug_level=1

debug_file=/var/www/localhost/htdocs /nagios/var/ndo2db.debug

 

vi ndomod.cfg

output=/var/www/localhost/htdocs/nagios/var/ndo.sock

buffer_file=/var/www/localhost/htdocs/nagios/var/ndomod.tmp

9.2 开启ndo2db服务

Cd /var/www/localhost/htdocs/nagios/

Bin/nagios –d etc/nagios.cfg

Bin/ndo2db –c etc/ndo2db.cfg

9.3 NPC的安装

Tar zxvf npc-2.0.4.tar.gz –C /var/www/localhost/htdocs/cacti/plugins/

登录cacti管理界面

点击”Console”->”plugin Management”->安装并打开NPC界面,如下图

155107890.png

9.4 NPC配置

点击”console”->”settings”->”NPC”,配置nagios访问路径和nagiosNaNd路径

155140331.png

9.5 修改几个错误的按钮

Vi /var/www/htdoc/localhost/cacti/plugins/npc/ top_graph_header.php

 

95行修改红色部分

<td id="gtabs" nowrap>

<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="'. $config['url_path'] . 'graph_settings.php"><img src="'. $config['url_path'] . 'images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings"></a>';}?>&nbsp;&nbsp;<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=tree"><img src="<?php echo $config['url_path']; ?>images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=list"><img src="<?php echo $config['url_path']; ?>images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=preview"><img src="<?php echo $config['url_path']; ?>images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View"></a><?php }?>&nbsp;<br>

</td>


 

修改为

<td id="gtabs" nowrap>

<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="'. $config['url_path'] . 'graph_settings.php"><img src="'. $config['url_path'] . 'images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings"></a>';}?>&nbsp;&nbsp;<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=tree"><img src='images/tab_mode_tree.gif' border="0" title="Tree View" alt="Tree View"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=list"><img src='images/tab_mode_list.gif' border="0" title="List View" alt="List View"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=preview"><img src='images/tab_mode_preview.gif' border="0" title="Preview View" alt="Preview View"></a><?php }?>&nbsp;<br>

</td>

 










本文转自 chengchow 51CTO博客,原文链接:http://blog.51cto.com/chengchow/970979,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值