I’ve installed Cacti all over the place for server monitoring, but haven’t yet written a guide for it here. There are a lot of great resources out there to get info on this subject, and I’ll just add my 2 cents.
The Post-Install of Centos
From a fresh install, do a yum update to get the ball rolling.
From there, you might want to add other packages that will get us going:
yum install vim mysql httpd php php-mysql php-snmp mysql mysql-server net-snmp wget
More Details
a) PHP
Once you get all those pieces in place, lets get PHP properly configured.
Then make sure that in your /etc/php.d/mysql.ini the
extension=mysql.so
directive is enabled.
Do the same for /etc/php.d/snmp.ini
extension=snmp.so
Cacti also recommends that you modify the temp dir for /etc/php.ini
make sure that
file_uploads = on
session.save_path=/tmp
are enabled directives.
b) Apache
You also want to edit your /etc/httpd/conf/httpd.conf and make sure you add the line:
include conf.d/*.conf
c) mySQL
Lets get mysqld on and set to startup:
service mysqld start
chkconfig mysqld on
Now lets set a mysql root password
mysqladmin -u root password somepassword
Installing Cacti
Next you actually want to get the Cacti tar ball. At the time of writing, Cacti 0.8.8 is the latest. Last time I checked, yum had the Cacti 0.8.7h, so since there were big changes to Cacti in the 0.8.8 release, you want to get the latest- not the yum package.
Head over to the Cacti page and get the path to the latest ver.
Mine happened to be:
http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
Once you’ve got that business written down in blood on some napkin somewhere, use wget to download it to somewhere silly, like your home dir.
wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
This will drop the tar ball there for you to tamper with.
Untar the file with a quick:
tar xzvf cacti-0.8.8a.tar.gz
Then, for good measure, remove the tarball from your crusty temp folder:
rm -Rf cacti-0.8.8a.tar.gz
That way, you have more room for rrd’s.
a) User accounts and mySQL
Here, you’ll want to create a nix user for cacti:
adduser cacti
passwd cacti
Next, lets create the blank cacti database for mySQL:
mysqladmin -u root -p create cacti
next get in your cacti extracted folder and merge the cacti.sql database with your newly created mysql one.
cd cacti-0.8.8a
mysql -u root -p cacti < cacti.sql
Next, well get into mySQL and create a user that cacti will use to access this database.
mysql -u root -p mysql
> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘somepassword’;> flush privileges;
b) various other things
Then you want to exit, pop back to cli and edit the include/config.php that is in your cacti folder (that is still in your temp dir):
vim include/config.php
Here you want to change the username and password to match the mySQL username/pass combo that you did in the last step.
Now, save that business, its time to move on.
Then you want to give this user permissions on the /log and /rra folders in your cacti folder
chown -R cacti ./rra ./log
Next, you want to edit your crontab something like this to cleanup the older stuff on occasion:
vim /etc/crontab
*/5 * * * * cacti php /var/www/html/cacti/poller.php > /dev/null 2>&1
Now you want to move your cacti folder to your apache html folder:
cp -r ./cacti-0.8.8a /var/www/html/
mv /var/www/html/cacti-0.8.8a /var/www/html/cacti
Lets get Apache running
service httpd start
chkconfig httpd on
Lastly, you want to add an exception for port 80 over IPTables:
vim /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
Now, browse to your server @ http://IP(or hostname)/cacti and follow the web installation instructions
Part 2 will cover the rest of the installation with the GUI and some plugins
You must be logged in to post a comment.