Cacti插件安装使用

 Version 0.8.8a已经集成了PIA(Plugin Architecture)

 

http://hi.baidu.com/yavg/blog/item/ee1f0d4c98feabfcd62afcba.html

139邮箱的SMTP设置
2008年05月23日 星期五 上午 12:16
由于官方写的不详细,我问了几个移动MM也无从回答,我自己最后试出来的。
POP.139.COM   110
SMTP.139.COM 25
用户名最好填写完整的MAIL地址(我试了就手机号也行)主要是方便SMTP的设置。

像这类端设置都没有SSL加密,发件99%都要身份验证,在SMTP.139.COM身份验证时要写完整的mail的地址(手机号不行哟)。

 

http://www.osyunwei.com/archives/3067.html

三、设置CactiEZ对Windows和Linux进行监控

以下操作在登录http://192.168.21.175/之后进行

1、添加对Windows主机的监控

管理-主机,点添加

相关选项都有具体中文说明:

特别注意:

主机名:要监控的主机的IP地址,这里是192.168.21.130

主机模板:选择Windows主机

监视主机:后面打勾,表示启用

SNMP团体名称:务必要与Windows主机之前设置的SNMP团体名称相同,否则监控失败,这里是public

SNMP端口:默认是161

其他选项默认即可

最后,点保存,会出现下面的界面

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

点击为这个主机添加图形,根据自己需要监控的对象选中右边的复选框,点添加

注意,最后一项,选择一个图形类型,32位主机选择流入/流出 位 ;64位主机选择流入/流出 (64位)

出现下面界面,再点添加

点上面导航栏的监视器,进入监视界面

点击打开我们刚才添加的主机,已经可以看到监控的图形了,只是这个时候还没有数据,数据采集是1分钟轮询一次

等待几分钟之后,刷新,会看到下面的界面,这个时候已经有了监控数据了。

Windows 主机监控设置完成

2、添加对Linux主机的监控

添加方法与Windows相同

注意:主机名字填写Linux主机的IP,主机模板选择Linux主机

最后点添加,再点 为这个主机添加图形,根据自己需要监控的对象选中右边的复选框,点添加

出现下面界面,再点添加

然后点上面导航栏的监视器,进入监视界面,选择刚才添加的Linux主机

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

同样等待几分钟之后,会看到如下的监控数据

Linux 主机监控设置完成

3、设置CactiEZ邮件报警功能

控制台-配置-设置-邮件/域名解析

这里我们使用163的邮箱来发信,如果没有163邮件,请注册一个!

测试邮件:******@163.com 这里填写一个测试的收件地址,可以是QQ邮箱等其他邮箱,

也可以填写与发件人地址相同的邮箱,即自己给自己发一份测试邮件

邮件服务:SMTP

发件人地址:******@163.com

发件人:www.osyunwei.com

SMTP服务器主机名:smtp.163.com

SMTP端口:25

SMTP用户名:****** 这里填写发信邮箱的用户名(邮件地址中@163.com前面的部分就是用户名)

SMTP密码:****** 输入你的电子邮箱登陆密码

主要DNS服务器的IP地址:8.8.8.8

次要DNS服务器IP地址:8.8.4.4

设置好之后 保存 ,再点右上角的“发送一封测试邮件”

看到下面的信息表示邮件测试成功

同时163的邮箱也会收到一封测试邮件

最后,切换到 报警/阀值 选项

主机宕机通知:后面打勾

主机宕机通知邮件:******@139.com 这里填写主机宕机时的收信邮件地址,推荐使用移动的139免费邮箱

当主机宕机的时候,会从******@163.com 自动发送一份宕机报告邮件到******@139.com 邮箱,

同时你的手机也会收到一条短信提示,即使当时你没有看到邮件,通过查看短信也能随时随地监控您的主机运行状态

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接

邮件选项

发件人地址:******@163.com

发件人名称:www.osyunwei.com

最后保存

现在,CactiEZ邮件报警功能设置完成,如果有某一台主机宕机的话,上面设置的139邮箱会收到一封宕机邮件,

