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
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
directive is enabled.
Do the same for /etc/php.d/snmp.ini
Cacti also recommends that you modify the temp dir for /etc/php.ini
make sure that
file_uploads = on
are enabled directives.
You also want to edit your /etc/httpd/conf/httpd.conf and make sure you add the line:
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
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:
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.
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:
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.
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):
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:
*/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:
-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.