1. Cacti Overview
1. Cacti is a software implemented in PHP. Its main function is to collect data using the SNMP service, then store and update the data with RRDtool. When users need to view data, it generates charts using RRDtool to present to the user. Therefore, SNMP and RRDtool are the keys to Cacti. SNMP handles data collection, and RRDtool handles data storage and chart generation.
2. MySQL works with PHP programs to store and call variable data, such as hostname, host IP, SNMP community name, port number, template information, and other variables.
3. The data captured by SNMP is not stored in MySQL, but in the RRD files generated by RRDtool (located in the rra folder under the Cacti root directory). The updating and storage of data by RRDtool is the processing of RRD files, which are fixed-size archive files (Round Robin Archive). The number of data entries it can store is defined when it is created.
2. Installing RRDtool
CentOS-5:
32-bit:
- rpm -ivh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
64-bit:
- rpm -ivh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
- yum install rrdtool -y
CentOS-6:
32-bit:
- rpm -ivh http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
64-bit:
- rpm -ivh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
- yum install rrdtool -y
3. Installing and Configuring Net-SNMP
1. Install net-snmp
- yum install net-snmp net-snmp-libs net-snmp-utils
2. Configure net-snmp
Modify in /etc/snmp/snmpd.conf:
- view systemview included .1.3.6.1.2.1.1
To:
- view systemview included .1.3.6.1.2.1
3. Test net-snmp
- # service snmpd start
- # snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0
- SNMPv2-MIB::sysDescr.0 = STRING: Linux cronos 2.4.28 #2 SMP ven jan 14 14:12:01 CET 2005 i686
4. Installing LAMP
- yum install httpd php php-mysql php-snmp php-xml php-gd mysql mysql-server
- service httpd start
- service mysqld start
- mysqladmin -uroot password yourpassword
- mysqladmin –user=root –password reload
5. Installing Cacti
1. Download Cacti
- cd /tmp
- wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
- tar xzf cacti-0.8.8b.tar.gz
- mv cacti-0.8.8b /var/www/html/cacti
- cd /var/www/html/cacti
2. Create Database
- mysqladmin –user=root -p create cacti
3. Import Database
- mysql -uroot -p cacti < cacti.sql
4. Create Database User
- shell> mysql -uroot -p mysql
- mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
- mysql> flush privileges;
5. Configure include/config.php
- $database_type = "mysql";
- $database_default = "cacti";
- $database_hostname = "localhost";
- $database_username = "cactiuser";
- $database_password = "cactipassword";
- /* load up old style plugins here */
- $plugins = array();
- //$plugins[] = 'thold';
- /*
- Edit this to point to the default URL of your Cacti install
- ex: if your cacti install as at http://serverip/cacti/ this
- would be set to /cacti/
- */
- $url_path = "/cacti/";
- /* Default session name – Session name must contain alpha characters */
- #$cacti_session_name = "Cacti";
6. Set Directory Permissions
- useradd cactiuser
- chown -R cactiuser rra/ log/
7. Configure Scheduled Task
- echo "*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1">>/etc/crontab
- service crond restart
- service httpd restart
8. Complete Cacti Installation
1) Enter in browser: http://www.yourdomain.com/cacti/
Default Username: admin Password: admin
2) Change password
3) Set the command paths used by Cacti
At this point, the Cacti installation is complete.