同时手机也会收到一条短信

至此,CactiEZ 中文版V10.1安装使用以及139邮箱短信报警设置完成

系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

======================

# ls *.diff
cacti-plugin-0.8.7g-PA-v2.9.diff
# patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.9.diff
patching file auth_changepassword.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file auth_changepassword.php.rej
patching file auth_login.php
Hunk #1 FAILED at 124.
Hunk #2 FAILED at 191.
Hunk #3 FAILED at 279.
Hunk #4 FAILED at 326.
4 out of 4 hunks FAILED -- saving rejects to file auth_login.php.rej
patching file cli/add_graph_template.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file cli/add_graph_template.php.rej
patching file cli/add_tree.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file cli/add_tree.php.rej
patching file cli/host_update_template.php
Hunk #1 FAILED at 136.
1 out of 1 hunk FAILED -- saving rejects to file cli/host_update_template.php.rej
patching file data_sources.php
Reversed (or previously applied) patch detected! Skipping patch.
6 out of 6 hunks ignored -- saving rejects to file data_sources.php.rej
patching file graph_image.php
Hunk #1 succeeded at 55 with fuzz 2 (offset 11 lines).
patching file graph.php
Hunk #1 succeeded at 35 (offset 3 lines).
Hunk #2 FAILED at 82.
Hunk #3 FAILED at 111.
Hunk #4 succeeded at 146 with fuzz 2 (offset 24 lines).
Hunk #5 FAILED at 249.
Hunk #6 FAILED at 282.
4 out of 6 hunks FAILED -- saving rejects to file graph.php.rej
patching file graphs_new.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file graphs_new.php.rej
patching file graphs.php
Reversed (or previously applied) patch detected! Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file graphs.php.rej
patching file host.php
Reversed (or previously applied) patch detected! Skipping patch.
7 out of 7 hunks ignored -- saving rejects to file host.php.rej
The next patch would create the file images/disable_icon.png,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/disable_icon.png.rej
The next patch would create the file images/enable_icon_disabled.png,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/enable_icon_disabled.png.rej
The next patch would create the file images/enable_icon.png,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/enable_icon.png.rej
The next patch would create the file images/install_icon_disabled.png,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/install_icon_disabled.png.rej
The next patch would create the file images/install_icon.png,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/install_icon.png.rej
The next patch would create the file images/uninstall_icon.gif,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/uninstall_icon.gif.rej
The next patch would create the file images/view_none.gif,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file images/view_none.gif.rej
patching file include/auth.php
Reversed (or previously applied) patch detected! Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file include/auth.php.rej
patching file include/bottom_footer.php
Hunk #1 FAILED at 21.
Hunk #2 FAILED at 36.
2 out of 2 hunks FAILED -- saving rejects to file include/bottom_footer.php.rej
patching file include/config.php
Hunk #1 succeeded at 38 with fuzz 2 (offset 8 lines).
patching file include/global_arrays.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file include/global_arrays.php.rej
patching file include/global_constants.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/global_constants.php.rej
patching file include/global_form.php
Hunk #1 FAILED at 22.
Hunk #2 FAILED at 1191.
2 out of 2 hunks FAILED -- saving rejects to file include/global_form.php.rej
patching file include/global.php
Hunk #1 succeeded at 104 with fuzz 2 (offset 11 lines).
Hunk #2 FAILED at 206.
Hunk #3 succeeded at 223 with fuzz 2 (offset 9 lines).
1 out of 3 hunks FAILED -- saving rejects to file include/global.php.rej
patching file include/global_settings.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/global_settings.php.rej
The next patch would create the file include/plugins.php,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file include/plugins.php.rej
patching file include/top_graph_header.php
Hunk #1 succeeded at 31 with fuzz 2 (offset 6 lines).
Hunk #2 FAILED at 60.
Hunk #3 FAILED at 127.
Hunk #4 FAILED at 135.
Hunk #5 FAILED at 164.
4 out of 5 hunks FAILED -- saving rejects to file include/top_graph_header.php.rej
patching file include/top_header.php
Hunk #1 FAILED at 22.
Hunk #2 FAILED at 80.
Hunk #3 FAILED at 88.
Hunk #4 FAILED at 101.
4 out of 4 hunks FAILED -- saving rejects to file include/top_header.php.rej
patching file index.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file index.php.rej
patching file lib/api_automation_tools.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/api_automation_tools.php.rej
patching file lib/api_device.php
Hunk #1 succeeded at 145 with fuzz 2 (offset 8 lines).
Hunk #2 FAILED at 186.
1 out of 2 hunks FAILED -- saving rejects to file lib/api_device.php.rej
patching file lib/api_graph.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file lib/api_graph.php.rej
patching file lib/api_tree.php
Hunk #1 FAILED at 44.
1 out of 1 hunk FAILED -- saving rejects to file lib/api_tree.php.rej
patching file lib/auth.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file lib/auth.php.rej
patching file lib/data_query.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file lib/data_query.php.rej
patching file lib/functions.php
Reversed (or previously applied) patch detected! Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file lib/functions.php.rej
patching file lib/html_form.php
Hunk #1 succeeded at 1 with fuzz 1.
Hunk #2 succeeded at 527 (offset -4 lines).
Hunk #3 FAILED at 726.
1 out of 3 hunks FAILED -- saving rejects to file lib/html_form.php.rej
patching file lib/html.php
Reversed (or previously applied) patch detected! Skipping patch.
8 out of 8 hunks ignored -- saving rejects to file lib/html.php.rej
patching file lib/html_tree.php
Hunk #2 succeeded at 995 with fuzz 2 (offset 10 lines).
Hunk #3 succeeded at 1180 with fuzz 1 (offset -19 lines).
The next patch would create the file lib/plugins.php,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/plugins.php.rej
patching file lib/poller.php
Hunk #1 FAILED at 344.
1 out of 1 hunk FAILED -- saving rejects to file lib/poller.php.rej
patching file lib/rrd.php
Hunk #1 succeeded at 459 with fuzz 2 (offset 40 lines).
Hunk #2 succeeded at 1436 (offset 894 lines).
Hunk #3 FAILED at 2277.
Hunk #4 FAILED at 2292.
2 out of 4 hunks FAILED -- saving rejects to file lib/rrd.php.rej
patching file lib/template.php
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/template.php.rej
patching file lib/variables.php
Hunk #1 succeeded at 186 with fuzz 2 (offset 3 lines).
patching file plugins/index.php
The next patch would create the file plugins.php,
which already exists! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file plugins.php.rej
patching file poller.php
Reversed (or previously applied) patch detected! Skipping patch.
5 out of 5 hunks ignored -- saving rejects to file poller.php.rej
patching file user_admin.php
Reversed (or previously applied) patch detected! Skipping patch.
4 out of 4 hunks ignored -- saving rejects to file user_admin.php.rej
patching file utilities.php
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file utilities.php.rej

