[root@ser1 ~]# yum-y install httpd php php-mysql php-ldap php-xml net-snmp-utils mysqlmysql-server net-snmp crond rrdtool lm_sensors

gcc gcc-c++  zlib-devel  libpng-deve

[root@ser1rrdtool-1.2.27]# yum -y install libart_lgpl libart_lgpl-devel

[root@ser1rrdtool-1.2.27]# yum -y install freetype freetype-devel

[root@ser1 ~]#mkdir /cacti

[root@ser1 ~]# mv/root/Desktop/rrdtool-1.2.27.tar.gz /cacti/

[root@ser1 ~]# cd/cacti/

[root@ser1 cacti]#tar -zxf rrdtool-1.2.27.tar.gz -C /usr/src

[root@ser1 cacti]#cd /usr/src

[root@ser1 src]#cd rrdtool-1.2.27/

 

 

[root@ser1rrdtool-1.2.27]# ./configure --prefix=/usr/local

[root@ser1rrdtool-1.2.27]# make && make install

rrd  ------tab键可以补全  rrdtool安装成功

[root@ser1rrdtool-1.2.27]# cd /root/Desktop/

[root@ser1Desktop]# tar -zxf cacti-0.8.7g.tar.gz -C /usr/src/

[root@ser1Desktop]# cd /usr/src/

[root@ser1 src]#cp -r cacti-0.8.7g/ /var/www/html/

[root@ser1Desktop]# useradd cactiuser

 [root@ser1 cacti]# cd /usr/src/ cacti-0.8.7g/

[root@ser1cacti-0.8.7g]# chown -R cactiuser:cactiuser rra/ log/

[root@ser1cacti-0.8.7g]# service mysqld start

[root@ser1cacti-0.8.7g]# mysql

mysql> createdatabase cactidb default character set utf8;

mysql> grantall on cactidb.* to 'cactiuser'@'localhost' identified by '123456';

mysql> \q

cacti.sql数据库导入到cactidb

[root@ser1cacti-0.8.7g]# mysql -ucactiuser -p123456 cactidb < cacti.sql

-u用户名  -p密码        

数据库名是上面在msyql数据库中创建的

用户名密码是数据库中授权的

[root@ser1include]# service httpd restart;chkconfig httpd on

[root@ser1 html]#cd /var/www/html/cacti/include

[root@ser1 html]#vimconfig.php

 

更改为在数据库中授权的用户名密码  库名

[root@ser1 scripts]# vim/etc/snmp/snmpd.conf

62 access  notConfigGroup ""      any      noauth    exact all none none    //systemview改为all

85 view all    included .1           80  //取消注释

chkconfig snmpd on

112 com2secnotConfigUser   192.168.10.10        public    //监控服务器的ip地址

[root@ser1scripts]# service snmpd start;chkconfig snmpd on

 

 

 

 

监控本机的配置192.168.10.10

另一客户端的配置192.168.10.20

[root@srv4 media]#yum -y install net-snmp net-snmp-utils

[root@srv4 media]#vim /etc/snmp/snmpd.conf

配置与上面一样

[root@srv4 media]#service snmpd restartchkconfig snmpd on

服务器端的配置操作 device--点击右上角的add

完成以上点击右下角的 create

 

Associated DataQueries添加以下的数据

SNMP - Get MountedPartitions

SNMP - GetProcessor Information

SNMP - InterfaceStatistics

添加完毕 save保存

 

 

保存完成后,点击create graphs for this host

创建图形

 

点击右下角的创建    开始创建图形

 

安装cacti-plugin-0.8.7g-PA-v2.9.tar.gz是插件

[root@ser1Desktop]# tar -xzf cacti-plugin-0.8.7g-PA-v2.9.tar.gz –C /var/www/html/cacti

[root@ser1 cacti]#cd /var/www/html/cacti

[root@ser1 cacti]#patch–p1 –N cacti-plugin-0.8.7b-PA-v2.1.diff

[root@ser1 cacti]#mysql –u root –p cactidb<pa.sql

 [root@ser1 cacti]# vim include/global.php

[root@ser1 cacti]#vim include/config.php

之前修改的配置不需要再进行修改

 

注意:一定要在cacti后加入 / 否则web页面无法读取正确内容

web页面的配置

[root@ser1Desktop]# tar -zxf monitor-v1.3-1.tgz

[root@ser1Desktop]# tar -zxf settings-v0.71-1.tgz

[root@ser1Desktop]# tar -zxf thold-v0.4.9-3.tgz

[root@ser1Desktop]#unzip php-weathermap-0.97a.zip

[root@ser1Desktop]#mv clog monitor settings weathermap /var/www/html/cacti/plugins/

[root@ser1Desktop]#cd /var/www/html/cacti/plugins/

[root@ser1 monitor]#mysql–uroot –p cactidb<monitor.sql

安装好weathermap后,看到点Console在左边的列表里会看到weathermap的菜单,我们点击,会看到设置,因为我们还没有定义一个weathermap配置文件,所以我们点右上角的Add按钮,添加一个weathermap配置文件,如果提示gd之类的错误,需要安装gdgd-php

点击Add之后,我们看到有二个文件,其实这个时候调用的就是weathermapconfigs目录下的文件,simple.conf就是自带的一个配置文件,我们可以点击它前面的Add按钮,把他添加到默认配置文件里

至此我们添加了一个weathermap的配置文件,下面就是对weathermap进行配置了,点击weathermap,然后点击Editor对默认图形配置文件进行配置。

点击editor后我们会看到如下提示

 

The editor has not been enabled yet. You need to set ENABLED=true at thetop of editor.php

Before you do that, you should consider using FilesMatch (in Apache) orsimilar to limit who can access the editor. There is more information in theinstall guide section of the manual.

我们按照他提示的编辑editor.php

 

1

vi /var/www/html/plugins/weathermap/editor.php


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

<php

 

require_once 'editor.inc.php';

require_once 'Weathermap.class.php';

 

// so that you can't have the editor  active, and not know about it.

$ENABLED=true;

 

if(! $ENABLED)

{

print "

 

The editor has not been enabled yet. You  need to set ENABLED=true at the top of editor.php

 

";

print "

 

Before you do that, you should consider  using FilesMatch (in Apache) or similar to limit who can access the editor.  There is more information in the install guide section of the manual.

 

";

exit();

}

修改完成后点开editor弹出

把上面的$ENABLED=false;改为$ENABLED=true;然后保存。之后我们刷新页面就可以看到如下页面

 

继续修改配置文件

[root@DBserver weathermap]# vim  editor.php