Installing Cacti in my lab

· 5 min read

I needed to monitor my Lab at home and check what I could do with Cacti to monitor Citrix XenServer, XenApp, XenDesktop, PVS, SQL etc… I chose to use a all in one distrib at first, CactiEZ () but I ran out of possibilities very fast and CactiEZ is still based on a CentOS 4 version… If you don’t care about the CentOS version, you do thing a lot more easy by using this distrib. I chose to use CentOS 5 () for some other reasons but mostly because this OS is supported by XenServer.

When you chose to start with a clean OS installation you need to know what you want to install, because either you install everything, including what you don’t need, either you install almost nothing and install only what you’ll need. I tried to make a clean work and chose to start with a clean installation, the lightest possible and install only what I would need.

Minimal installation type, I just posted screenshots to let some of you follow the same step, I don’t have any specific advanced knowledge on Linux stuff :

Then once rebooted, you need to check your network configuration and make necessary change to make it work on your LAN.

Before going with Cacti installation process, I wanted to have my CentOS distrib up to date, so I ran the following command :

yum update

Cacti will use SNMP so this is the command you need to run to install and enable SNMP :

yum install net-smtp

Cacti needs a database, I chose MySQL because this a the one I know the more and it’s very easy to setup :

yum install mysql

yum install mysql-server

Then to install Cacti using a yum command, you need to create a new file named dag.repo in the following directory :

vi /etc/yum.repos.d/dag.repo

past

dag.repo   
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=$releasever/en/$basearch/dag
gpgcheck=0
enabled=1
protect=0

save this file and run :

yum install cacti

To be able to access Cacti web setup pages, you need to allow web access :

vi /etc/httpd/conf.d/cacti.conf

remove the line “deny from all”

Now you need to start the MySQL service and apache web service and make those two services start automatically at you server boot.

service mysql start

service httpd start

chkconfig –level 345 httpd on

chkconfig –level 345 mysqld on

To configure MySQL for Cacti ,you need to setup the access and create the database and user :

Next edit the config.php file in /var/www/cacti/include/

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "password";

save the file and the give proper rights :

chown -R cactiuser /var/www/cacti/rra/ /var/www/cacti/log/

and add this line to your crontab file :

*/5 * * * * cactiuser php /var/www/cacti/poller.php > /dev/null 2>&1

Here is the Cacti web installation process using the address :

After to add some plugins you need to change many files in Cacti’s base installation dir, to do so without destroying or missing something, you need to download the Cacti Plugin Architecture (same version as your Cacti version, 8.7h for me)

tar -zxvf cacti-plugin-0.8.7h-PA-v3.0.tar.gz

Then you need to copy the .diff file to your cacti install directory and run :

patch -p1 -N –dry-run < cacti-plugin-0.8.7h-PA-v3.0.diff to test if everything is ok

then patch -p1 -N  < cacti-plugin-0.8.7h-PA-v3.0.diff

And you’re all set ! Next work will be on writing a template and script to catch XenApp sessions and XenDesktop metrics.