===========================================

http://os.51cto.com/art/201103/251727.htm

http://docs.cacti.net/plugins

 

 

...

http://summervast.blog.51cto.com/690507/337877

cacti不仅把所统计的流量以图像显示出来,而且还能通过插件使得cacti的功能得到进一步的提升。Cacti插件是对cacti的扩展,要使用cacti插件必须先扩展cacti架构,来支持插件。为了让cacti能够使用插件,必须先给cacti安装一个补丁->Plugin Architecture。由于对应不同的cacti的版本,都会有相应的PA。所以在安装PA的时候,一定要选择正确的版本。在cactiusers.org你会找到不同的插件和PA。

PA 与cacti版本的关系:

PA 1.0 = cacti 0.8.6i

PA 1.1 = cacti 0.8.6i et 0.8.6j

PA 2.0 = cacti 0.8.7b

PA 2.2 = cacti 0.8.7c

PA 2.4 = cacti 0.8.7d

PA 2.5 = cacti 0.8.7e


因为之前安装的cacti的版本是0.8.7e所以就使用ccacti-plugin-0.8.7e-PA-v2.5.zip来进行安装;
一、安装PA
[root@dns plugin]# pwd
/home/redhat/cacti/plugin
[root@dns plugin]# unzip cacti-plugin-0.8.7e-PA-v2.5.zip
解压出来的有cacti-plugin-0.8.7e-PA-v2.5.diff 和pa.sql是我们最需要的;这里不防看一下Readme.txt文档
http://cactiusers.org/wiki/Homepage


