Install and Configure Cacti

1.Required Packages for RPM-based Operating Systems

    yum -y install cairo-devel libxml2-devel pango-devel php-mysql mysql-devel php-snmp php-xml net-snmp-utils net-snmp

2.install rrdtool

    [root@cacti ~]# cd rrdtool-1.4.7    
    [root@cacti rrdtool-1.4.7]# ./configure --prefix=/usr/local/rrdtool    
    [root@cacti rrdtool-1.4.7]# make && make install    
    [root@cacti rrdtool-1.4.7]# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

3.Create cacti os user

    shell>mkdir /home/cacti    
    shell> useradd -r -s /sbin/nolog -h /home/cacti cacit    
    shell>chown cacti:cacti /home/cacti

4.Extract the distribution tarball. Untar to the DOCUMENT_ROOT of your web server

    shell> tar -xzvf cacti.tar.gz

5.Create the MySQL database:

    shell> mysqladmin --user=root create cacti

6.Import the default cacti database:

    shell> mysql cacti < cacti.sql

7.Optional: Create a MySQL username and password for Cacti.

    shell> mysql --user=root mysql
    mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
    mysql> flush privileges

8.Edit “include/config.php” and specify the database type, name, host, user and password for your Cacti configuration.

    $database_type = "mysql";    
    $database_default = "cacti";    
    $database_hostname = "localhost";    
    $database_username = "cactiuser";    
    $database_password = "cacti";    
    $url_path = "/";

9.Configure the privileges of rra and log:

    shell> chown -R cacti:cacti rra/ log/

10.Configure snmp.conf

    修改com2sec notConfigUser default public为:    
    com2sec notConfigUser根据实际情况修改) public    
    修改access notConfigGroup ""      any       noauth    exact systemview none none,为    
    access notConfigGroup ""      any       noauth    exact all    none none    
    修改#view all    included .1 80为    
    view all    included .1 80
    重启snmp服务:service snmpd restart    
    执行命令验证:snmpwalk -v 2c -c public your_remote_ip if
11.Configure httpd.conf

    cat /etc/httpd/conf.d/cacti.conf    
    Listen 8888    
    NameVirtualHost *:8888    
    <VirtualHost *:8888>    
    DocumentRoot /usr/local/cacti
    ServerName *
    ErrorLog /usr/local/cacti/log/mycacti_err.log    
    CustomLog logs/mycacti.log common    
    启动httpd服务:service httpd restart

12.Add a line to your ”/etc/crontab” file similar to1):

    crontab -e -u cacti
    */5 * * * * /usr/bin/php /usr/local/cacti/poller.php > /dev/null 2>&1