Cacti is a front end to RRDTool, the purpose of which to provide an effective network graphing solution for monitoring devices within a Network. It can be used with SNMP to monitor various statistics about a device including but not limited to Load Average, Bandwidth, Disk Usage and Processes.
The following are the steps to install Cacti under Gentoo
- Modify your /etc/make.conf and modify your use flags adding “mysql xml sockets vhosts”, which should give you a line reading something similar to
USE="symlink mmx sse sse2 bash-completion vhosts xml sockets snmp"
- Now emerge Apache, PHP, Cacti and webapp-config. You may already have some of these installed but it is important to rebuild them with the new use flags.
sudo emerge apache php cacti webapp-config
Once completed if everything has installed correctly procede to the next step if you get an error saying “Could not read settings from webapp-config” I found the easiest way to solve this was to unmerege webapp-config and reinstalled it.
- Update your /etc/ config files if required
- Create a vhost if you don’t already have one and then run the following. Then install cacti to the vhost using webapp-config. Remember to change the -h option to reflect the name of your vhost and that you may need to set a different cacti version number if cacti has been updated since I posted this article.
sudo webapp-config -I -h yourdomain.com -d cacti cacti 0.8.7e-r1
- Its now time to setup the database that Cacti will be using.
mysqladmin -p --user=root create cacti
mysql -p --user=root cacti < /var/www/yourdomain.com/htdocs/cacti/cacti.sql # Remember to change this to reflect the path to your cacti install.
mysql -p --user=root mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword'; # Just a note I like to use apg to generate my passwords.
- Now that the database has been created your need to set the database settings in cacti. Modify /var/www/yourdomain.com/htdocs/cacti/include/config.php if your installing with a local database and only changed the password above that’s all you need to update in the config file.
- The last step of the install is to add a cron entry to your tab to get Cacti to update. Add the following entry to your crontab updating the path as needed.
*/5 * * * * apache /usr/bin/php /var/www/yourdomain.com/htdocs/cacti/poller.php > /dev/null 2>&1
- That should be it for Cacti base install visit http://yourdomain.com/cacti and you should be meet with a login screen use admin as the username and admin as the password. You should now see the Cacti inteface.
- Click on the Graphs tab accross the top and after a while once data starts coming in your should see the graphs start to be drawn. At the moment these graphs will display localhost data.
Thats all for now in the next post I will cover setting up net-snmpd on a host and then configuring Cacti to monitor it.