[root@dns plugin]# cp -R * /usr/www/www/cacti 
(或者直接把tar包拷贝到cacti目录下面在解压)
把刚才解压到文件全部移到cacti目录下,在做这一步之前先备份整个cacti目录;[root@dns www]#cp -rv cacti cacti.bak
[root@dns www]#cd cacti
[root@dns cacti]# pwd
/usr/www/www/cacti
[root@dns plugin]# mysql -u cacti -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 573 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cacti              |
| test               |
+--------------------+
3 rows in set (0.02 sec)

mysql> use cacti;
Database changed
mysql> source pa.sql;          (导入数据库)
Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.01 sec)

Query OK, 1 row affected (0.00 sec)

mysql> quit
Bye
安装补丁:
[root@dns cacti]# patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.5.diff
如果是通过"http://ip/cacti/“的URL访问,要修改global.php:
[root@dns cacti]#vi include/global.php

修改
     33 /* Default database settings*/
     34 $database_type = "mysql";
     35 $database_default = "cacti";
     36 $database_hostname = "localhost";
     37 $database_username = "cacti";
     38 $database_password = "cacti";
     39 $database_port = "3306";

和原来配置cacti时一样;
修改第56行改为 : $config['url_path'] = '/cacti/';

授权admin用户"plugin Management":
登录后,Utilities--User Management--admin--Realm Permissions,选中“Plugin Management",Save。



会在console-configuration下面多出一个plugin management,进入到里面会看到安装插件的版本;

二、安装monitor、settings、thold插件
monitor:通过简单明了的图标提供服务器的运行状态      
settings:给不同的插件提供一些共用的信息,如邮件信息,dns信息。

thold :提供设备异常预警。


http://cactiusers.org/wiki/PluginsInstall 上面例子

      wget http://cactiusers.org/downloads/settings.tar.gz

      wget http://cactiusers.org/downloads/monitor.tar.gz
      wget http://cactiusers.org/downloads/thold.tar.gz


1)、[root@dns cacti]#
直接把三个插件tar包cp到安装目录cacti下的plugins中;
[root@dns plugins]#tar -zxvf monitor-0.8.2.tar.gz
得到monitor目录
[root@dns plugins]# tar -zxvf settings-0.5.tar.gz
得到settings 目录
[root@dns plugins]# tar -zxvf thold-0.4.1.tar.gz
得到 thold目录

2)、如果是升级安装,只需要完全覆盖原目录即 可。

    


3)、激活monitor插件,修改cacti配置文件(cacti目录下的include/config.php)。在配置中查找到第44行$plugins = array();,在此

行下面加入:
     $plugins[] = 'monitor';
     $plugins[] = 'settings';
     $plugins[] = 'thold';


注意:上面monitor的名字必须与 cacti/plugins/目录下插件目录的名字相同。


4).有些插件需要进行额外的配置,请根据插件的安装文档进行配置,在此略述。

5).移除插件时只要修改cacti配置文件,注释掉与插件相关的行即可。
如://$plugins[] = 'monitor';

6)、保存推出, 在console-Plugin Management会看到安装的monitor插件




7)、导入数据库monitor 与thold的数据库文件按
[root@dns plugins]# ls
index.php  monitor  monitor-0.8.2.tar.gz  settings  settings-0.5.tar.gz  thold  thold-0.4.1.tar.gz
[root@dns plugins]# pwd
/usr/local/www/cacti/plugins

[root@dns plugins]#mysql -u cacti -p
mysql> use cacti;
Database changed
mysql> source monitor/monitor.sql

