一 cacti的安装并接监控本机
1所需要的软件
yum install mysql php httpd rrdtool mysql-server php-mysql php-snmp net-snmp

2. 启动snmp
/etc/init.d/snmpd restart

3.验证snmp是否有用,没用别且修改
参照的东东是
http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/mrtg_config_step_3.php

yum install  *snmpwalk* -y
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex 查看snmp是否有用
 vi /etc/snmp/snmpd.conf

Change/Modify line(s) as follows:

Find following Line:

com2sec notConfigUser  default       public

Replace with (make sure you replace 192.168.0.0/24 replace with your network IPs) following lines:

com2sec local     localhost           public
com2sec mynetwork 192.168.0.0/24      public

Scroll down bit and change:

Find Lines:

group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

Replace with:

group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

Again scroll down bit and locate following line:

Find line:

view    systemview     included      system

Replace with:

view all    included  .1                               80

Again scroll down bit and change:

Find line:

access  notConfigGroup ""      any       noauth    exact  systemview none none

Replace with:

access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

Scroll down bit and change:

Find lines:

syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root  (configure /etc/snmp/snmp.local.conf)

Replace with (make sure you supply appropriate values):

syslocation Rhel6.1
syscontact 15802955296@139.com

4.启动snmp 再次验证是否有用

5 启动mysql
/etc/init.d/mysqld restart

6.下载cacti,和cacti-spine,并且解压缩2个软件移动到httpd的发布目录下,别且改名为自己要访问的目录
tar zxf cacti-0.8.7g.tar -C /var/www/html
cd /var/www/html
mv cacti-0.8.7g/ cacti



7.创建mysql的用户cacti
cd /var/www/html/cacti
mysqladmin create cacti

8 将cacti的数据库导入mysql
mysql cacti < cacti.sql

9进入mysql
给予cacti用户和密码 别且允许其查看cacti.sql
mysql
grant all on cacti.* to cacti@localhost identified by 'cacti';

10使用mysql -ucacti -pcacti登录数据库别且查看是否有cacti数据库
show databases;

11 修改cacti的配置文件
cd /var/www/html/cacti/include
vi config.php
将 数据库的用户名密码改为自己的 cacti

12建立用户cacti
useradd cacti

13 给予cacti用户的权限(日志和数据)
cd /var/www/html/cacti
chown -R cacti rra log

14 进入cacti用户建立
 crontab -e
*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

15重启 httpd mysqld snmpd

访问到cacti成功


              二 cacti的扩展
1.下载软件 cacti-spine-0.87g
tar zxf cacti-spine-0.87gyum insta
cd cacti-spine

2.安装所需要的软件
yum install automake-1.11.1.1.2.el6 *libtoolize* autoconf-2.63.5.1.el6 mysql-devel net-snmp-devel
aclocal
libtoolize --force
aoutoheader
autoconf
automake
./configure
make && make install

3.cd /usr/local/spine/etc
mv spine.conf.dist spine.conf
vi spine.conf

用户名密码 改为自己的
cactiDB_Host     localhost
DB_Database     cacti
DB_User         cacti
DB_Pass         cacti
DB_Port         3306
DB_PreG         0

/etc/init.d/httpd restart
/etc/init.d/snmpd restart
访问http://192.168.0.5/cacti
User:      useradmin     admin
Passwd    useradmin     admin

将concle—settings-paths的Spine Poller File Path的路径改为
/usr/local/spine/bin/spine
将concle—settings-poller 第一项改为spine

如下图:
 

cacti自我总结本机监控_软件

cacti自我总结本机监控_public_02


 
本机的自己监控就完成了


                           二 cacti监控插件的安装
tar zxf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cd cacti-plugin-arch/
cp cacti-plugin-0.8.7g-PA-v2.8.diff /var/www/html/cacti/
yum install patch -y
cd /var/www/html/cacti/include/
cd /root/cacti-spine-0.8.7g
tar zxf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cd cacti-plugin-arch/
mysql cacti < pa.sql