Skip to main content

Installing Cacti

Installing Cacti in Centos 6.2 (Part 1): 

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

Comments

Popular posts from this blog

20 perl programming tips

1. List all Installed Perl Modules from Unix Command Line Get a list of all installed perl modules as shown below. $ perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/Filter.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/LinkExtor.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/PullParser.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/Parser.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/TokeParser.pm ..... In the above example, File::Find  and  File::Spec::Functions  module are used to list all installed modules. -M option  loads the module. It executes  use module  before executing the script -T option  enables taint checking, which instructs perl to keep track of data from the user and avoid doing anything insecure w...

Perl and Excel: How to Read, Write, Parse Excel Files using Perl

If you want to manipulate excel files programmatically, you can use Perl Spreadsheet module, which provides an object interface that makes it easier to create and parse Excel files. Install Spreadsheet WriteExcel Module Method 1: Standard install using make Download the zipped tar file of  Spreadsheet-ParseExcel  and  Spreadsheet-WriteExcel  from cpan. Untar and unzip the module as follows: tar -zxvf Spreadsheet-WriteExcel.tar.gz cd to the directory the tar creates. Execute the steps below to to install the Spreadsheet-WriteExcel module. perl Makefile.PL make make test make install Use the above procedure to install Spreadsheet-ParseExcel also. Method 2: CPAN.pm install If you have CPAN.pm configured you can install the module as follows: perl -MCPAN -e 'install "Spreadsheet::WriteExcel"' perl -MCPAN -e 'install "Spreadsheet::ParseExcel"' For additional installation help refer to: How To Install Perl Modules Manually and Using ...

How to Connect to MySQL from Perl

How do I connect to a MySQL database from a perl program? use perl DBI module to connect to a MySQL database as explained below. If you don’t have perl DBI and DBD::mysql module installed, install perl module using cpan as we discussed earlier. # perl -MCPAN -e shell cpan> install DBI cpan> install DBD::mysql On a very high level, you’ll have to do the following three steps to connect to a MySQL database and get data. 1. Connect to the MySQL Database In the DBI module, you’ll use the connect function as shown below. $dbc = DBI->connect($source, $username, $password) DBI->connect function takes the following three arguments: $source – This is in the format of “DBI:mysql:[database]:[hostname]”. Replace the [database] and [hostname] with values from your system. In the example shown below, it is connecting to the database called “mycompany” that is running on the localhost. $username – The username that is used to connect to the MySQL database. $pass...