This howto describes how to install and configure Cacti quickly on a CentOS server. Cacti packages are available from the RPMforge repository. Read this for information about the RPMForge repository. But beware, some repositories do not mix well. The rest of this HOWTO assumed that your system is set up to use the RPMforge repository. See http://wiki.centos.org/Repositories/RPMForge for instructions regarding RPMForge.
Install Cacti, Cactid and required Dependencies (yum install cacti cacti-cactid mysql-server net-snmp)
Modify /etc/httpd/conf.d/cacti.conf commenting out the following lines or modifying them to work with your configuration:
order deny,allow
deny from all
allow from 127.0.0.1
- Restart Apache (/etc/init.d/httpd restart)
- Make sure that httpd and mysqld are set to start on boot with the following commands:
/sbin/chkconfig httpd on
/sbin/chkconfig mysqld on
- If you want to monitor disk useage on the localhost make sure that snmpd is set to start at boot and that /etc/snmp/snmpd.conf is configured:
/sbin/chkconfig snmpd on
By default the SNMP community string is public. Modify this if you wish.
- Make sure the above services are currently started:
/etc/init.d/httpd start
/etc/init.d/mysqld start
/etc/init.d/snmpd start
- Create the cacti MySQL database:
mysqladmin create cacti
- Import the cacti database:
mysql cacti < /var/www/cacti/cacti.sql
- Create MySQL user for the cacti database and give it permission to the cacti database:
shell> mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘somepassword’;
mysql> flush privileges;
mysql> exit
- Modify the database connection information in the following files:
/var/www/cacti/include/config.php
/etc/cactid.conf
- Run Cactid as root and then change permissions.
shell> cactid
shell> chown -R cacti.cacti /var/net-snmp
Log in to Cacti by browsing to http://server/cacti. Username: admin, Password: admin. You will be prompted to change the password of the admin user.
Follow steps for a new install
Setup Cacti to use the cactid poller:
Console>Configuration>Settings>Paths
Modify “Cactid Poller File Path” to read /usr/bin/cactid
Click Save. Click the Poller tab.
Select cactid from the “Poller Type” drop down.
Select Ping and Snmp… from the “Downed Host Detection” drop down.
Click Save.
Add some devices and graphs:
Console>Create
Console>Create Graphs
Console>Management>Graph Management and add an existing host to a tree
Enjoy. The cron job located at /etc/cron.d/cacti will run poller.php every 5 minutes. It will get the poller configuration from the database and spawn cactid for polling. Graphs will show up after the first poll, they will populate with data after the second poll.