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.
For those who don’t know, Cacti’s goal is to create nice graphs about system performance and status.
- Emable the centosplus repository (cacti now needs php5).
- Install cacti and its dependencies (yum install cacti).
- Install mysql-server (yum install mysql-server).
- Modify /etc/httpd/conf.d/cacti.conf (allow from line).
- Restart Apache (service httpd restart).
- Make sure httpd, mysqld, snmpd start at boot and start these services if they were not started yet.
Make sure snmpd accepts ‘public’ as public community from localhost, and restart snmpd. You can use the command ‘snmpconf -g basic_setup’ to generate an snmpd.conf file.Â In CentOS 5.x the default snmpd installation does not grant full read permissions to the “public” community string. You can setup an snmp user for cacti adding the following lines to /etc/snmp.conf :
com2sec cactiUser default cacti group cactiGroup v1 cactiUser group cactiGroup v2c cactiUser view cactiROView included .1 access cactiGroup "" any noauth exact cactiROView none none
- Start the MySQL console client:
By default MySQL uses a blank password, you should really set a password to get any real security.
mysqladmin create cacti
- Create mysql user for Cacti (use decent values for username and password):
mysql> GRANT USAGE ON * . * TO 'user'@'localhost' IDENTIFIED BY 'password';
- Give permissions to the cacti user (replace ‘user’ with the value you chose at 9).
mysql>GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , INDEX , LOCK TABLES , ALTER ON cacti . * TO 'user'@'localhost';
- Populate the cacti database (use your values for user and password)
#mysql cacti -u user -ppassword < /var/www/cacti/cacti.sql
- Change /var/www/cacti/include/config.php to set your username and password (chosen at 9). Have a quick look at the rest of the settings won’t harm.
Log in to Cacti by browsing toÂ http://server/cacti/ (if it doesn’t work, check /etc/httpd/conf.d/cacti.conf and make sure you restarted httpd). Username: admin, password: admin. You will be prompted to change the password for the admin user.
- Some checks need SNMP, so we have to set the community to be used:
Console tab-> Create Devices: -> Localhost -> set SNMP Version : Version 2 Console tab-> Create Devices: -> Localhost -> set SNMP community: public, save.
- Now cacti is installed, configured and working. Go to the graphs tab, you will see that the default config already has a couple of graphs for localhost. Be patient, data used to populate the graphs are gathered every 5 minutes by default. You may have to wait 15-20 minutes to see something there.
- Want more graphs? We can start smoothly: add a graph of free HDD space.
Go to Console tab -> Create Graph
You should see the mounted partitions under “Data Query [UNIX - Get Mounted Partitions]“. Check the box, create, save, and wait. Then go in the Graph tab to see the result.
- Now let’s try to add a graph that needs SNMP to gather the data. One useful graph to have is a graph of network interface traffic.
- Go to:
Console tab -> Create Graphs -> Edit this host
- Look for
Associated Data Queries
Add Data Query", SNMP Interface Statistics, reindex none
from the drop-down menu. ClickÂ add andÂ save.
- Go back to
Console tab -> Create Graphs
You will see a list on network interface present on your system. Just check the box you want, clickÂ create.
- Go to:
This demonstrates just a part of Cacti’s functionality. You can graph remote hosts as well using SNMP.