Ubuntu version : ubuntu-11.04-server-i386
安装好ubuntu后,切换成root登陆,免输sudo..
先更新一下: apt-get update && upgarde
看下cacti版本: apt-cache show cacti
输入tasksel,安装下 LAMP 和 SSH.
这里给mysql的root账号输入密码,
一. 安装Cacti
开始安装cacti :apt-get install cacti snmpd
无视下面的警告,直接OK:
http server 选中 apache2
下面选yes,此处用来配置cacti数据库
输入mysql的root密码,
mysql创建账号给cacti使用,这里需要输入密码,默认输入 cactiuser
到这里cacti安装OK.
Cacti 的安装目录位于 /var/share/cacti
查看server IP 地址:ifconfig ,
在IE 中输入 : http://server ip/cacti ,进入cacti配置界面:
这里应该全部是OK:
输入初始账号\密码: admin\ admin
点击 graphs标签,如果可以看到localhost 的图形数据 ,则表示cacti安装成功(如果看到图是XX,等10分钟刷新再看)。
安装spine (可选):
cacti默认使用cmd.php轮询抓取数据,不过效率较低,换成spine可提高效率。
安装命令: apt-get install cacti-spine
安装OK后把poller type 改成spine ,观察graphs里localhost图形,如果没有问题,则更换poller成功,如果spine有问题,可以改回cmd.php。
二.扩展cacti 插件架构Plugin Architecture
Cacti默认不可以添加插件,需要扩展架构后才可以使用。
需要下载对应cacti版本的PA,此处cacti为0.8.7g,PA对应版本为V2.8
1.进入root账户home目录 : cd
2.建立一个文件夹: mkdir share, 进入share : cd share
3.下载需要用的Plugin Architecture:
wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
一些常用插件的地址,可以一并下载:
Monitor : http://mirror.cactiusers.org/downloads/plugins/monitor-0.8.2.tar.gz
Weathermap: http://www.network-weathermap.com/files/php-weathermap-0.97a.zip
Discover: http://cactiusers.org/downloads/discovery.tar.gz
Syslog: http://cactiusers.org/downloads/syslog.tar.gz
NPC : http://www.scsorlando.com/files/npc2.0.4.tar
4.解压缩cacti-plugin-0.8.7g-PA-v2.8.tar.gz : tar xzf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
5.进入解压后目录,将此文件夹中所有文件copy至 /usr/share/cacti/site
命令 : cp -R ./* /usr/share/cacti/site
6.进入cacti目录,cd /usr/share/cacti/site
7.运行如下命令 pach -p1 –N < cacti-plugin-0.8.7g-PA-v2.8.diff
下面为执行结果,可以看到有FAILED 出现,提示failed的文件重新覆盖下,将PA 解压出的文件夹files-0.8.7g 中
的
file data_sources.php覆盖site下的
file data_sources.php文件。
root@monitorsz:/usr/share/cacti/site# patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
patching file auth_changepassword.php
patching file auth_login.php
patching file data_sources.php
Hunk #6 FAILED at 1323.
1 out of 6 hunks FAILED -- saving rejects to file data_sources.php.rej
patching file graph_p_w_picpath.php
patching file graph.php
patching file graphs_new.php
patching file graphs.php
patching file host.php
patching file p_w_picpaths/disable_icon.png
patching file p_w_picpaths/enable_icon_disabled.png
patching file p_w_picpaths/enable_icon.png
patching file p_w_picpaths/install_icon_disabled.png
patching file p_w_picpaths/install_icon.png
patching file p_w_picpaths/uninstall_icon.gif
patching file p_w_picpaths/view_none.gif
patching file include/auth.php
patching file include/bottom_footer.php
patching file include/config.php
Hunk #1 succeeded at 26 with fuzz 2 (offset -4 lines).
patching file include/global_arrays.php
patching file include/global_constants.php
patching file include/global_form.php
patching file include/global.php
Hunk #2 succeeded at 195 with fuzz 2.
patching file include/global_settings.php
Hunk #1 succeeded at 1191 (offset 1 line).
patching file include/plugins.php
patching file include/top_graph_header.php
patching file include/top_header.php
patching file index.php
patching file lib/api_device.php
patching file lib/auth.php
patching file lib/functions.php
patching file lib/html_form.php
patching file lib/html.php
patching file lib/plugins.php
patching file lib/poller.php
patching file lib/rrd.php
patching file lib/variables.php
patching file plugins/index.php
patching file plugins.php
patching file poller.php
patching file user_admin.php
patching file utilities.php
8.执行覆盖:
root@monitorsz:/usr/share/cacti/site/files-0.8.7g# cp data_sources.php ../
9.覆盖后修改下config.php :
root@monitorsz:/usr/share/cacti/site# vi /usr/share/cacti/site/include/config.php
找到 $url_path = “/”修改如下:
root@monitorsz:/usr/share/cacti/site# vi /usr/share/cacti/site/include/config.php
找到 $url_path = “/”修改如下:
9.cd到site目录,进入mysql命令行: mysql -u root -p ,回车后输入mysql密码,进入后
查看数据库: show database;
进入cacti数据库: use cacti
导入pa.sql : source pa.sql
Exit退出
10.重启apache服务 :
root@monitorsz:/usr/share/cacti/site# /etc/init.d/apache2 restart
11.登陆cacti,进入Console -> User Management ,选择admin账户,在下面选中Plugin Management ,点击 save。
12.左侧出现 plugin management , 则PA安装OK:
三,添加插件
一.添加monitor插件
1.进入插件的下载目录 /root/share, 解压monitor打包文件
root@monitorsz:~# cd share
root@monitorsz:~/share# tar xzf monitor-0.8.2.tar.gz
解压后得到monitor文件夹
2.将monitor文件夹copy到../cacti/site/plugins 下:
root@monitorsz:~/share# cp -R monitor /usr/share/cacti/site/plugins
3. 点击
Plugin Management ,可以看到添加的monitor插件了。点击actions的箭头启用。
4. Console -> User Management ,选择admin账户,在下面选中View Monitoring 。
5.出现monitor标签页,插件安装完成。