mysql> source thold/thold.sql
mysql>exit
一定要确保导入的过程中没有错误出现;

==================================================================
上面这两步很关键,我在这个上面实验了几次,有的会出现如下错误:
ERROR 1060 (42S21): Duplicate column name 'monitor'
ERROR 1060 (42S21): Duplicate column name 'monitor_text'
Query OK, 2 rows affected (0.00 sec)
是什么问题呢


ERROR 1050 (42S01): Table 'plugin_thold_log' already exists
Query OK, 1 row affected (0.00 sec)


这样的话就直接造成后面不能在Templates->Threshold Templates中添加,会提示







我还不知道怎么去解决这两个问题, 大牛知道了可以在下面回帖,多谢了!!
===================================================================
8)、授权使用;
进入"Console"->"User Management"->"admin"->Realm Permissions把View Monitoring 打勾



9)、保存,在页面上看到:


10)、当点击"monitor"的时候发现会有一句错误

      Warning: Invalid argument supplied for foreach() in /usr/www/www/cacti/plugins/monitor/monitor.php on line 199

进入到该目录打开这个文件,发现一句:AND thold_enabled = "on",是不是因为咱们现在还没启用thold呢?那咱们就先启用thold:

11)、点击"Plugin Management":

先点"Install"再点"Enable" 然后在点击monitor 就没有提示了:




12).在console选项卡下,点击左侧菜单中的Settings链接,在右侧出现的web页中点击Misc选项卡来配置Monitor插件。


*上述中可以调整Monitor的各项配置。例如:勾选“Show Icon Legend”可以在监控页面显示图例;“View”可以选用Tiles类型,以显示设备状态表格。
*为cacti添加新设备时,勾选上“Monitor Host”项。对已添加的设备可以通过“Management->Devices”进去修改。
*单击Web页面上方的“monitor”标签链接,可以进入查看各设备/主机的状态图示。


以下所看到的是Monitor选项卡下所监控的机器状态。当有机器Down掉后,相应机器图标将由绿色变成红色,并发出声音进行报警。






13)、使用thold插件

*打开“Console->Settings->Mail/DNS”,可以调整“SMTP Options”和“DNS Options”等配置,用于确保预警邮件能够发出。


 网上大牛建议mail servers选择smtp,并正确设置smtp和dns信息。因为无论选择phpmail还是sendmail都要使用sendmail这程序,都要装 一个邮件系统。没有必要吧,多一个程序多一个风险。设置完了可以点一下右上角的"Send a Test Email"以确定配置正确)

"send a test mail"测试一下设置是否正确,一般都会成功的,到收件箱中就会收到一封测试邮件;
S

14)、Console->Settings->Alerting/Thold配置出现问题的时候有邮件通知,Alerting/Thold可以调整Thold的各项配置。例如:“Dead Host Notifications Email”处可填写设备宕机时发送警告信息到哪个邮箱;勾选“Send alerts as text”项,设置只发送文本格式的邮件。在"Default Alerting Options"里,启用"Dead Hosts Notificatios"并正确填写警告的邮件地址:




15)、Templates->Threshold Templates,可以添加、取出需要关联到预警系统的模板,例如:可以添加和“Interface-Traffic”模板的关联,如“traffic_in”、“traffic_out”数据项,分别设置警告阈值“High Threshold”(如200000000比特/秒);

16)、打开“Create->New Graphs”,选择需要提供预警的设备,单击右侧上方的“Auto-create thresholds”创建预警项目。


17)、打开“Management->Thresholds”,可以管理已经创建的预警项目。




做到这里,基本上对cacti有了一些基本的了解,还需继续深入的去研究学习;后续做cacti的多种监控;

 

 

http://blog.sina.com.cn/s/blog_4e424e2101000b7j.html

 

声明:本系列文档出自石头记,如若转载请注明出处,本人保留文档的所有权,并欢迎转载。

一、Cacti插件

 

Cacti插件是对cacti的扩展。

要使用cacti插件必须先扩展cacti架构,来支持插件。

1.    安装cacti插件架构扩展

下载地址:http://cactiusers.org/downloads/patches/

当前版本是V1.1,是专门针对cacti V0.8.6设计的。

1).解压下载的tar包,你会得到一个cacti-plugin-arch目录

# tar –zxvf cacti-plugin-arch.tar.gz

# cd cacti-plugin-arch

# ls

使用Cacti监控你的网络(五)- <wbr>Cacti插件

 

2).有两中方法来安装cacti的插件架构扩展,第一种方法是使用patch文件,patch文件包含了原始文件与修改后文件的不同之处,所以可以使用patch文件来得到新的文件。第二种方法是使用pre-patched文件进行直接覆盖,将与cacti相对应版本的files-0.8.6*目录下的文件直接拷贝到cacti目录下进行覆盖。在此选择使用patch文件进行安装(这也是官网推荐的方法)。将与cacti相应版本的cacti-pligin-0.8.6*.diff文件拷贝到cacti目录下,然后使用patch命令进行安装。

# cp cacti-plugin-0.8.6j.diff /usr/local/apache/htdocs/cacti

//备份cacti目录,以备插件扩展安装失败后能恢复到原状态

# cd /usr/local/apache/htdocs

# cp –r cacti ./cacti.bak

# cd ./cacti

//首先使用以下命令进行测试

patch -p1 -N --dry-run < cacti-plugin-0.8.6j.diff

//以上命令成功后,使用以下命令进行安装

# patch -p1 -N < cacti-plugin-0.8.6j.diff

3).安装后配置,首先查看你的cacti配置文件,看cacti相关的数据库信息是否被覆盖,如果被覆盖请直接从备份中拷贝一份到配置文件目录。

# cp ../include/config.php ./include/config.php

打开cacti配置文件,找到以下选项

$config['url_path'] = "/";

如过你的cacti能够在浏览器中使用以下方法直接访问,则不用修改cacti配置文件。

http://www.youdomain.com 或

http://cacti机器ip

           如果cacti在浏览器中使用以下方法直接访问,

           http://www.youdomain.com/cacti 或

           http://cacti机器ip/cacti

$config['url_path'] = "/";必须被修改为$config['url_path'] = "/cacti/";

           注意前后的/不能丢。

           到此cacti插件结构的扩展完成,现在可以下载并安装你需要的cacti插件了。

     

1.    安装插件

插件的安装、升级、移除是很容易的,在安装插件前你必须以确保安装了cacti插件结构扩展。

1).下载插件,在此以Monitor插件为例。

      Monitor插件下载地址:http://cactiusers.org/downloads/

      解压下载的tar包。

      # tar -zvcf monitor-0.7.tar.gz

      解压后你会得到一个monitor目录。

2.安装Monitor,只需要将monitor目录拷贝到cacti/plugins/目录下即可。如果是升级安装,只需要完全覆盖原monitor目录即可。

3.激活monitor插件,修改cacti配置文件(cacti目录下的include/config.php)。在配置中查找$plugins = array();行,在此行下面加入:

$plugins[] = 'monitor';

注意:上面monitor的名字必须与cacti/plugins/目录下插件目录的名字相同。

4).有些插件需要进行额外的配置,请根据插件的安装文档进行配置,在此略述。

5).移除插件时只要修改cacti配置文件,注释掉与插件相关的行即可。

如:

            //$plugins[] = 'monitor';

6).在console选项卡下,点击左侧菜单中的Settings链接,在右侧出现的web页中点击Misc选项卡来配置Monitor插件。

使用Cacti监控你的网络(五)- <wbr>Cacti插件

 

以下所看到的是Monitor选项卡下所监控的机器状态。当有机器Down掉后,相应机器图标将由绿色变成红色,并发出声音进行报警。

使用Cacti监控你的网络(五)- <wbr>Cacti插件

3.安装Threshold插件
v0.3.5.1版下载地址:http://download.cactiusers.org/downloads/thold.gzip
v0.3.5.1版为当前最新版本,此版本在cacti V0.8.6j上安装时有问题,提示一些函数找不到,所以在此使用v0.3.4版。
v0.34版下载地址:http://cactiusers.net/downloads/plugins/thold-0.3.4.tar.gz

1). 安装Threshold插件,只需将解压出来的Thold目录拷贝到cacti/plugins/目录下,并修改cacti配置文件(cacti目录下的include/config.php)。在配置中查找$plugins = array();行,在此行下面加入:
$plugins[] = 'thold';
刷新cacti首页,你将看到多出来一个Threshld选项卡。
下图是添加Threshold插件和Monitor插件后的cacti界面:

使用Cacti监控你的网络(五)- <wbr>Cacti插件

选中console选项卡,在左侧菜单中点击Settings,然后点击Alerting/Thold选项卡,来设置Threshold插件。

使用Cacti监控你的网络(五)- <wbr>Cacti插件
使用Cacti监控你的网络(五)- <wbr>Cacti插件

设置完成后在console选项卡下左侧菜单中点击Threshold Templates 。

使用Cacti监控你的网络(五)- <wbr>Cacti插件

点击Add按钮来添加一个Threshold模板。

使用Cacti监控你的网络(五)- <wbr>Cacti插件

在此,以添加一个监控硬盘空间的Threshold模板为例。

使用Cacti监控你的网络(五)- <wbr>Cacti插件

在Data Field下拉框中选择hdd_free,然后点击go按钮。

使用Cacti监控你的网络(五)- <wbr>Cacti插件 

填写以下信息,在Low Threshold文本框中填入1000,意思是当剩余的硬盘空间小于1000M时,发送邮件报警。在Threshold CDEF下拉框选择Divide by 1024,填入警报邮箱,完成Threshold模板的添加。

使用Cacti监控你的网络(五)- <wbr>Cacti插件 

应用刚才创建的Threshold模板。在console选项卡下点击Devices,选择要应用此模板的Host,点击最上面的Create Graphs for this Host链接,然后点击Auto-create thresholds链接来应用刚创建的Threshold模板。

 

设置完成后在console选项卡下左侧菜单中点击Thresholds 。

 使用Cacti监控你的网络(五)- <wbr>Cacti插件

在此可以管理已创建的警报。

使用Cacti监控你的网络(五)- <wbr>Cacti插件 

点击threshld选项卡可以查看警报的触发情况。

 使用Cacti监控你的网络(五)- <wbr>Cacti插件

 

4. 其它插件

其它插件可到http://cactiusers.org/downloads/自行下载安装,在此只略述一二。

1).Discovery:This plugin adds the ability to auto-discover devices on a subnet that are not monitored by Cacti and and tells you if they are SNMP enabled.

2). Flowviewer:A simple viewer for viewing reports based on data from flows created by Netflow.

3).Mac Track:The Mac Track plugin for Cacti by The Witness.

4).Settings:This plugin houses common settings and functions used by different plugins.

5).Network Weathermap:这是一个比较复杂的cacti插件,他需要GD库的支持,可以参照cacti的安装小节来支持GD库。使用它可以画出漂亮的网络状况图。

官网说明:http://www.network-weathermap.com/node/79

下载地址:http://www.network-weathermap.com/download

安装方法:

http://www.network-weathermap.com/manual/0.92/pages/install-cacti-editor.html

 

二、参考

 

Cacti官网:http://www.cacti.net/index.php

Cacti官网论坛:http://forums.cacti.net/

Cacti文档:http://docs.cacti.net/

Cacti插件:http://cactiusers.org/index.php

Network Weathermap:http://www.network-weathermap.com/

RRDTool官网:http://oss.oetiker.ch/rrdtool/

NET-SNMP官方网站:http://www.net-snmp.org/

Apache官网:http://httpd.apache.org/

MySQL官网:http://www.mysql.com/

PHP官网:http://www.php.net/

 
 
 
posted @ 2012-07-09 16:56  陳聽溪  阅读(2282)  评论(0编辑  收藏  举报